cancel
Showing results for 
Search instead for 
Did you mean: 

STM32Cube IDE STM32F4 Discovery board I2S DMA

waddy
Associate II

Hi All

Trying to get an understanding of how I2S with DMA works using the STM32Cube IDE by implementing a simple audio loop-through application.

Connected the STM32F407G Discovery board to a Digilent PMOD I2S2 codec and set up using the STMCube IDE GUI as follows: PC2 = I2S2_ext_SD, PC3 = I2S2_SD, PB10 = I2S2_CK, PB12 = I2S2_ WS and PC6 = I2S2_MCK

I2S2 set as: Full-Duplex Master with Master clock output enabled.

Parameter settings: Mode Master Transmit, I2S Philips, 24 bits on 32 bit frame, 96kHz, I2S PLL Clock, Polarity LOW. 

DMA settings: I2S2_RX, Circular buffer, DMA1 Stream 3. I2S2, Circular buffer, DMA1 stream 4.

I2S clock set to give sampling frequency of 96kHz.

Added the buffer definitions, DMA startup code and the half and full callbacks to main program.

Everything works as expected.

Next, tried the same trick with the L-TEK audio board (codec) connected to the Discovery.

Same basic IDE setup except I2S2_CK = PC13 (pre-wired connection to codec) and I2S clock set to give sampling frequency of 48kHz. Also using 16bit data on a 16 bit frame.

Added code to set up the TLV320AIC23B codec on the L-TEK audio board. The I2C data is reaching the codec's registers because I can set the bypass mode where input is directly routed to the output, bypassing the codec itself (no read registers on the codec, so can't check that way).

The system does not appear to be receiving data into the receive buffer. Putting dummy data into the receive buffer does produce output so the output side is working.

The clocks are all there (checked on a 'scope) and the full and half full call backs are being fired.

Anybody any idea what I'm doing wrong - any help appreciated ?

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi All (again!)

Final update on this post. A workaround to the problem :-

1. Set PC2 and PC3 to their reset states.

2. Configure PB14 to I2S2_ext_SD and PB15 to I2S2_SD and flash this new configuration.

3. After steps 1 and 2, connect female to female Dupont leads from PB14 to PC3 and PB15 to PC2. The pins on the top of the Discovery board just about make this possible.

Note that with the Dupont leads in place, PC2 and PC3 can not be used for any other function.

That's a wrap !

View solution in original post

4 REPLIES 4

Observe the data line (together with the clocks) in the direction in question, using LA or oscilloscope.

JW

Hi Jan - thanks for your reply.

I've looked at the data signal along with the clock and it looks fine. 

A bit of background and some new information.

Background:

I've had problems with the L-TEK board from the start. I emailed L-TEK several times asking for information on how their Audio board and the Discovery board were connected but have received no response. So, buzzed out the connections and set up the STMCube IDE GUI accordingly but have not been able to get the two working together.

Loading a supplied loop-through application onto the Discovery using the Keil uVision 5 IDE the two boards work OK. Unfortunately I can't get any setup information from that application.

I have had the Discovery board and the Digilent PMOD codec working OK using the STMCube IDE, so the basic Cube setup seems to be OK.

New information:

I have unhooked the two boards and reconnected them using the 9 way SIL connector located at one end of the L-TEK board. The connections from the Discovery board are the same as they would be if the boards were hooked up by their two 50 way DIL headers but are now supplied via Dupont leads.

Connected in this way I am getting the loop-through working (I have absolutely no idea why !) but there is also a loud background hiss, even when no input signal is connected. I read something you posted online about incorrect data formats and noise, noise and more noise and wondered if you had any advice on how to get rid of the noise. I also read this may have something to do with a PSIZE variable but have no idea how to access this.

Again, any help appreciated.

 

Hi All

Update on the post. One of the L-TEK Audio board' 50 way connectors appears to have a wiring error.

They have cross connected the Discovery board's PC2 and PC3 with the Audio board's Data In and Data Out pins, effectively connecting the ADC output to PC3 (SPI_TX, also an output) and the DAC input to PC2 (I2S2_EXT_RX, an input). Connecting the two outputs together may well have damaged the ADC output which could account for the noise which is now evident.

Hi All (again!)

Final update on this post. A workaround to the problem :-

1. Set PC2 and PC3 to their reset states.

2. Configure PB14 to I2S2_ext_SD and PB15 to I2S2_SD and flash this new configuration.

3. After steps 1 and 2, connect female to female Dupont leads from PB14 to PC3 and PB15 to PC2. The pins on the top of the Discovery board just about make this possible.

Note that with the Dupont leads in place, PC2 and PC3 can not be used for any other function.

That's a wrap !