Showing results for 
Search instead for 
Did you mean: 

Issue with STM32U535 HAL library - LPDMA1 and SPI3 (Slave Transmit Only) configuration


Hello, I'm currently experiencing an issue with the STM32U535 HAL library, specifically when using LPDMA1 and SPI3 (Slave Transmit Only). A sanity check problem arises when the DMA is configured in Circular mode; the `HAL_SPI_Transmit_DMA` does not pass this check leading to a failure. However, when the DMA is configured with flat buffering, everything works fine.

The issue lies in the fact that `hdmatx->Init` does not match `hspi->Init`. This incongruity seems to happen because the DMA is in circular mode. This mode is emulated by a self-pointing linked list that resets the `C0SAR` to 0 with each iteration, referring to RM0456 section 18.4.13. As such, the `hdmatx` now lacks any containing information, and subsequently, every configuration should be embodied in `hdma->LinkedListQueue`. Therefore, `HAL_SPI_Transmit_DMA` should ideally not check `hdmatx->Init`.

While looking for possible workarounds, I have a few queries. Given the current scenario, should we invoke the `HAL_DMAEx_List*` routines as an alternative to `HAL_SPI_Transmit_DMA` to activate the Linked-list DMA?

Further, to operate with circular DMA, should we set the SPI to be managed by Low level library? If so, what additional registers need to be configured to support this alteration?

Any guidance or recommendation would be much appreciated. Thank you!