cancel
Showing results for 
Search instead for 
Did you mean: 

NUCLEO-H723ZG I2S with PI-mod i2s stereo codec

MatthewsEffects
Associate III

Hey everyone

I was successfully running i2s on the stm m4 cores but trying to make the jump to h7 and running into a issue. 

Using the same code and the DMA triggers but no code is being loaded in the rx buffer. Not sure the tx buffer is being sent out either. 

The clock signals seem to be working since I can direct connect the adc to the dac data lines on the pmod while useing all the clock signals from the mcu and i get clean pass through.

 

I've seen some stuff about memory allocation, maybe the dma is putting the data in the wrong spot and pulling data from the wrong spot? Idk having trouble understanding what i'm doing wrong. 

 


I've attached my main.c
if you go down to line 429 you can see my dma functions but I'll also post here

void HAL_I2SEx_TxRxHalfCpltCallback(I2S_HandleTypeDef *hi2s2){

//restore signed 24 bit sample from 16-bit buffers

int lSample = (int) (rxBuf[0]<<16)|rxBuf[1];

int rSample = (int) (rxBuf[2]<<16)|rxBuf[3];

//restore to buffer

txBuf[0] = (lSample>>16)&0xFFFF;

txBuf[1] = lSample&0xFFFF;

txBuf[2] = (rSample>>16)&0xFFFF;

txBuf[3] = rSample&0xFFFF;

}

 

void HAL_I2SEx_TxRxCpltCallback(I2S_HandleTypeDef *hi2s2){

//restore signed 24 bit sample from 16-bit buffers

int lSample = (int) (rxBuf[4]<<16)|rxBuf[5];

int rSample = (int) (rxBuf[6]<<16)|rxBuf[7];

//restore to buffer

txBuf[4] = (lSample>>16)&0xFFFF;

txBuf[5] = lSample&0xFFFF;

txBuf[6] = (rSample>>16)&0xFFFF;

txBuf[7] = rSample&0xFFFF;

}

1 ACCEPTED SOLUTION

Accepted Solutions
MatthewsEffects
Associate III
3 REPLIES 3
MatthewsEffects
Associate III

I found this extremely helpful!! 

https://www.youtube.com/watch?v=0DhYTqPCRiA&t=83s

The comments on my article also document how that Microchip (Atmel) application note and other manufacturer provided documentation is incomplete and wrong. As a consequence, the example in this video is also incomplete. That is not a surprise, because the ControllersTech site is made by an incompetent amateur. Therefore for a correct and complete example, read my article. 😉