Skip to main content
Explorer
March 30, 2025
Solved

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

  • March 30, 2025
  • 1 reply
  • 1250 views

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).

 

    This topic has been closed for replies.
    Best answer by mƎALLEm

    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

     

    1 reply

    mƎALLEmAnswer
    Technical Moderator
    April 3, 2025

    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

     

    Explorer
    April 3, 2025

    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. 

    Technical Moderator
    April 3, 2025

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