AudioOutputI2S glitches after upload: DMA buffer not zeroed by AudioOutputI2S.begin?

MarkT

Well-known member
I setup a simple example with a single sine wave 1kHz oscillator into an AudioOutputI2S object, and
triggered my 'scope on the audio line output while uploading.

The initial audio block contains junk from the last time (I changed the frequency between uploads), the 2nd block is
all zeroes. Then subsequent blocks start up cleanly with the sine wave from the oscillator (inverted since
SGTL5000 line outputs are inverted for some reason)

i2s_output_glitch.png
This problem seems to not happen at power up for some reason.

The issue can be fixed by adding these to the start of AudioOutputI2S.begin():
Code:
	memset (i2s_tx_buffer, 0, sizeof(i2s_tx_buffer));
	arm_dcache_flush_delete (i2s_tx_buffer, sizeof(i2s_tx_buffer));

I'm somewhat perplexed why this doesn't crop up at power-on (is DMA memory zeroed then?)

[ BTW T4.0, audio adapter rev d ]
 
Back
Top