2024-05-06 02:46 AM - edited 2024-05-06 02:47 AM
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.
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?
Solved! Go to Solution.
2024-05-07 08:22 AM
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.
2024-05-07 08:22 AM
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.
2024-05-09 10:21 PM
Hi, @Imen.D
Thanks for your reply.
Here is a ioc file I used, I use the newest stm32u5cube version in 1.15.
Oneline