cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F411VE-DISCO / CS43L22 Frequency Issues

cosmicchasm
Associate II

Hey all,

I've spent a fair amount of time trying to make a DTMF tone generator using an STM32F411VE board I got as a gift. The board comes with a CS43L22 DAC chip that can be accessed by the STM32F411 through I2C and I2S. My rationale is as follows:

1) Using the reference manual and CS43L22 datasheet, write a simple I2C driver to initialize the DAC, send commands, etc.

2) Using the reference manual and CS43L22 datasheet, next write a simple I2S driver to send audio data via DMA to the DAC.

3) Use the FPU to calculate samples of the desired DTMF tone and use a circular buffer/DMA to write those samples to the DAC with a frequency of 48 kHz.

Seemed simple enough to me, and if I thought that if I followed the two aforementioned documents closely, I should be able to knock it out in a couple of days (I'm still a bit of a beginner with bare-metal programming).

That was not the case :) the biggest hurdle I've hit so far involves the CS43L22 DAC. It does not seem to be seeing the same MCLK/SCK/LRCK frequencies that I've programmed the I2S to output. I tried to verify that these frequencies were wrong by enabling the built-in tone generator in the DAC. And when I programmed the DAC to play a 1 kHz tone, I got more like 1.2 kHz. And then when I tried to play my calculated DTMF tones, they sounded nothing like what they were supposed to (although it was possible to distinguish two separate tones in the playback). 

For reference, I'm using the HSE clock (8 MHz on the STM32F411VE-DISCO board), PLLI2SM = 8 (to get the input to the I2S VCO to 1 MHz), PLLI2SR = 3, PLLI2SN = 258, PLLI2SDIV = 3, ODD = 1, and MCKOE = 1 (all of these per the STM32F411 reference manual). My data size is 16 bits. 

My next logical step would be to take a logic analyzer/frequency counter/etc. and make sure that I'm getting a clean ~47.991 kHz LRCK and ~12.288 MHz MCK (256 * 48 kHz) clock from the STM32F4, but I'm away from any such devices at the moment (will be able to use them when I get to work).

Has anyone else experienced a similar issue with this board/DAC?

0 REPLIES 0