2024-08-20 08:06 AM
Hi,
With GPDMA standard mode, I implemented timer triggered SPI DMA transfer. But the 'Size' argument of the 'HAL_SPI_TransmitReceive_DMA()' is 'unit16_t', this means it can only transfer 64k bytes once. Are there any method to transfer beyond this value using DMA?
Thanks.
2024-08-20 10:08 AM
If your total transfer size is always a multiple of 2, you can change the SPI config to 16-bit data instead of 8-bit. Then you get 64K 16-bit words, or 128K bytes per call.
Or just use the transfer complete callback to start a 2nd (or 3rd) transfer of the next chunk of data.
2024-08-20 07:22 PM
Hi,
It seems there are something not clear now.
So, I think the question now is how to break the 64k bytes limitation of GPDMA. Right?
Thanks.
2024-08-20 08:17 PM
I remember a decade ago I write my own code for Atmel's SAM3X uCPU, that supports DMA Link List mode. No driver from IC makers at that time. I see similar situation here, DMA has feature LList but spi_dma_transfer has no reference in HAL. Probaly, it's quite possible to create two lists and link them in circle, at least I see dma_hal has some references to LList type definition structure
2024-08-20 10:34 PM - edited 2024-08-20 10:54 PM
Hi,
After changing to linked-list DMA, the code enter into hard fault exception when run the code below (in the SPI xfr APIs):
/* Packing mode management is enabled by the DMA settings */
if (((hspi->Init.DataSize > SPI_DATASIZE_16BIT) && (hspi->hdmatx->Init.SrcDataWidth != DMA_SRC_DATAWIDTH_WORD) && \
(IS_SPI_FULL_INSTANCE(hspi->Instance))) || \
((hspi->Init.DataSize > SPI_DATASIZE_8BIT) && (hspi->hdmatx->Init.SrcDataWidth == DMA_SRC_DATAWIDTH_BYTE)))
{
/* Restriction the DMA data received is not allowed in this mode */
__HAL_UNLOCK(hspi);
return HAL_ERROR;
}
And when tracing the code, it seems the 'hspi->hdmatx' is a NULL pointer, this is weird.