2018-11-11 02:45 PM
Hi guys! In my project Im reading samples with the adc at 48Khz using timer interrupts and adcConvCallbacks, load them in a buffer of 256 samples and when the buffer is full I send it via i2s to the DAC . Im using two buffers, when the bufferA is full i send it and start saving samples in the bufferB, when its full I swap again so I have 256 samples available at any time.
My problem is that en every swap of buffers I heard a "plop" noise from the dac. Do you know how can I avoid that? It seems to sound at every time that a new buffer is sended via HAL_I2S_Transmit() . Im not using interrupts in the I2s, just call it at every time I have a full buffer.
2018-11-11 10:06 PM
> HAL_I2S_Transmit()
I'd say, your I2S transmission may be not continuous. It's unlikely you can get I2S right without DMA.
Of course the ADC timing must be absolutely regular, too, and its sampling rate matching the sampling rate of the DAC (otherwise you'd need to perform sample rate conversion between the two).
JW
2018-11-12 05:20 AM
Im using timer interrupts to get regular 48kHz sampling rate in the ADC, same frequency as the I2S setup. I will try the DMA option, but its hard to believe that it is impossible transmit continuous audio stream without DMA. I was wondering if there is another way, using interrupts may be. Im doing a pass-trough application, ADC in -> I2S DAC out. No processing or DSP at the moment so there is no delay in the data stream. The board I use is STM32F407 Discovery
2018-11-12 06:47 AM
I didn't say it's impossible, I said it's unlikely to get it right. And it's definitively not practical.
Using oscilloscope/LA, observe the I2S bitclock (and if possible, also all other I2S clocks), maybe versus it's master clock (if the DMA uses such); toggle a GPIO so that you can sync on the boundaries between the blocks. If you see no gaps, then it's some other reason, we can elaborate on that then.
JW