cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4-DISC1 emits audio noise

Stanislav Silnicki
Associate III
Posted on November 05, 2016 at 15:44

Hi Everybody!

I've successfully implemented USB Audio device, utilising onboard cs43l22 DAC and it works well, except one annoying thing: it emits periodic noise in analog output, mixed to normal sound. I noticed, that it is rigidly bound to the moment when

HAL_I2S_Transmit_DMA is called to send new data to DAC. I have captured the sound by Audacity and here how it looks like. Can anyone suggest the nature of that noise and how it could be fixed?

Thank you,

Stan 

:0690X000006036qQAA.jpg

#stm32f4-disc1-cs43l22-usb-noise
2 REPLIES 2
Posted on November 06, 2016 at 19:27

Looks like 1kHz, which is the frequency of USB packets arrival. Buffer over/under-run? (i.e. playing back faster/slower than USB supplies the data)

JW

Stanislav Silnicki
Associate III
Posted on November 07, 2016 at 19:03

Hi! I use standard ST's audio class driver with one buffer and HalfBuf DMA callback, where sync adjustment is managed. The only thing I added is call to HAL_I2S_Transmit_DMA.

In the end, it looks like cs overlaps two buffers (!).... I have generated different tones and visualized 'em and saw that the overlapping continues 1800 samples. This window is split by 50 sample fragments (36 fragments in total). These 50 samples are assembled in different proportion of ''old'' buffer and ''new'' one (see pic). The period, when this ''overlapping'' happens depends upon the size of buffer in the manner that the shorter is the buffer,  the more often ''overlaps'' I observe. If it happened due to being not in sync with arriving data, such ''overlaps'' would happen with constant period, but it is not - it happens only when HAL command is issued for next transfer and the length of that sh.t is always has same length - 1800 samples. Further, when I used sample frequency, multiple 50 Hz, no overlaps were observed...

0690X0000060375QAA.jpg