Weird behavior with FreeRTOS and LwIP

I’m setting up the very basics on the Discovery board STM32F769 to run LittlevGL with FreeRTOS with network functionality and an NFC reader from ST (X-NUCLEO-NFC05A1). There’s not much that have been done in the UI yet, because I want to make sure everything runs ok. So I also added LwIP in this project from CubeMX. The strange thing is that when I ping the board, i get 1024ms response time. I’m not sure if LittlevGL blocks it from running the TCP task, but when I disable the LittlevGL completely, the board response is ~200uS. The TCP task has highest priority. Also there’s another task for the NFC reader which has low priority from all the existing tasks. The project can be found here Hope somebody can shed some light.

Interesting problem. Some ideas:

  • It might be worthwhile adding a printf statement in the TCP task somewhere to make sure that it keeps running when LittlevGL is running.
  • Are you doing anything with DMA/something similar that might be blocking the Ethernet interrupts?
  • I once had an issue on STM32F7 where it would only receive every other packet. I thought it was an issue with task scheduling (as ping did work sometimes, but at a slower rate) but it turned out to be a bug which would cause the driver to randomly drop packets. You may be experiencing something similar.

I toggled GPIOs, so that I can get the task activity on the scope.
The lv_task comes every 5ms and the nfc task every 20ms, but the TCP task runs every second.
I’m not thinking about DMA because the screen has no annimations, just shows a home screen.

Another thing that I find hard to understand is that when I just initialise the lvgl, but inside the task loop I never call the lv task handler, the TCP is dead. And last that I’ve just noticed, is that for each running terminal sending ping requests, the time of reply was each time cut into half. I think that’s not related to LittlevGL, rather my lack of experience in RTOS and I’ve missconfigured it.

I’ll start digging more to find out more weird for me things or at least understand my mistakes.
I dived into deep waters of RTOS and LwIP without previous experience. :frowning:

Are you sure that the priorities are set up correctly? Usually a smaller number means higher priority (e.g. 2 is higher priority than 10). If the lvgl task is higher priority, it could block the CPU and prevent the TCP task from running at all.