UDP communication does not work if the cable is plugged in after initialization
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-04-02 12:33 AM
Hi,
I have an UDP Server on a STM32H743ZI. It works very good only if the ethernet cable is already connected when I power on the board.
However, if I connect the cable after powering on the board, UDP Server does not receive any message.
FreeRTOS is used on my project and I have added LWIP_NETIF_LINK_CALLBACK 1 to lwipopts.h but I never go in callback function even if I connect/disconnect the ehernet cable.
Where's the problem?
what should I add to detect the cable connection?
Thanks a lot!
Kind regards.
Solved! Go to Solution.
- Labels:
-
Ethernet
-
FreeRTOS
-
STM32Cube MCU Packages
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-05-06 2:40 AM
I solved my problem by changing the priority in the MX_LWIP_Init function
I set
/* USER CODE BEGIN H7_OS_THREAD_NEW_CMSIS_RTOS_V2 */
memset(&attributes, 0x0, sizeof(osThreadAttr_t));
attributes.name = "EthLink";
attributes.stack_size = INTERFACE_THREAD_STACK_SIZE;
attributes.priority = osPriorityNormal;
osThreadNew(ethernet_link_thread, &gnetif, &attributes);
/* USER CODE END H7_OS_THREAD_NEW_CMSIS_RTOS_V2 */
rather than osPriorityBelowNormal
and so The ethernet_link_thread function is then called during cable connections/disconnections
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-04-29 8:15 AM
Hello @Bajocasse,
Have you called the netif_set_link_callback() function as demonstrated in the following snippet?
#if LWIP_NETIF_LINK_CALLBACK netif_set_link_callback(&netif, ethernet_link_status_updated); #endif
By calling this function, your application will be able to dynamically respond to changes in the network link status, such as when the Ethernet cable is plugged in or unplugged.
With Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-05-06 2:40 AM
I solved my problem by changing the priority in the MX_LWIP_Init function
I set
/* USER CODE BEGIN H7_OS_THREAD_NEW_CMSIS_RTOS_V2 */
memset(&attributes, 0x0, sizeof(osThreadAttr_t));
attributes.name = "EthLink";
attributes.stack_size = INTERFACE_THREAD_STACK_SIZE;
attributes.priority = osPriorityNormal;
osThreadNew(ethernet_link_thread, &gnetif, &attributes);
/* USER CODE END H7_OS_THREAD_NEW_CMSIS_RTOS_V2 */
rather than osPriorityBelowNormal
and so The ethernet_link_thread function is then called during cable connections/disconnections
