BRT Community

General Category => Discussion - EVE => Topic started by: riforifo on June 16, 2020, 05:11:14 PM

Title: Eve Screen Designer Code Hangs - additional error handling required
Post by: riforifo on June 16, 2020, 05:11:14 PM
Hello,

Due to EMI issues, sometimes our application hangs at ESD_WaitSwap() function

We traced the problem to below function  EVE_Cmd_waitFlush.
while ((rp = EVE_Cmd_rp(phost)) != (wp = EVE_Cmd_wp(phost)))   needs a break addition.

Our application has a part that produces 320V, 1.2A for a couple of seconds. The coprocessor doesn't give any errors but the code hangs at the above while loop.

We implemented the following case, your comments on to why and how to get rid of / handle this error are welcomed.
Our board is NHD-3.5-320240FT-CSXN-CTP from New Haven (has an FT813 on it)

Code: [Select]
bool EVE_Cmd_waitFlush(EVE_HalContext *phost)
{
uint16_t rp, wp;
uint16_t flushCnt = 0;

eve_assert(!phost->CmdWaiting);
phost->CmdWaiting = true;
while ((rp = EVE_Cmd_rp(phost)) != (wp = EVE_Cmd_wp(phost)))
{
flushCnt++;
if(flushCnt >= 200){
flushCnt = 0;
eve_stop_flag = 1;
eve_printf_debug("[ERR-394]flushCnt >= 200\n");
break;
}

// eve_printf_debug("Waiting for CoCmd FIFO... rp: %i, wp: %i\n", (int)rp, (int)wp);
if (!handleWait(phost, rp))
return false;
}

/* Command buffer empty */
phost->CmdWaiting = false;
return true;
}