cancel
Showing results for 
Search instead for 
Did you mean: 

SAI1 DMA Callback Issue

semmelrinde
Associate II

Hello everyone,

I'm currently working on a project using the STM32H723VE microcontroller and have encountered a problem with the SAI1 peripheral. Previously, I developed my code on the STM32H723ZG Nucleo and everything worked perfectly, including the SAI1 callback function. However, after writing the same code to the STM32H723VE, the SAI1 callback function is no longer triggered. All DMAs are configured in circular mode with word data width.

What works on the STM32H723VE so far is the SAI4 in slave transmit and the I2S1 in slave receive. SAI4 accesses RAM D3 and I2S accesses RAM D2 while sending/receiving data from DMA.
As soon as I include SAI1 slave transmit data in the code, all DMA operations of SAI4 and I2S1 stop. As soon as I stop the DMA from SAI1, everything works again.
I am confused because the code worked fine on the STM32H723ZG Nucleo.


Here is the RAM allocation for the DMA in the .._FLASH.ld file:

 

  .dma_d2_buffer : /* Space before ':' is critical */
  {
    *(.dma_d2_buffer)
  } >RAM_D2
  
  .dma_d3_buffer : /* Space before ':' is critical */
  {
    *(.dma_d3_buffer)
  } >RAM_D3

 

in the main.c:

 

#if defined( __ICCARM__ )
  #define DMA_D2_BUFFER \
      _Pragma("location=\".dma_d2_buffer\"")
#else
  #define DMA_D2_BUFFER \
      __attribute__((section(".dma_d2_buffer"), used, aligned (4)))
#endif

#if defined( __ICCARM__ )
  #define DMA_D3_BUFFER \
      _Pragma("location=\".dma_d3_buffer\"")
#else
  #define DMA_D3_BUFFER \
      __attribute__((section(".dma_d3_buffer"), used, aligned (4)))
#endif


DMA_D2_BUFFER int32_t inDataI2s[BUFFER_SIZE];
DMA_D2_BUFFER int32_t outDataSai1[BUFFER_SIZE/2];
DMA_D3_BUFFER int32_t outDataSai4[BUFFER_SIZE/2];



int main(void)
{...

...
  status = HAL_I2S_Receive_DMA(&hi2s1, (uint16_t *) inDataI2s, BUFFER_SIZE);
  status = HAL_SAI_Transmit_DMA(&hsai_BlockA1, (uint8_t *) outDataSai1, BUFFER_SIZE/2);
  status = HAL_SAI_Transmit_DMA(&hsai_BlockB1, (uint8_t *) outDataSai1, BUFFER_SIZE/2);
  status = HAL_SAI_Transmit_DMA(&hsai_BlockA4, (uint8_t *) outDataSai4, BUFFER_SIZE/2);
  status = HAL_SAI_Transmit_DMA(&hsai_BlockB4, (uint8_t *) outDataSai4, BUFFER_SIZE/2);

while (1)
  {
  }
}

void HAL_I2S_RxHalfCpltCallback(I2S_HandleTypeDef *hi2s) {
	bufferIndex = 0;
	processData();
}

void HAL_I2S_RxCpltCallback(I2S_HandleTypeDef *hi2s) {
	bufferIndex = BUFFER_SIZE/2;
	processData();
}

void HAL_SAI_TxHalfCpltCallback(SAI_HandleTypeDef *hsai) {
	saiCallback=1;
}

void HAL_SAI_TxCpltCallback(SAI_HandleTypeDef *hsai) {
	saiCallback=2;
}

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

It turned out to be a bad IC. I never would have guessed that because the rest of the IC worked fine. A direct replacement solved the problem.

View solution in original post

3 REPLIES 3
AScha.3
Chief III

Hi,

>after writing the same code to the STM32H723VE

But you made a new ioc (and code), because not all pins avail (lqfp144->lqfp100 ) ?

If you feel a post has answered your question, please click "Accept as Solution".
semmelrinde
Associate II

Yes, exactly! I created a new project, but made the same settings for the BDMA, DMA, SAI peripherals and the MPU. But maby i have made a mistake or forgot something somewhere else. I just can't find it and I am searching for it for days now.
I would be really happy for any help.

It turned out to be a bad IC. I never would have guessed that because the rest of the IC worked fine. A direct replacement solved the problem.