AnsweredAssumed Answered

STM32429I-EVAL - Re-purpose stdperiph SAI_Audio example to use microphone.

Question asked by jab on Feb 10, 2014
Latest reply on Feb 12, 2014 by jab
Hi,

So I've recently started developing on the 'STM32429I-EVAL', I've managed to compile and run the SAI_Audio example which outputs an audio sample to the headphones. I'm now trying to stream one of the two built-in microphones to the headphone jack, with little success.

My understanding of SAI is that it connects all the audio related peripherals to the on-board codec. After reading the user manual and datasheet, I can confirm the twin microphones are connected to the codec. (I can either connect them to the codec or I2S via jumpers)

However, when I pass in the SAI memory address into the play function instead of the example audio sample, I hear white noise. 

'EVAL_AUDIO_Init(OUTPUT_DEVICE_HEADPHONE, uwVolume, SAI_AudioFreq_44k)'

'EVAL_AUDIO_Play((uint16_t*)CODEC_SAI_ADDRESS, 32);'
(CODEC_SAI_ADDRESS is set to, (uint32_t)(&SAI1_Block_B->DR) )

In the stm324x91_eval_audio_codec.h file I've changed the active SAI slot, set the PLL clock to SAI and set the Audio Transfer mode to AUDIO_MAL_MODE_CIRCULAR. - Which I believe is used for setting up the DMA.

I have noticed that when debugging, the DMA transfer complete interrupt is only called once. Even in circular mode. Calling EVAL_AUDIO_Play within the interrupt doesn't appear to re-trigger it.

void EVAL_AUDIO_TransferComplete_CallBack(uint32_t pBuffer, uint32_t Size)
{
  /* Calculate the remaining audio data in the file and the new size 
     for the DMA transfer. If the Audio files size is less than the DMA max 
     data transfer size, so there is no calculation to be done, just restart 
     from the beginning of the file ... */
  /* Check if the end of file has been reached */
     
     STM_EVAL_LEDToggle(LED4);
     
     EVAL_AUDIO_Play((uint16_t*)CODEC_SAI_ADDRESS, 32);
}

Have I missed any important steps? Any tips on working with SAI peripherals would be greatly appreciated. Thank you.


Outcomes