The DMA length parameter defect of the HAL_I2S_Receive_DMA().
- February 11, 2020
- 1 reply
- 2091 views
Hi.
The HAL_I2S_Receive_DMA() has defect around its size parameter.
The UM1905 explain the size parameter as following :
when a 24-bit data frame or a 32-bit data
frame is selected the Size parameter means the number of
16-bit data length
That mean, regardless of the data size, the buffer size to the DMA have to be measured by the count of the int16_t. On the other word, the length by int32_t have to be multiplied by 2.
I saw several example on the internet which follows this specification.
But, this description is incorrect. The HAL_I2S_Receive_DMA() interprets its size parameter as number of the int32_t type in the buffer, when the data type of I2S is 32 or 24bit.
This behavior can be confirmed by reading stm32f7xx_hal_i2s.c. As you can see the attached screenshot, this APi is compensating size parameter when the data is 24 or 32bit. So, the behavior and documentation doesn't match.
I have two request.
- Which documentation or source code is right?
- Please fix the wrong one.
As I checked, this problem was observed on Nucleo F722, F446 and G431.
The firmware of the F722 is the STM32Cube FW_F7 V1.15.0
