cancel
Showing results for 
Search instead for 
Did you mean: 

[BUG] STM32 HAL drivers are not interrupt-safe

Piranha
Chief II

In function HAL_DMA_IRQHandler() the lines 872, 914, 949 modify the hdma->State variable after __HAL_UNLOCK(hdma) has been called.

STM32 HAL is full of bugs, especially race condition related ones, but this one seems to be more urgent, because multiple instances of the DMA are used together with many other peripherals in different combinations. I'm reporting this for F7, but drivers for other series also should be checked for the same.

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Piranha​ ,

I confirm this issue and insured that the team is currently working on fixing all impated drivers. So that state change will be before unlock

/* Change the DMA state */
 hdma->State = HAL_DMA_STATE_READY;
/* Process Unlocked */
 __HAL_UNLOCK(hdma);
 

Thank you for your feedback and for helping us improve the ST products !

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

View solution in original post

2 REPLIES 2
Imen.D
ST Employee

Hello @Piranha​ ,

Thanks for your post. I have raised your request to the involved team to take a closer look at this issue and treated it accordingly to the priority.

 I will give you an update as soon as possible.

Thanks for your contribution.

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

Hi @Piranha​ ,

I confirm this issue and insured that the team is currently working on fixing all impated drivers. So that state change will be before unlock

/* Change the DMA state */
 hdma->State = HAL_DMA_STATE_READY;
/* Process Unlocked */
 __HAL_UNLOCK(hdma);
 

Thank you for your feedback and for helping us improve the ST products !

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen