2025-03-17 4:07 AM
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.