AnsweredAssumed Answered

STM32Cube FW_F7. Possible Bug introduced in V1.3.1 for SAI.

Question asked by paul-h on Jan 7, 2016
Latest reply on Jan 23, 2017 by Amel N
Possible bug Introduced in STM32Cube FW_F7 V1.3.1 for the Serial Audio Interface.


I am developing an application for the STM32F745VG using STM32CubeMX.
This uses a SAI operating in Transmit mode, with "Free" protocol, and 16 Slots active.


The code functioned correctly when generated with version 1.2.0 of STM32CubeF7.
The code didn't function correctly after I upgraded to version 1.3.1 of STM32CubeF7
(no SAI data was present and no DMA complete interrupts were being generated).


Comparison of the code generated for 1.2.0 and 1.3.1 shows a problem in the initialization of the SLOTR register within stm32f7xx_hal_sai.c : HAL_SAI_Init().


With 16 slots enabled, the value contained with hsai->SlotInit.SlotActive = 0xFFFF0000.


In the 1.2.0 version of the function, SLOTR is initialized as;
hsai->Instance->SLOTR|=  
    hsai->SlotInit.FirstBitOffset |  hsai->SlotInit.SlotSize
    | (hsai->SlotInit.SlotActive ) | ((hsai->SlotInit.SlotNumber - 1) <<  8);


In the 1.3.1 version of the function, SLOTR is initialized as;
hsai->Instance->SLOTR|=  
    hsai->SlotInit.FirstBitOffset |  hsai->SlotInit.SlotSize
    | (hsai->SlotInit.SlotActive <<16 ) | ((hsai->SlotInit.SlotNumber - 1) <<  8);


The latter results in zero being set in the SLOTEN bits.


I have patched the 1.3.1 function to remove the "<< 16" and this appears to fix the problem.

Outcomes