cancel
Showing results for 
Search instead for 
Did you mean: 

transfer 64kb of data via SPI using DMA on STM32H7

SThie.1
Associate II

Hi, I want to transfer 64kByte of data from memory to my display controller using SPI and DMA.

Everything is working smoothly so far, but I have some problems of understanding, when I try to use the max. number of bytes.

So: 64kByte = 65536 Bytes.
But the SPI_CR2 Register ist 16bit, so takes only 65535 as Maximum number.
Also the RM states for the DMA:
"The amount of data to be transferred (up to 65535) is programmable and related to the
source..."
The HAL function is also taking a uint16_t for the size
HAL_StatusTypeDef HAL_SPI_Transmit_DMA(SPI_HandleTypeDef *hspi, const uint8_t *pData, uint16_t Size)
and treats a size of 0 as an error.

So it looks like the number of bytes that can be transferred is 1.. 65535, wich is in fact 64kByte -1 Byte.
That means I cannot send my memory buffer with full 64kByte in one transfer.

Any hint on how to set this up to transfer 65536 bytes would be appreciated, or the info confirmation, that this is not possible.
Stefan


1 ACCEPTED SOLUTION

Accepted Solutions
ONadr.1
Senior III

Your conclusions are correct. So you have to divide the DMA transfer or not transfer the last byte (it probably won't be recognized on the display).

View solution in original post

2 REPLIES 2
ONadr.1
Senior III

Your conclusions are correct. So you have to divide the DMA transfer or not transfer the last byte (it probably won't be recognized on the display).

TDK
Guru

You can set the size to half-words and transfer 32768 uint16_t's, or set it to word and transfer 16384 uint32_t's. But byte order may be swapped.

If you feel a post has answered your question, please click "Accept as Solution".