cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeMX incorrctly sets "Slot Active Final Value" when using SAI as MONO mode

peterleif
Associate

Hello.

I found a bug in STM32CubeMX software which is briefly described above in the title.

  1. In the "Pinout & Configuration" tab, select SAI and enable it
  2. Set "Number of Slots" to 2
  3. Set basic parameters (other than "Output Mode") correctly
  4. Set "Output Mode" to "Mono"

After setting "Output Mode", auto-calculated "Slot Active Final Value" is set to "0x00030000".

This value is not valid and cannot be changed using the CubeMX software.

So, you should modify the "Slot Active Final Value" by opening .ioc file in text editor or modify SlotInit.SlotActive value in the generated C source code.

I found this bug affects many (presumably all) devices such as F446 and F767, and can be reproduced in many CubeMX versions including 6.0.0.0693W000003Pxk0QAC.png

3 REPLIES 3

Hi @peterleif​ 

Thanks for the feedback, could you please explain why this value ("Slot Active Final Value" ="0x00030000") is not valid .

Best regards,

Nesrine

peterleif
Associate

Hi @Nesrine.JLASSI​ , thank you for your reply.

"Slot Active Final Value" is output to hsai.SlotInit.SlotActive, and it is used to set the SLOTEN[15:0] bits in the Slot register (SAI_ASLOTR / SAI_BSLOTR) in HAL_SAI_Init function.

stm32f7xx_hal_sai.c

hsai->Instance->SLOTR|=  hsai->SlotInit.FirstBitOffset |  hsai->SlotInit.SlotSize
                          | (hsai->SlotInit.SlotActive << 16) | ((hsai->SlotInit.SlotNumber - 1) <<  8);

In the above code, lower 16 bits of hsai->SlotInit.SlotActive are copied to the value of SAI_xSLOTR[31:16] bits (which corresponds to SLOTEN[15:0]).

In the case I described in the post, the number of slots is 2 and both the slots must be activated ("Use Slot 0 and 1 only"), so SLOTEN[15:0] should be 0x0003.

However, CubeMX is setting the value to 0x00030000 and no slot is activated.

Best regards,

peterleif

Hello @peterleif​ 

Thanks for your post. I have raised your feedback internally to be reviewed and treated accordingly to the priority. We will give you an update as soon as possible.

Thanks for your contribution.

Best regards,

Nesrine