2016-09-11 07:41 AM
I am experimenting with FreeRTOS and the HAL layer using an STM32F4 DISCO board.
I have two threads. One reads from the serial port and send the byte read, in a message to a second task.The second task, blocking on a message reads it and sends the byte out through the same serial port.What I get is that the second task always get HAL_BUSY. If my reading of the code is correct this means that the USART is locked. ( ?)On inspection of the code for HAL_UART_Receive I have noticed that __HAL_LOCK(huart) returns if it can't acquire the lock. However if it succeeds in acquiring the lock but later times out then a return is made whilst the lock is still held.Any subsequent call to either HAL_UART_Receive or HAL_UART_Transmit will fail with HAL_BUSY. I would like to suggest two potential fixes.1) TX & RX each has it's only lock. So I can send whilst receive is busy and vice-versa.2) The receive and transmit routines need restructuring to set a status and return it to the caller AFTER the lock has been released.or has all this been fixed already and I'm running something old ?Regards,Andrew2016-09-20 09:15 AM
Hi holt.andrew,
I suggest that you run and teston the UART example of the last version of STM32cube firmware package relevant to the device that you are using. Try the for example the for STM32F4xx device at this path: STM32Cube_FW_F4_V1.13.0\Projects\STM324xG_EVAL\Examples\UART And come back with the feedbacks then . -Hannibal-2016-09-23 10:59 PM