Skip to main content
SHamm.18
Associate
March 13, 2020
Question

SAI I2S Mono Mode Not An Option

  • March 13, 2020
  • 14 replies
  • 4098 views

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.

This topic has been closed for replies.

14 replies

Khouloud ZEMMELI
ST Employee
March 19, 2020

​Hello @SHamm.18​ ,

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

Best Regards,

Khouloud

SHamm.18
SHamm.18Author
Associate
March 20, 2020

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.

waclawek.jan
Super User
March 19, 2020

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

SHamm.18
SHamm.18Author
Associate
March 20, 2020

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

victagayun
Senior III
December 15, 2021

Hello I am using STM32F407 discovery kit, CubeIDE 1.8.0 and FW_F4 V1.26.2.

I plan to connect the mono mic via I2S as well and should be connected in mono mode.

Where do you get to change hsai_BlockA1.Init.MonoStereoMode to mono mode?

I cannot seem to find this code.

I am looking in:

MX_I2S2_Init(),

stm32f4xx_hal_i2s.h,

stm32f4xx_hal_i2s_ex.h, and

stm32f4xx_hal_i2s.c.

Where should I look for to modify?

waclawek.jan
Super User
March 20, 2020

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

Piranha
Principal III
March 21, 2020

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
March 23, 2020

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

Best Regards,

Khouloud

Alexmouse
Associate III
November 5, 2021

Where do I find this bit on STM32F411?

waclawek.jan
Super User
November 5, 2021

STM32F411 does not have the SAI interface.

JW