2016-05-19 11:49 PM
When selecting I2S protocol for SAI Interface,
CubeMX does not allow to modify all parameters of SAI Interface,
in my case I need to change the clock Strobing for receive in SAI B to
SAI_CLOCKSTROBING_RISINGEDGE,
the generated code from cubeMX and the firmware functions set the clock strobing
fixed to
SAI_CLOCKSTROBING_
FALING
EDGE
in function SAI_InitI2S() for both transmit and receive block.
I changed MX_SAI_Init()
to
...
HAL_SAI_InitProtocol(&hsai_BlockB2, SAI_I2S_STANDARD, SAI_PROTOCOL_DATASIZE_16BIT, 2);
hsai_BlockB2.
Init
.
ClockStrobing
=
SAI_CLOCKSTROBING_RISINGEDGE
;
HAL_SAI_Init(&hsai_BlockB2);
...
and
removed HAL_SAI_Init()
in function
HAL_SAI_InitProtocol
()
It would be better to just
make a predefined setting in CubeMX for I2S protocol and then show the SAI Configuration page with the FREE protocol settings.
This would allow the user to modify the settings if needed.
best regards
2016-05-20 08:10 AM
Hi thomas.004,
The parameters of SAI Interface are changed regarding the mode and configuration used. You can refer to the , section (33 Serial audio interface (SAI)) for more details, as documented :''The bit clock strobing edge on SCK can be configured by bit CKSTR in the SAI_xCR1 register.When the audio block is configured as Master, the clock generator provides the communication clock and the master clock for external decoders.When the audio block is defined as slave, the clock generator is OFF. ''Regards