2024-02-06 05:46 AM
Say that HAL_UART_Transmit function is concurrently called by two tasks.
So far, I know such a function is blocking, but I am not 100% sure that because of that it shall not be locked before usage if a concurrent task is going to call it.
Solved! Go to Solution.
2024-02-06 05:50 AM - edited 2024-02-06 05:50 AM
Yes, it needs an exclusive access mechanism.
At best, the second call will fail and return HAL_BUSY. At worst, it will mess up the software state machine as __HAL_LOCK is not thread-safe.
2024-02-06 05:50 AM - edited 2024-02-06 05:50 AM
Yes, it needs an exclusive access mechanism.
At best, the second call will fail and return HAL_BUSY. At worst, it will mess up the software state machine as __HAL_LOCK is not thread-safe.
2024-02-06 08:26 AM
Thanks. I will lock it with a mutexat OS level then.