Serial-Ethernet bridge (Using lwIP on str91x)

vinay1 wrote on Friday, July 18, 2008:

I have been struggling with the implementation of a "Serial-Ethernet bridge" for quite few weeks. If anyone has an idea kindly reply on the following query (Thanks in Advance):

On sending continous data (@115200) on the serial port (UART async rs232) for around 7-8 hrs, the serial interrupt stops triggering (I have verified this by putting a break point in the UART IRQ handler routine, when the problem occured. I am using IAR embedded workbench).

Following is the implementation:

- The UART IRQ handler fills the data into a queue (using xQueueSendFromISR).
- A free running task keep waiting on the queue & whenever there is any data in the queue, it  forwards it to the TCP (tcp_write & tcp_output).
- This bridge is just a part of the system, in all there are around 10 tasks running in the system.

Kindly reply if anyone has an idea.

chaalar wrote on Friday, July 18, 2008:

Maybe you’re not freeing some pbufs, or some other task is disabling serial interrupts after some time. IMHO,
these kind of problems are hard to track. If I were you, I would:

1st : Remove all other tasks and just forward data to the ethernet port. This will help localizing the problem.
2nd : Check if ethernet is working after serial interrupts stop working.


vinay1 wrote on Friday, July 18, 2008:

Hi Caglar,

you are write. I have already made a setup running with only the bridge task…I may have results after another 7-8 hrs…btw ethernet was working when the serial interrupt stopped…I would share the results tomorrow morning (my morning INDIA :)…Thanks for the reply…


damienhoyen wrote on Wednesday, July 23, 2008:

Hi Vinay,

I had a problem like this : when i was enabling a RTC interrupt on my STR912, my software was reseting after 3-4-6 hours of running… I don’t know if you are in this case or not…

Maybe the following thread could help you:

OtherWise: the usual problem of stack overflow could be interesting to check, if not already done…

I write the following code to look the memory usage of each task, the function is the following (this function locate in the stack the last: 0xa5a5a5a5)(To use it, you need to cut - copy the structure definition: tskTCB to a *.h file to ‘export’ the type)(UTILS_TRACE_STACK is used as a printf function (vsprintf) to send debug info to an hyperterminal)

Another thing you can check is the stack available in IRQ mode.



* \fn      u8 UTILS_PrintStackUsage (xTaskHandle TaskHandle)
* \brief   This function will print (trough RS232) information about stack usage on a dedicated task
* \return        Always 0
u8 UTILS_PrintStackUsage (xTaskHandle TaskHandle)
    tskTCB *TaskStack = (tskTCB*)TaskHandle;
    u32    *CurrentCell;
    if (TaskHandle != NULL)
        //print direct available info
        UTILS_TRACE_STACK2("---- %s ----",TaskStack->pcTaskName);
        UTILS_TRACE_STACK3("Stack Start - End : 0x%.8x - 0x%.8x",TaskStack->pxStack,TaskStack->pxTopOfStack);
        // init the current memory cell on the beginning of the task
        CurrentCell = TaskStack->pxStack;
        while ( (*CurrentCell == 0xa5a5a5a5)&& (CurrentCell <= TaskStack->pxTopOfStack))
        UTILS_TRACE_STACK3("Stack size: %i, Lowest free space ava. %i",(TaskStack->pxTopOfStack - TaskStack->pxStack),(CurrentCell - TaskStack->pxStack));

    return (0);