transfer 64kb of data via SPI using DMA on STM32H7
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-08-07 4:27 AM
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
Solved! Go to Solution.
- Labels:
-
DMA
-
SPI
-
STM32H7 series
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-08-07 4:36 AM
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).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-08-07 4:36 AM
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).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-08-07 4:45 AM - edited ‎2023-08-07 4:45 AM
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.
