the gap between DAC DMA stop and start
Hi all
I know the question title sounds weird but here is the actual thing I would like to know about.
So, I have an array of 1000 bytes which I apparently use in the HAL_DAC_START_DMA function, and then start the DAC DMA trigger timer. This works super fine and on the half-complete callback of DAC DMA I read the next 1000 bytes from a file inside the SD-Card and on complete DAC DMA callback, I simply stop the trigger timer, stop the DAC DMA and reload the new 1000 bytes into HAL_DAC_START_DMA function and start the timer again.
// audio out function main bits
memset((void *) DacAudioBuffer.Audio16BitBuffer, 0, sizeof(DacAudioBuffer.Audio16BitBuffer));
memcpy((void *) DacAudioBuffer.Audio16BitBuffer, (void *) DacAudioBuffer.Temp16AudioBuffer, sizeof(DacAudioBuffer.Temp16AudioBuffer));
HAL_DAC_Start_DMA(&hdac, DAC_CHANNEL_1, (uint32_t *) DacAudioBuffer.Audio16BitBuffer, BuffSize, DAC_ALIGN_12B_R);
HAL_TIM_Base_Start_IT(&htim2);
// DAC DMA half out call back
IsDacDataHalfOut = TRUE;
// DAC DMA complete call back
if(HAL_TIM_Base_Stop_IT(&htim2) == HAL_OK) {
if(HAL_DAC_Stop_DMA(hdac, DAC_CHANNEL_1) == HAL_OK) {}
IsDacDataCpltOut = TRUE;
}The main problem I'm facing is that there is a gap between when I stop the timer and restart it again (a big gap in msec) which I don't like to happen.
The bytes I'm reading from the file are audio bytes of wave file so they need to be stitched together perfectly but as soon as time passes the gap becomes bigger and bigger. Any help would be very appreciated. Thanks


