AnsweredAssumed Answered

Bug in Audio Codec Driver

Question asked by Mr Bluexav on Oct 20, 2012
Latest reply on Nov 2, 2012 by K A
Hi !
I'm talking about stm32f4_discovery_audio_codec.c v1.1.0 for CS43L22 .
It is used in the record & playback audio demo and you can find it in the "utilities" folder.
I've struggled a lot to make the circular buffer mode DMA work !
There seems to be a confusion in the audio data size counting method : sometimes bytes (8 bits) and other times half words (16 bits).
I would suggest to use Size variable to always count in half word.
It will affect :

uint32_t EVAL_AUDIO_Play(uint16_t* pBuffer, uint32_t Size)
{
  /* Set the total number of data to be played (count in half-word) */
  AudioTotalSize = Size;


  /* Call the audio Codec Play function */
  Codec_Play();
  
  /* Update the Media layer and enable it for play */  
  Audio_MAL_Play((uint32_t)pBuffer, (uint32_t)(DMA_MAX(Size)));
  
  /* Update the remaining number of data to be played */
  AudioRemSize = Size - DMA_MAX(AudioTotalSize);
  
  /* Update the current audio pointer position */
  CurrentPos = pBuffer + DMA_MAX(AudioTotalSize);
  
  return 0;
}

Outcomes