This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

lwip SysTick interrupt

I have a question in connection with the lwIP concerto example.  The lwIP timer is served in a SysTick interrupt handler. But what will happen when I have an infinite loop for example in my data sending function? Will a next SysTick interrupt occur or SysTick interrupt is disabled somewhere in the lwipTimer() function?

Thanks in advance!

Best regards,
Tamas

  • The definition of lwIPTimer() is found in .\MWare\utils\lwiplib.c.  It simply triggers the Ethernet interrupt handler by forcing a software trigger of the Ethernet Interrupt in the NVIC.

  • Hi Brandon,

    Thank you for your last answer!
    My question is focusing on the interrupt events. Why doesn't happen a SysTick interrupt during the Ethernet interrupt?
    The SysTickInterruptHandler() call the lwIPTimer() which triggers the EthernetInterruptHandler(). And for example when I have an UDP packet sender in the EthernetInterruptHandler() which works in an infinite loop, the SysTickInterruptHandler() and so the lwipTimer() are not called anymore. But why not?

    I think that the UDP packet sender is called in the Ethernet interrupt not in the lwIPTimer() since it just trigger the Ethernet Interrupt. Obviously I am wrong, but I would like to know how it works.

  • The lwIPEthernetIntHandler() interrupt service routine for the Ethernet MAC (triggered by lwIPTimer()), runs the handling of the interrupt within the interrupt context IF this is configured to run without an OS (ie. NO_SYS precompiler flag is set).  This is found in lwiplib.c.

    To trace through this, I performed a series of greps to trace through the call path.  You should be able to perform the same and see the concertoif_interrupt() is either called within the lwIPEthernetIntHandler() if NO_SYS is defined, or in a process that is pending on a semaphore if a RTOS is used.  If the RTOS is used, the concertoif_interrupt() is likely called in a task that has interrupts reenabled.

  • Thank you Brandon for the help! My problem was that I needed a precise time and sometimes the SysTick wrapped while I was in the Ethernet Interrupt Handler. So at that time I always got a wrong system time. That is why I didn't understand the concept of the example program, but now I could eliminate this issue with the reading of the COUNT flag of the STCTRL register which set when the systick reaches the zero value. And if  I would like to create a timestamps for an IP packet I can calculate it.

    Best regards,
    Tamas