Full Firmware Package for the STM32U5 series: HAL+LL drivers, CMSIS, BSP, MW, plus a set of Projects (examples and demos) running on all boards provided by ST (Nucleo, Evaluation and Discovery Kits).
Other
121
stars
67
forks
source link
Calling HAL_SPI_Transmit_DMA() generates crash with "half-duplex" SPI #3
Toolchain (default STM32CubeIDE): GNU Tools for STM32 (9-2020-q2-update)
Describe the bug (skip if none)
HardFault on execution of this condition:
Drivers/STM32U5xx_HAL_Driver/Src/stm32u5xx_hal_spi.c, line 2930
In function SPI2_IRQHandler()->HAL_SPI_IRQHandler()
After the call of HAL_SPI_Transmit_DMA().
Additional context
The code is generated with STM32CubeMX.
The Cube project is configured with a SPI peripheral, and 1 DMA channel linked to the TX of the SPI.
Both IRQ Hanlder and HAL handler generation are ticked for both SPI and DMA channel interrupts.
The HAL_SPI_IRQ_Handler is trying to access the field "hspi->hdmarx->Mode" although hspi->hdmarx is NULL since no DMA channel is linked to SPI RX. This generates the HardFault.
Describe the set-up
Describe the bug (skip if none)
HardFault on execution of this condition: Drivers/STM32U5xx_HAL_Driver/Src/stm32u5xx_hal_spi.c, line 2930
In function SPI2_IRQHandler()->HAL_SPI_IRQHandler()
After the call of HAL_SPI_Transmit_DMA().
Additional context
The code is generated with STM32CubeMX. The Cube project is configured with a SPI peripheral, and 1 DMA channel linked to the TX of the SPI. Both IRQ Hanlder and HAL handler generation are ticked for both SPI and DMA channel interrupts.
The HAL_SPI_IRQ_Handler is trying to access the field "hspi->hdmarx->Mode" although hspi->hdmarx is NULL since no DMA channel is linked to SPI RX. This generates the HardFault.