cancel
Showing results for 
Search instead for 
Did you mean: 

SAI I2S Mono Mode Not An Option

SHamm.18
Associate II

When using SAI for I2S, STM32CubeIDE does not give you the option to choose Mono mode. It's only option is Stereo Mode. However, STM32 SAI HAL supports both SAI_STEREOMODE as well as SAI_MONOMODE, so I think this should be an option.

14 REPLIES 14
Khouloud ZEMMELI
ST Employee

​Hello @SHamm.18​ ,

Could you please share your project ? I need to know which serie and version used.

Best Regards,

Khouloud

I2S as a standard bus is inherently and specifically 2 channel.

From this viewpoint, what would you expect from a mono setting to do? What is your target codec?

JW

I am using a Nucleo-L432KC with STM32CubeIDE 1.2.0. If I enable SAI1 in I2S mode, the only option is for Output Mode is Stereo, though the SAI HAL file supports Mono mode as well.

I am using I2S with a mono .wav file. If I use I2S in stereo mode, the .wav file is played twice as fast. By manually changing  hsai_BlockA1.Init.MonoStereoMode to mono mode in sai.c, the .wav file plays normally

Well, given CubeMX is just a clicking configurator to Cube, if there's a working setup in Cube, it probably should be settable in CubeMX.

Nevertheless, I was still curious, what does that mean from I2S point of view. but reading the I2S chapter in RM, it's probably just setting the SAI_xCR1.MONO bit, which in Tx duplicates slot 0 data into slot 1 in hardware, and in Rx discards slot 1 data (this ought to be borne in mind when using this feature for Rx).

JW

That MONO bit is a really nice option if one needs to work with mono streams, because then you don't have to waste CPU and RAM on repacking that unnecessary second channel. :)

Khouloud ZEMMELI
ST Employee

​Hello @SHamm.18​ , You're right, issue confirmed and it will be fixed.

Best Regards,

Khouloud

Alexmouse
Senior

Where do I find this bit on STM32F411?

STM32F411 does not have the SAI interface.

JW