Showing results for 
Search instead for 
Did you mean: 

STM32U5 low power audio with I2S

Associate II


I'm looking into the STM32U5 for an audio application.

I have a microphone that works with I2S and I want to use it with the STM32U5 in a power efficient way.

I've seen that the SAI peripheral can with with I2S but it can't stay on during STOP modes.

On the other hand, I've seen that the MDF / ADF peripherals can work during STOP mode but it seems like they are much more complicated and operate on raw audio signals (correct me if I'm wrong?)

So two questions came out of this:

  1. Is it possible to use the SAI during STOP modes in some way?
  2. Can the MDF / ADF be used with a I2S signal?

Thank you

Principal III

an I2S audio signal is basically a continuous stream without any interruption. no gap, no break.

why you want audio data running, on sleep or power down of cpu?

you can try to stop i2s and start it again, same as on power up - maybe the i2s-mic accept it and its ok.

MDF / ADF i dont know.

If you feel a post has answered your question, please click "Accept as Solution".
Associate III

Based on the STM32U5 series reference manual, the SAI peripheral cannot stay on during STOP modes. This is because the SAI peripheral is clocked from the APB clock, which is gated (turned off) during STOP mode to save power.

As for the MDF/ADF peripherals, they are indeed more complex as they are designed to process raw audio signals. However, they do not directly support I2S protocol. The MDF/ADF peripherals are designed to interface with PDM microphones and to perform audio processing such as filtering and decimation. They can operate in STOP mode, which makes them suitable for low-power applications.

While it's not directly possible to use the SAI peripheral during STOP modes or to use the MDF/ADF peripherals with an I2S signal, you could consider a workaround. For example, you could use the SAI peripheral to interface with the I2S microphone during RUN mode, and then switch to a low-power mode when the MCU is idle. You would need to ensure that the SAI peripheral is properly configured to resume operation when the MCU wakes up from STOP mode.

Here is a code snippet showing how to configure the SAI peripheral:

 SAI_HandleTypeDef hsai_BlockA1; hsai_BlockA1.Instance = SAI1_Block_A; hsai_BlockA1.Init.AudioMode = SAI_MODEMASTER_RX; hsai_BlockA1.Init.Synchro = SAI_ASYNCHRONOUS; hsai_BlockA1.Init.OutputDrive = SAI_OUTPUTDRIVE_DISABLE; hsai_BlockA1.Init.NoDivider = SAI_MASTERDIVIDER_DISABLE; hsai_BlockA1.Init.FIFOThreshold = SAI_FIFOTHRESHOLD_EMPTY; hsai_BlockA1.Init.AudioFrequency = SAI_AUDIO_FREQUENCY_8K; hsai_BlockA1.Init.MonoStereoMode = SAI_MONOMODE; hsai_BlockA1.Init.CompandingMode = SAI_NOCOMPANDING; hsai_BlockA1.Init.TriState = SAI_OUTPUT_NOTRELEASED; hsai_BlockA1.FrameInit.FrameLength = 64; hsai_BlockA1.FrameInit.ActiveFrameLength = 32; hsai_BlockA1.FrameInit.FSDefinition = SAI_FS_CHANNEL_IDENTIFICATION; hsai_BlockA1.FrameInit.FSPolarity = SAI_FS_ACTIVE_LOW; hsai_BlockA1.FrameInit.FSOffset = SAI_FS_BEFOREFIRSTBIT; hsai_BlockA1.SlotInit.FirstBitOffset = 0; hsai_BlockA1.SlotInit.SlotSize = SAI_SLOTSIZE_DATASIZE; hsai_BlockA1.SlotInit.SlotNumber = 2; hsai_BlockA1.SlotInit.SlotActive = SAI_SLOTACTIVE_0 | SAI_SLOTACTIVE_1; if (HAL_SAI_Init(&hsai_BlockA1) != HAL_OK) {   Error_Handler(); } 

Remember to check the return value of HAL_SAI_Init to ensure that the SAI peripheral is properly initialized.

To save power I wanted that the SAI will work with the LPDMA while the MCU is in STOP mode, and wakeup the MCU only after a batch of many samples is ready.

I understand now that this is not possible