cancel
Showing results for 
Search instead for 
Did you mean: 

STM32U5 SPI DMA in DMA_LINKEDLIST_CIRCULAR mode occurs HardFault error

OneLine
Associate II

Hi

I use STM32U5 SPI2 in Salve mode to only receive data,and the data-size is 16Bit. Because the rate is very fast, I use the DMA_LINKEDLIST_CIRCULAR mode combined with the DMA half-full interrupt solution.

When I used HAL_SPI_Receive_DMA() to start SPI reception, I found that I encountered a Hardfault, in the following code.

OneLine_0-1714988262120.png

I found that the hspi->hdmarx->Init.DestDataWidth value was abnormal. Because this value is not assigned in the HAL_SPI_MspDeInit() initialization function. So I added an assignment statement by myself, handle_GPDMA1_Channel0.Init.DestDataWidth = DMA_DEST_DATAWIDTH_HALFWORD, to solve the HardFault. It seems that the DMA is working normally.
The question is, is this modification possible? 

1 ACCEPTED SOLUTION

Accepted Solutions
Imen.D
ST Employee

Hello @OneLine,

Please make sure to configure properly the SPI Clock (CLKPhase, CLKPolarity..).

Could you please share more details (SPI configuration, version firmware used)?

If possible, share your ioc file, this will help to investigate and reproduce the issue.

 

 

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

View solution in original post

2 REPLIES 2
Imen.D
ST Employee

Hello @OneLine,

Please make sure to configure properly the SPI Clock (CLKPhase, CLKPolarity..).

Could you please share more details (SPI configuration, version firmware used)?

If possible, share your ioc file, this will help to investigate and reproduce the issue.

 

 

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

Hi, @Imen.D

Thanks for your reply.

Here is a ioc file I used, I use the newest stm32u5cube version in 1.15.

 

Oneline