cancel
Showing results for 
Search instead for 
Did you mean: 

GPDMA SPI tx+rx circular mode on STM32H5 possible incorrect initialization code

On a Nucleo-H563ZI with CubeIDE 1.14.0 and firmware package for H5 1.1.1.

I managed to get SPI transmit and receive using DMA, triggered by a timer, going not using linked lists. I get my requested number of transmissions and results into my buffers as witnessed on an oscilloscope and a live watchpoint.

But when I enable circular mode, no other modifications, in MX_SPI1_Init - HAL_SPI_Init - HAL_SPI_MspInit it sets up

 NodeConfig.Init.SrcDataWidth = DMA_SRC_DATAWIDTH_WORD;
NodeConfig.Init.DestDataWidth = DMA_DEST_DATAWIDTH_HALFWORD;

builds the node (whatever that is), inserts it into the correct DMA channel, sets circular mode, basically looks like magic but I can imagine what it is doing. But then the stuff in the NodeConfig doesn't get applied to handle_GPDMA1_Channel1, so later when I finally call HAL_SPI_TransmitReceive_DMA, it gets grumpy around line 2230 because hspi->hdmarx->Init is all zeros still. It never got updated maybe?

I think there is a problem with HAL_SPI_MspInit in stm32h5xx_hal_msp.c .

 

Thanks,

Andrei (from the Great (not very) White North)

10 REPLIES 10

Also, in another project I use GPDMA circular mode with ADCs and it works nicely. Plus DMA for UART. No problem.

It's just SPI (standard request mode in CubeMX) that is being grumpy.