AnsweredAssumed Answered

F4 I2S CubeMX problem in HAL_I2S_DMAStop

Question asked by shamaev.eugene on Jan 4, 2016
Latest reply on Jan 6, 2016 by Amel N
I would like to point the attention of ST to the problem they have in the CubeMX generated code.
In HAL_StatusTypeDef HAL_I2S_DMAStop(I2S_HandleTypeDef *hi2s) function the procedure described in 26.6.4 I2S master mode of RM0390 is NOT followed!

It is clearly stated that "To switch off the I2S, by clearing I2SE, it is mandatory to wait for TXE = 1 and BSY = 0."

It is not done so and in 24 and 32 bit mode the next start usually gets shifted by 16 bit because of incompleted sequence during stop!

Following should be added before the __HAL_I2S_DISABLE(hi2s):

while(__HAL_I2S_GET_FLAG(hi2s, I2S_FLAG_TXE) != 1 || __HAL_I2S_GET_FLAG(hi2s, I2S_FLAG_BSY) != 0);

Also the timeout should be added and some protection of course in production version.

This bug has costed me about a day to track down.

Outcomes