fix(SF-60): Правки повторной пересылки
This commit is contained in:
parent
edd9c2d423
commit
22c6025389
@ -120,8 +120,17 @@ void free_rtos::EthRxFlow::rxProcessPktTask()
|
||||
|
||||
while(1)
|
||||
{
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
status = sem_[e_signalRxPkt].pend();
|
||||
if(enetDmaRxChId_ != ENET_DMA_RX_CH0) {
|
||||
status = sem_[e_signalRxPkt].pend();
|
||||
} else {
|
||||
status = sem_[e_signalRxPkt].pend(semaphore_timeout_ticks_);
|
||||
}
|
||||
|
||||
if(status != SystemP_SUCCESS) {
|
||||
EnetAppUtils_print("RX Timeout ");
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
do {
|
||||
EnetDma_PktQ rxFreeQ;
|
||||
@ -183,6 +192,7 @@ bool free_rtos::EthRxFlow::open(uint32_t id, int32_t enetDmaRxChId, UBaseType_t
|
||||
}
|
||||
|
||||
id_ = id;
|
||||
enetDmaRxChId_ = enetDmaRxChId;
|
||||
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
rxInArgs.notifyCb = rxIsrHandler; /// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
@ -51,7 +51,10 @@ private:
|
||||
e_signalTotal
|
||||
};
|
||||
|
||||
static constexpr uint32_t semaphore_timeout_ticks_ = 2000;
|
||||
|
||||
uint32_t id_; /// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
int32_t enetDmaRxChId_;
|
||||
bool open_; /// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>, <20><><EFBFBD> dma <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
Semaphore sem_[e_signalTotal]; /// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
@ -307,7 +307,12 @@ void EthEcatPdoFMMU::process(Allocator& allocator) {
|
||||
}
|
||||
#else
|
||||
if(callback_ != nullptr) {
|
||||
callback_();
|
||||
try {
|
||||
callback_();
|
||||
}
|
||||
catch(std::exception& e) {
|
||||
DebugP_log((char*)"EthEcatPdoFMMU::process(). Callback exception caught: %s\r\n", e.what());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -372,7 +377,12 @@ void EthEcatPdoFMMU::process_fake(Allocator& allocator, uint32_t period_microsec
|
||||
}
|
||||
#else
|
||||
if(callback != nullptr) {
|
||||
callback();
|
||||
try {
|
||||
callback();
|
||||
}
|
||||
catch(std::exception& e) {
|
||||
DebugP_log((char*)"EthEcatPdoFMMU::process(). Callback exception caught: %s\r\n", e.what());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@ -20,7 +20,7 @@ EthEcat::EthEcat(Eth& eth)
|
||||
|
||||
void EthEcat::Init(TEthMacPorts port_id, uint32_t period_microsec = 250) {
|
||||
port_id_ = port_id;
|
||||
telegram_.init(port_id, period_microsec, 4);
|
||||
telegram_.init(port_id, period_microsec, 10);
|
||||
|
||||
Timer::Settings ecat_tmr_sett = {
|
||||
.input_clk_Hz = 25000000, // 25MHz
|
||||
|
||||
@ -13,9 +13,9 @@ namespace telegram {
|
||||
|
||||
const char EcatTelegramStatus::SuccessString[] = "Success !";
|
||||
const char EcatTelegramStatus::BusyString[] = "Busy. Transfer in progress...";
|
||||
const char EcatTelegramStatus::WarningTransferErrorString[] = "Warning ! Transfer error. Check error counters";
|
||||
const char EcatTelegramStatus::WarningTimeoutErrorString[] = "Warning ! Connection timeout error. Check error counters";
|
||||
const char EcatTelegramStatus::WarningWkcErrorString[] = "Warning ! WKC error. Check error counters";
|
||||
const char EcatTelegramStatus::WarningTransferErrorString[] = "Warning ! Transfer error";
|
||||
const char EcatTelegramStatus::WarningTimeoutErrorString[] = "Warning ! Connection timeout error";
|
||||
const char EcatTelegramStatus::WarningWkcErrorString[] = "Warning ! WKC error";
|
||||
const char EcatTelegramStatus::FatalErrorString[] = "Fatal error ! Transfer attempts exceeded";
|
||||
|
||||
const EcatDescription EcatTelegramStatus::descriptions[] = {
|
||||
@ -100,7 +100,7 @@ bool EcatTelegram::transfer() {
|
||||
|
||||
auto first = datagram_queue_.get_first();
|
||||
TxFlowHandlerArgs txFlowHandlerArgs;
|
||||
uint32_t transfer_attempts = 0;
|
||||
uint32_t transfer_attempts = max_transfer_attempts_ + 1;
|
||||
uint32_t tick_counter_start;
|
||||
uint32_t tick_counter_diff;
|
||||
bool status = (first == nullptr);
|
||||
@ -123,8 +123,8 @@ bool EcatTelegram::transfer() {
|
||||
while(1) {
|
||||
tick_counter_start = ecat_timer_.Wait();
|
||||
|
||||
transfer_attempts++;
|
||||
status = (transfer_attempts <= max_transfer_attempts_);
|
||||
transfer_attempts--;
|
||||
status = (transfer_attempts != 0);
|
||||
|
||||
if(status == false) {
|
||||
DebugP_log((char*)"%s\r\n", status_.get_description().string);
|
||||
@ -133,6 +133,8 @@ bool EcatTelegram::transfer() {
|
||||
status_.result = EcatTelegramResult::FATAL_ERROR;
|
||||
|
||||
DebugP_log((char*)"%s: %d\r\n", status_.get_description().string, max_transfer_attempts_);
|
||||
DebugP_log((char*)"%s: %d\r\n", status_.get_description(EcatTelegramResult::WARNING_TRANSFER_ERROR).string, status_.transfer_errors);
|
||||
DebugP_log((char*)"%s: %d\r\n", status_.get_description(EcatTelegramResult::WARNING_WKC_ERROR).string, status_.expected_wkc_errors);
|
||||
DebugP_log((char*)"Tick counter diff: %d/%d\r\n", tick_counter_diff, counter_timeout_ticks_);
|
||||
DebugP_log((char*)"Last profiler item %lld cycles\r\n", GET_LAST_PROFILER_ITEM(transfer));
|
||||
FORCE_DUMP_PROFILER(transfer);
|
||||
@ -159,7 +161,7 @@ bool EcatTelegram::transfer() {
|
||||
|
||||
tick_counter_diff = diff(tick_counter_start, ecat_timer_.GetTickCounter());
|
||||
|
||||
if((sts != SystemP_SUCCESS) && ( tick_counter_diff < (counter_timeout_ticks_ - 1) )) {
|
||||
if((sts != SystemP_SUCCESS) && ( tick_counter_diff < (counter_timeout_ticks_ - semaphore_timeout_tolerance_) )) {
|
||||
//DebugP_log((char*)"rx_sem_ fake timeout detected !\r\n", );
|
||||
|
||||
continue;
|
||||
|
||||
@ -42,6 +42,10 @@ struct EcatTelegramStatus {
|
||||
return descriptions[static_cast<size_t>(result)];
|
||||
}
|
||||
|
||||
const EcatDescription& get_description(EcatTelegramResult res) {
|
||||
return descriptions[static_cast<size_t>(res)];
|
||||
}
|
||||
|
||||
private:
|
||||
static const char SuccessString[];
|
||||
static const char BusyString[];
|
||||
@ -76,7 +80,7 @@ public:
|
||||
eth_.getEthStackPtr()->Register(ETH_PROT_ECAT_LE, this);
|
||||
}
|
||||
|
||||
static uint32_t diff(uint32_t tick_counter_start, uint32_t tick_counter_current) {
|
||||
inline static uint32_t diff(uint32_t tick_counter_start, uint32_t tick_counter_current) {
|
||||
uint32_t tick_counter_diff;
|
||||
|
||||
if(tick_counter_current >= tick_counter_start) {
|
||||
@ -92,7 +96,8 @@ public:
|
||||
bool transfer(queue::Queue<datagram::IEcatDatagram>& next);
|
||||
|
||||
private:
|
||||
static constexpr uint32_t semaphore_timeout_ticks_ = 2;
|
||||
static constexpr uint32_t semaphore_timeout_ticks_ = 3;
|
||||
static constexpr uint32_t semaphore_timeout_tolerance_ = 1;
|
||||
|
||||
Eth& eth_;
|
||||
Timer& ecat_timer_;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user