cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H723ZG I2S DMA as Slave Receive doesn't read the data

PieroElectr
Associate

Good afternoon,

I'm using the STM32H723ZG Nucleo Board, and I'm trying to collect data using I2S + DMA coming from a PCM1803AEVM that is  a 24-bit ADC used mostly for audio purposes.

I've set the PCM1803 as controller (MASTER), it is generating the BCK, LRCK and SDO and I can see these three signals using the oscilloscope. I see also the correct frequencies.

BCK:3.072MHz

LRCK: 48kHz

SDO: digital values equal to -1,0.+1 as expected since there is no input signal.

Now, from the STM32 board  I've set the .ioc file related to the I2S part in this way:

PieroElectr_0-1720698373024.png

DMA:

PieroElectr_1-1720698400818.png

The main code is the following, very simple:

 

#define BUFFER_SIZE 100

uint32_t samples[BUFFER_SIZE] = {0};

int main(void)

{

 

/* USER CODE BEGIN 1 */

 

/* USER CODE END 1 */

 

/* MPU Configuration--------------------------------------------------------*/

MPU_Config();

 

/* MCU Configuration--------------------------------------------------------*/

 

/* Reset of all peripherals, Initializes the Flash interface and the Systick. */

HAL_Init();

 

/* USER CODE BEGIN Init */

 

/* USER CODE END Init */

 

/* Configure the system clock */

SystemClock_Config();

 

/* USER CODE BEGIN SysInit */

 

/* USER CODE END SysInit */

 

/* Initialize all configured peripherals */

MX_GPIO_Init();

MX_DMA_Init();

MX_USART3_UART_Init();

MX_I2C1_Init();

MX_I2S3_Init();

/* USER CODE BEGIN 2 */

 

 

 

/* USER CODE END 2 */

 

/* Infinite loop */

/* USER CODE BEGIN WHILE */

 

 

HAL_I2S_Receive_DMA(&hi2s3, (uint16_t*)samples, BUFFER_SIZE*2);

while (1) {

/* USER CODE END WHILE */

 

/* USER CODE BEGIN 3 */

}

/* USER CODE END 3 */

}

I successfully communicated with the PCM1803 using it as a slave and the stm32h7 as a master. 

But in the slave scenario I have problem. I debugged the samples array but it stays always at 0 even if

the DMA is active because I'm able to access to the halfcomplete and complete callback functions.

I also tried changing all the input parameter of the HAL_I2S_Receive_DMA (like the size buffer) but it didnt work.

Do you have any hint? I'm pretty sure that the HW interconnections are fine, it should be something related to the FW.

 

Thank you so much for your time in advance,

let me know if you need any further info.

wish you a good day.

 

Piero

1 REPLY 1
nouirakh
ST Employee

Hello @PieroElectr 

At the beginning, can you please check I2S and DMA configurations:

  • Ensure that the DMA is configured to handle the I2S data stream:

    • Peripheral to Memory: Yes
    • Data Width: 32-bit (to handle 24-bit data correctly)
  • Ensure that the I2S peripheral is configured correctly in the .IOC file:

    • Mode: Slave Receive
    • Data Format: 24-bit or 32-bit (depending on how you want to handle the 24-bit data)
    • Clock Polarity: Low
    • Clock Phase: 1 Edge

Then, could you please, Check DMA Interrupts:
Make sure that the DMA interrupts are enabled and correctly configured, and verify that the HAL_I2S_RxCpltCallback and HAL_I2S_RxHalfCpltCallback functions are being called.

By carefully checking the I2S and DMA configurations, verifying the callback functions, you should be able to resolve the issue with the I2S + DMA setup on the STM32H723ZG. If the problem persists, We will investigate further.