cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4 DISCO and CS43L22 DAC

matas
Associate II
Posted on August 11, 2015 at 07:59

Hey everybody 🙂 The STM32F4 disco has an external audio DAC witch is still a little hard to grasp for me, I was hoping anybody of You know any good tutorials, where it would explain how to get a sampling frequency You want.

I managed to start it and added the DMA to move data from an array (32 samples of sine) in my program to the DAC. The only problem I have is I can't get the sine to be a specific frequency. I need at least 16kHz sampling frequency so the sine should be 2kHz at the audio output. What I get is 2.93kHz which is kinda random. I have 12MHz on PC7, which should be enough for the CS43L22.
3 REPLIES 3
matas
Associate II
Posted on August 11, 2015 at 08:26

I forgot to mention that I get the 12MHz only if I insert this line:

''SPI3->I2SPR = (uint16_t)((uint16_t)0x04 | (uint16_t)(0 | (uint16_t)I2S_InitStruct.I2S_MCLKOutput));''

after the PLLI2Scmd(ENABLE);  Since the I2S clock is set with 192 divided by 2, I get 96, the if I insert 4 into the i2S divider I get 12MHz. And I don't know if this is the correct way to do this.

matas
Associate II
Posted on August 13, 2015 at 23:38

Otherwise no mater what I do the PC7 pin is always 8MHz and according to the CS43L22 datasheet, that can not be. Because it need at least 12MHz. :D

matas
Associate II
Posted on August 16, 2015 at 22:39

Ok, I figured out the clock 🙂 everything looks fine on the DAC side 🙂 My goal was to take samples from MEMS mic and send the to DAC 🙂 But so far I get nonsense on the output (you can see it in the attached file). I am trying to do everything through the interrupts. One is doing the filtering and the conversation from PDM to PCM and the other one is sending samples one by one to the DAC 🙂

They are enabled like this:

-SPI_I2S_ITConfig(SPI2, SPI_I2S_IT_RXNE, ENABLE); (interrupt for MEMS mic - if not empty do...convesation)

-SPI_I2S_ITConfig(SPI3, SPI_I2S_IT_TXE, ENABLE); (interrupt for the AUDIO DAC CS43L22, if empty do...send)

again if you know any good links to read, I would really appreciate it. I found all the reference manuals, but they are of no help 🙂

________________

Attachments :

IMG_20150816_233442.jpg : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HzoS&d=%2Fa%2F0X0000000bQ7%2FwhewOeHt86OaMFhklVno2Pjygyw_TJGvzKjAmRZ8HhA&asPdf=false