cancel
Showing results for 
Search instead for 
Did you mean: 

ADC -> digital filter -> I2S Audio

Nicholas Parker
Associate
Posted on April 17, 2018 at 00:49

I'm using the STM32F407 Discovery Board to implement a digital band pass filter, this board has a CS43L22 Audio DAC which I want to use for output, (not in analog pass through mode).

However, this seems to create a challenge as the data flow to the DAC must have a continuous clock signal from the STM32F407, so this means the DAC update  rate sets the rate at which I'd need to sample using the STM32F4's on-board ADC.

Is there a clean mechanism / way to use an ADC on the STM, at an arbirtary rate (set by a timer used as a trigger source) and then do some filtering, then pass the data to the I2S DAC?

The only way I can think, is to have the CL43L22 clocked continuously at 'some' rate with data being sent over I2S being supplied from a couple of data (L and R channel) ram variables, which I update from my filter asynchronously (when its ready).

Is there a better way?

This discussion has been locked for participation. If you have a question, please start a new topic in order to ask your question
6 REPLIES 6
MDoro
Associate II

Hi could you solve that? I have same problem.  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. 

SUl H
Associate II

kindly share the adc audio input code with me i am doing same type of work but dnt know how to get audio input to do further processing on it like band pass filtering.

thankyou

Yes of course, this is the code. I have another version using interrupts in the i2s transmition but i havent uploaded it to my github yet. Please let me know if you figure out how to eliminate the "plop". I think its becouse there is a sort of de-sinchronization in the buffers swap.

https://github.com/maximdorogov/Digital-Audio/blob/master/Src/main.c

SUl H
Associate II

would it work in Keil??? i want to use keil mdk using cube mx ???

  • would it work in Keil??? i want to use keil mdk using cube mx ???
  • Like
  • Reply
  •  

mccartneydamon
Associate II

Did you ever solve this issue?

D