STM32CubeF4 icon indicating copy to clipboard operation
STM32CubeF4 copied to clipboard

[ETH] TX/RX Semaphores

Open DedkovArtem opened this issue 3 years ago • 1 comments

Describe the set-up

  • Cube version 6.5.0
  • STM32CubeF4 version 1.27.0
  • custom board STM32F429IIT6
  • IAR Embedded Workbench for Arm 8.40.2

Describe the bug The first packet sent is released without waiting for the end of sending.

How To Reproduce In the ethernetif.c file in the procedure static err_t low_level_output(struct netif *netif, struct pbuf *p) cycle while(osSemaphoreAcquire(TxPktSemaphore, TIME_WAITING_FOR_INPUT)!=osOK); passes instantly, because semaphore TxPktSemaphore created with initialization value = 1, and there is no interrupt waiting on sending the first packet

Additional context It seems to me more correct when creating a semaphore in a procedure static void low_level_init(struct netif *netif) create a semaphore with initialization value = 0 TxPktSemaphore = osSemaphoreNew(1, 0, NULL);

The RxPktSemaphore semaphore has a similar problem. The semaphore must be released by the received frame, not by the procedure that creates the semaphore. Respectively, it is more correct to create a semaphore for receiving, with initialization value = 0 RxPktSemaphore = osSemaphoreNew(1, 0, NULL);

DedkovArtem avatar Apr 11 '22 16:04 DedkovArtem

ST Internal Reference: 128000

ASELSTM avatar May 11 '22 16:05 ASELSTM

Hi @DedkovArtem,

There is actually no use of the osSemaphoreAcquire() within the function err_t low_level_output() as part of the ethernetif.c, the below instruction is rather used:

https://github.com/STMicroelectronics/STM32CubeF4/blob/52757b5e33259a088509a777a9e3a5b971194c7d/Projects/STM32F429ZI-Nucleo/Applications/LwIP/LwIP_HTTP_Server_Netconn_RTOS/Src/ethernetif.c#L294

Moreover, TxPktSemaphore and RxPktSemaphore are by default set to 0, we have double checked and low_level_output() and low_level_input() are not passing instantly.

I guess you are not using the newest version of the STM32CubeF4. Would you please try to the latest one and check if you are still having the same issue. Meanwhile, please allow me to close this thread. You may reopen it at anytime if you have any details to share with us in order to help you to solve the issue. Thank you for your comprehension.

With regards,

ASELSTM avatar Apr 07 '23 14:04 ASELSTM