2018-05-22 11:01 AM
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.
2018-05-23 01:21 AM
Hello
gabrielgd
,Can you please confirm that this issue is reproduced usingthe latest version of STM32CubeF7 V1.0 ?
With Regards,
Imen
2018-05-23 04:12 AM
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