Skip to main content
chriskuku
Senior II
June 7, 2025
Solved

segmentation fault in HAL_I2S_Transmit_DMA on STM32H503

  • June 7, 2025
  • 6 replies
  • 1854 views

I'm about to program a continously running DMA stream (using GPDMA1 (circularly))  in an STM32H503CBU6. But the start already fails.

 

chriskuku_0-1749314103754.png

during the setup of the i2s->hdmatx pointer is zero causing the crash when it wants to get initialized.

I'm in need of a running example with an I2S device configured with a continously running DMA write stream

with a length of 1 (32 word) to the I2S device. Help urgently needed, please.

int main(void)
{

 /* USER CODE BEGIN 1 */

 /* USER CODE END 1 */

 /* 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_GPDMA1_Init();
 MX_ICACHE_Init();
 MX_I2C1_Init();
 MX_I2S2_Init();
 MX_TIM1_Init();
 /* USER CODE BEGIN 2 */
 //HAL_I2S_Transmit_IT(&hi2s2, ram_loc, 1);
 HAL_I2S_Transmit_DMA(&hi2s2, ram_loc,1);
 /* USER CODE END 2 */

 /* Infinite loop */
 /* USER CODE BEGIN WHILE */
 while (1)
 {

 	 HAL_Delay(10);
 	 ram_loc[0]++,ram_loc[1]++;
	 //HAL_I2S_Transmit_DMA(&hi2s2, ram_loc,1);
	 //HAL_I2S_Transmit_IT(&hi2s2, ram_loc, 1);
	 //HAL_I2S_Transmit(&hi2s2, sine_amplitudes, size,5000);
	 //HAL_I2S_Transmit(&hi2s2, test_amplitudes, 4 ,5000);
 /* USER CODE END WHILE */

 /* USER CODE BEGIN 3 */
 }
 /* USER CODE END 3 */
}

DMA 

This topic has been closed for replies.
Best answer by TDK

Set up a GPDMA channel to service I2S2_TX requests. You don't have one assigned.

TDK_0-1749322003334.png

 

6 replies

TDK
June 7, 2025

Please include your IOC file. The DMA pointer should get initialized in the mspinit function. Needs to be enabled in the IOC.

"If you feel a post has answered your question, please click ""Accept as Solution""."
chriskuku
chriskukuAuthor
Senior II
June 7, 2025

IOC file attached.

TDK
TDKBest answer
June 7, 2025

Set up a GPDMA channel to service I2S2_TX requests. You don't have one assigned.

TDK_0-1749322003334.png

 

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