cancel
Showing results for 
Search instead for 
Did you mean: 

How to properly set up STM32H7 I2S as master to interface with an audio CODEC?

gabrielgcma
Associate

Hello! This is my first post here. I'm currently designing a DIY loop pedal for guitar, which basically records samples of audio and plays them in loop.

I'll be using a STM32H743VIT6, embedded on a WeActStudio dev board. The audio CODEC is the PCM3060. I'm aiming for 24bits resolution with 44.1kHz sample rate, 256Fs.

I don't know much about I2S in general, so this is what I've pictured: I should setup the ST as master full-duplex, so it can receive from the CODEC and transmit to the CODEC at the same time (the looped audio, when it has finished recording). 

This is what I've setup so far on CubeIDE:

gabrielgcma_0-1743348467130.pnggabrielgcma_1-1743348540962.png

(both DMA requests' data width are set to Word)

What's confusing me is the "Error between Selected and Real". Will it cause significant distortion/noise? I tried looking at the clock tree for some kind of configuration, but I didn't find something like a PLLI2SCLK (which I've found on a STM32F411).

 

4 REPLIES 4
mƎALLEm
ST Employee

Hello,

I'm not expert of audio subject but doing a little simulation on CubeMx, I can find 0,26% error instead of 1.45% using HSI:

 

mALLEm_1-1743692699066.png

 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

Thanks! I'll give it a try. But why 192MHz? I was thinking of using 256Fs clock frequency, and at 44.1kHz that would be 256 * 44100 = 11.2896MHz. 

As I said it was a simulation and got better result than you. You can try and find other settings better then me..

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

@gabrielgcma wrote:

Thanks! I'll give it a try. But why 192MHz? I was thinking of using 256Fs clock frequency, and at 44.1kHz that would be 256 * 44100 = 11.2896MHz. 


Get RM0443 for H7, there is paragraph regarding SPI/ I2S.