Skip to main content
Visitor II
February 8, 2024
Solved

Issue with LWIP-TCPIP and other threads on NUCLEO-F429ZI

  • February 8, 2024
  • 3 replies
  • 2870 views

I have attached my project. I am running it on a NUCLEO-F429ZI Board. I am using FreeRtos and LWip

I have 2 threads/Tasks. 

The first Task is to initialize LWIP and to read some ADC from DMA

The lcd Task is to display text on a 2" LCD through SPI

I have also added a server TCP/IP initialization through the first task

Everything seems to work until I start communicating with a TCP Client.

 

After a few communication from the client to the server, all my tasks hangs. (See Logic Plot)

And when I pause the debugger, it seems to be stuck in a semaphoreTake as shown on the screenshot of CUBEIde

 

Anyone has an idea of what is going on ? Thank you

    This topic has been closed for replies.
    Best answer by xianrecords

    I finally found the issue and the ethif thread that is generated in the ethernetif.c was initialized with a stack too low. So I increased it and that solved the issue

    3 replies

    Visitor II
    February 9, 2024

    So I added a vApplicationStackOverflowHook with option1 and that got triggered.

    which means I have a memory setting issue somewhere.

    I put a breakpoint in the vApplicationStackOverflowHook routine but I can't figure out how to trace back to know where the issue is coming from.

    Can someone help ?

    Thanks

    xianrecordsAuthorAnswer
    Visitor II
    February 11, 2024

    I finally found the issue and the ethif thread that is generated in the ethernetif.c was initialized with a stack too low. So I increased it and that solved the issue

    Visitor II
    March 4, 2024

    Hi I am interested in your project, but am a newbie in the STM32CubeIDE platform. I am able to import and build your project now but don't what I can see from the project. Does the project use DHCP or Static IP? How to check and change it? In addition, where does printf go if I add some prinf? Thanks in advance!!!

     

     

    Visitor II
    March 4, 2024

    You can set it up in DHCP or Static in the graphical user interface under stm32cubeide. Click on the IOC file and you can go to LWIP and set it up there. Mine was setup in DHCP.

    My printf goes to the serial console. It is setup in the main.c file.

    Visitor II
    March 4, 2024

    Really appreciate your response! 1. I can see your printf going to UART3(PD8) now though I still don't understand how the UART3 mapped to printf().  2. I changed it to static IP, but ping still failed with "ping: sendto: Host is down". I am using the same NucleoF-429ZI. Do I need to make some change in GPIO configuration? In addition, I do see the error at the serial port : "Assertion "netif already added" failed at line 395 in ../Middlewares/Third_Party/LwIP/src/core/netif.c" . 

    Here is the auto generated code:

    void MX_LWIP_Init(void)
    {
    /* IP addresses initialization */
    IP_ADDRESS[0] = 10;
    IP_ADDRESS[1] = 0;
    IP_ADDRESS[2] = 0;
    IP_ADDRESS[3] = 10;
    NETMASK_ADDRESS[0] = 255;
    NETMASK_ADDRESS[1] = 255;
    NETMASK_ADDRESS[2] = 0;
    NETMASK_ADDRESS[3] = 0;
    GATEWAY_ADDRESS[0] = 10;
    GATEWAY_ADDRESS[1] = 0;
    GATEWAY_ADDRESS[2] = 0;
    GATEWAY_ADDRESS[3] = 1;