cancel
Showing results for 
Search instead for 
Did you mean: 

[Bug] STM32CubeMX, SAI->xSLOTR, SLOTEN not shifted

vincenthamp9
Associate III
Posted on January 20, 2016 at 13:50

After spending an entire morning figuring out why my SAI configuration isn't working anymore I guess I found a new bug concerning the configuration of the SLOTR register inside HAL_SAI_Init.

Prior to 1.2.0

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

1.2.0

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

The missing shift at the SlotActive parameter causes the SLOTEN value to be set to a wrong value. Maybe the shift was left out intentinally but the CubeMX tool still produces the same output for the old and the current library version. /edit This was like the 5th bug I reported within 6 months. You guys should put up some kind of reward system for reporting stuff and send me a coffee cup or something. :D
4 REPLIES 4
Nesrine M_O
Lead II
Posted on January 20, 2016 at 15:06

Hi Vinci,

Could you precise in which HAL library you have found the issue. So, we can verify it.

-Syrine-

vincenthamp9
Associate III
Posted on January 20, 2016 at 17:09

Ah damn it, I knew I'd forgotten something :p

It's concerning the L4-library.
Nesrine M_O
Lead II
Posted on January 20, 2016 at 18:00

Hi Vinci,

It is a known bug, and it is already fixed in the STM32CubeL4 version 1.2.0

-Syrine-

vincenthamp9
Associate III
Posted on January 21, 2016 at 12:48

You're right I'm sorry!

My bad, I got mixed up between two commits where the library got updated!