[BUG] STM32 HAL SAI abort and DMA stop logic is flawed
The logic in functions HAL_SAI_Abort() and HAL_SAI_DMAStop() is flawed because the sequence of actions is wrong. A proper sequence is:
- Disable the SAI and wait for it to be actually disabled.
- Stop the DMA.
- Flush the SAI FIFO.
In the current implementation the function SAI_Disable() is called after stopping the DMA. This causes a SAI underrun and a data glitch at the end of stream. The bug seems to be present for all series with SAI peripheral.
Also the two functions do almost the same and the code is also almost the same, which is an example of a bad and bloated design.
