cancel
Showing results for 
Search instead for 
Did you mean: 

CubeMX 4.14.0 STM32 FW_F7_V1.3.1 SAI I2S Initialization problem

thomfischer
Senior
Posted on May 20, 2016 at 08:49

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

1 REPLY 1
slimen
Senior
Posted on May 20, 2016 at 17:10

Hi thomas.004,

The parameters of SAI Interface are changed regarding the mode and configuration used. 

You can refer to the

http://www.st.com/content/ccc/resource/technical/document/reference_manual/c5/cf/ef/52/c0/f1/4b/fa/DM00124865.pdf/files/DM00124865.pdf/jcr:content/translations/en.DM00124865.pdf

, 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