Skip to main content
Graduate II
March 17, 2025
Question

STM32H7S3L8 SPI Tx DMA burst

  • March 17, 2025
  • 1 reply
  • 487 views

Hi,

I am trying to use SPI6 transmission with GPDMA on STM32H7S3L8.

While Tx transfer works with simple IT handling, it doesn't work with DMA. No way...

To take things simple, I am trying a simple burst transfer (I will leave linked list for later), so I wrote this simple function:

 

void ConfigSPIxTxDMAChannel(
 DMA_TypeDef *p_gpdmax, 
 uint32_t p_channel, 
 SPI_TypeDef *p_spix,
 uint32_t p_burst_len,
 uint32_t p_src_addr) {

 LL_DMA_DisableIT_TO(p_gpdmax, p_channel);
 LL_DMA_DisableIT_SUSP(p_gpdmax, p_channel);
 LL_DMA_DisableIT_USE(p_gpdmax, p_channel);
 LL_DMA_DisableIT_ULE(p_gpdmax, p_channel);
 LL_DMA_DisableIT_DTE(p_gpdmax, p_channel);
 LL_DMA_DisableIT_HT(p_gpdmax, p_channel);
 LL_DMA_DisableIT_TC(p_gpdmax, p_channel);
 
 LL_DMA_DisableChannel(p_gpdmax, p_channel);
 LL_DMA_SetChannelPriorityLevel(p_gpdmax, p_channel, LL_DMA_HIGH_PRIORITY);
 LL_DMA_ConfigTransfer(p_gpdmax, p_channel, 
 LL_DMA_DEST_ALLOCATED_PORT1 | \
 LL_DMA_SRC_ALLOCATED_PORT0 | \
 LL_DMA_SRC_DATAWIDTH_BYTE | \
 LL_DMA_DEST_DATAWIDTH_BYTE | \
 LL_DMA_DEST_FIXED | \
 LL_DMA_SRC_INCREMENT);

 LL_DMA_ConfigChannelTransfer(p_gpdmax, p_channel, 
 LL_DMA_HWREQUEST_SINGLEBURST | \
 LL_DMA_DIRECTION_MEMORY_TO_PERIPH | \
 LL_DMA_PFCTRL);
 
 LL_DMA_ConfigAddresses(p_gpdmax, p_channel, p_src_addr, LL_SPI_DMA_GetTxRegAddr(p_spix));
 LL_DMA_SetSrcBurstLength(p_gpdmax, p_channel, p_burst_len);
 LL_DMA_SetDestBurstLength(p_gpdmax, p_channel, p_burst_len);

 
 LL_DMA_EnableIT_TO(p_gpdmax, p_channel);
 LL_DMA_EnableIT_SUSP(p_gpdmax, p_channel);
 LL_DMA_EnableIT_USE(p_gpdmax, p_channel);
 LL_DMA_EnableIT_ULE(p_gpdmax, p_channel);
 LL_DMA_EnableIT_DTE(p_gpdmax, p_channel);
 LL_DMA_EnableIT_HT(p_gpdmax, p_channel);
 LL_DMA_EnableIT_TC(p_gpdmax, p_channel);

 LL_DMA_EnableChannel(p_gpdmax, p_channel);
}

 

while the piece of code for the transfer:

 

LL_SPI_Disable(SPI6);
// LL_SPI_Enable(SPI6);
ConfigSPIxTxDMAChannel(GPDMA1, LL_DMA_CHANNEL_2, SPI6, 64, (uint32_t) &spiTxDmaBuff);
// LL_SPI_SetTransferSize(SPI6, 64);
LL_SPI_EnableDMAReq_TX(SPI6);
LL_SPI_Enable(SPI6);
LL_SPI_StartMasterTransfer(SPI6);

 

But, as far I can see, the DMA always claims user configuration error (

Honestly I can't figure out why the request is not working.

I tried many times different approaches (with HAL as well), without success..

What is wrong with this setup?

Thanks,

s.

 

    This topic has been closed for replies.

    1 reply

    Visitor II
    March 17, 2025

    Try setting burst length to 1 instead of 64, so the value written to register GPDMA_CxTR1.DBL/SBL is 0.   [burst length minus 1].  

    simo zzAuthor
    Graduate II
    March 18, 2025

    Hello @psabela,

    The functions

     

    __STATIC_INLINE void LL_DMA_SetSrcBurstLength(const DMA_TypeDef *DMAx, uint32_t Channel, uint32_t SrcBurstLength);
    __STATIC_INLINE void LL_DMA_SetDestBurstLength(const DMA_TypeDef *DMAx, uint32_t Channel, uint32_t SrcBurstLength);

     

     already substract 1U in their implementations.