cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F769-DISC1 SAI Example, Speaker not working

Gabriel Duarte
Associate
Posted on May 22, 2018 at 20:01

Hi, im triyng to use the SAI Audio example with speakers but it only works with headphones.

I've tired every output source: OUTPUT_DEVICE_HEADPHONE, OUTPUT_DEVICE_SPEAKER, and OUTPUT_DEVICE_BOTH.

Do i have to change anything else to make it work?

Ty in advance.

2 REPLIES 2
Imen.D
ST Employee
Posted on May 23, 2018 at 10:21

Hello

gabrielgd

,

Can you please confirm that this issue is reproduced usingthe latest version of STM32CubeF7 V1.0 ?

With Regards,

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Posted on May 23, 2018 at 11:12

Hi

,

The SAI Audio example is developed to work only on HEADPHONE.

In order to support the Speaker as well, It's not enough to change the output speaker, but you should modify the example and update the SAI configuration.

Actually, only two SAI slots are enabled and are dedicated for the headphone path.

SaiHandle.FrameInit.FrameLength = 32; SaiHandle.FrameInit.ActiveFrameLength = 16; SaiHandle.FrameInit.FSDefinition = SAI_FS_CHANNEL_IDENTIFICATION; SaiHandle.FrameInit.FSPolarity = SAI_FS_ACTIVE_LOW; SaiHandle.FrameInit.FSOffset = SAI_FS_BEFOREFIRSTBIT; SaiHandle.SlotInit.FirstBitOffset = 0; SaiHandle.SlotInit.SlotSize = SAI_SLOTSIZE_DATASIZE; SaiHandle.SlotInit.SlotNumber = 2; SaiHandle.SlotInit.SlotActive = (SAI_SLOTACTIVE_0 | SAI_SLOTACTIVE_1); (…) if(0 != audio_drv->Init(AUDIO_I2C_ADDRESS, OUTPUT_DEVICE_HEADPHONE, 20, AUDIO_FREQUENCY_22K))�?�?�?�?�?�?�?�?�?�?�?�?�?

To activate the speaker path, the above code should be modified as below:

 SaiHandle.FrameInit.FrameLength = 64; SaiHandle.FrameInit.ActiveFrameLength = 32; SaiHandle.FrameInit.FSDefinition = SAI_FS_CHANNEL_IDENTIFICATION; SaiHandle.FrameInit.FSPolarity = SAI_FS_ACTIVE_LOW; SaiHandle.FrameInit.FSOffset = SAI_FS_BEFOREFIRSTBIT; SaiHandle.SlotInit.FirstBitOffset = 0; SaiHandle.SlotInit.SlotSize = SAI_SLOTSIZE_DATASIZE; SaiHandle.SlotInit.SlotNumber = 4; SaiHandle.SlotInit.SlotActive = (SAI_SLOTACTIVE_0 | SAI_SLOTACTIVE_1 | SAI_SLOTACTIVE_2 | SAI_SLOTACTIVE_3); (…) if(0 != audio_drv->Init(AUDIO_I2C_ADDRESS, OUTPUT_DEVICE_SPEAKER, 20, AUDIO_FREQUENCY_22K)) �?�?�?�?�?�?�?�?�?�?�?�?�?�?

Hope this helps you.

With Regards,

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen