Assistance Needed with FreeRTOS Application on STM32F407VET6 + LWIP Task Management
Dear Team,
I am using an STM32F407VET6 controller with STM32CubeIDE and FreeRTOS. I’m encountering a problem with thread management in my application. Please find below an overview of my setup:
- Mutex: Used for UART communication.
- osTimer: Configured to generate a 1-millisecond periodic interrupt, primarily used to check received frames from the serial/UART. Once a complete frame is received, the data is placed into uartQue.
- Message Queues:
- One for UART communication (uartQue) with a message count of 2.
- One for TCP communication (tcp_messageQue) with a message count of 16.
- Tasks:
- http_task: Used for configuring UART settings.
- tcp_task: Retrieves data from the TCP/IP socket and places it into tcp_messageQue.
- serial_task: Gets data from tcp_messageQue and sends it over UART. It also retrieves data from uartQue and sends it over the TCP/IP socket.
All tasks are currently running at the same priority (osPriorityNormal). the stack size for all task is 4096
The http_task works fine when accessing the webpage. However, when I try to connect to my device via TCP( accessing the tcp_task), the issue arises and not able to access tcp_task, the issue arises. Attempting to establish a TCP connection consistently results in a "TCP connection failed" error. After repeated attempts, the device stops responding altogether.
I have been monitoring the ping response on the terminal window during this scenario, and the device fails to respond to pings when the issue occurs.
If I reset the device and connect a TCP client before opening the webpage, the tcp_task works fine. However, if I then try to access the webpage, the TCP client communication fails, and after several failures, the device stops responding altogether.
Only one task (http_task or tcp_task) can run properly at a time, but I need both tasks to function simultaneously.
If anyone has any insights or suggestions on how to resolve this issue, I would greatly appreciate your help. Your feedback would be invaluable to me.
Thank you.
