Skip to main content
Visitor II
September 29, 2024
Question

Issue with SPI DMA for transmitting over 200bytes

  • September 29, 2024
  • 3 replies
  • 999 views

Hi,

Facing an issue on the STM32L4A6ZG. Trying to transmit 255 bytes through the SPI DMA at 12MHz. Correct data transmitted out on the MOSI till byte number 203, then the next 4 bytes are transmitted incorrectly and the 209th byte onwards it's correct again. Is there some sort of limitation with the number of bytes that can be transmitted continuously ? 

Scope image at the bottom shows the inconsistent data - after 0xDF, expected data was 0xE0, 0xE1, 0xE2 and 0xE3 which was not transmitted out correctly. 0xE4 onwards it's correct. 

generallishin_0-1727629243635.png

 

    This topic has been closed for replies.

    3 replies

    Super User
    September 29, 2024

    Hi,

    > Is there some sort of limitation with the number of bytes that can be transmitted continuously ? 

    If using DMA : yes ->

    AScha3_0-1727631206461.png

    After 200 bytes -> the problem is in your program. :)

     

    Visitor II
    September 30, 2024

    but then data after those 4 bytes are correct.

    Super User
    September 30, 2024

     4 bytes = 1 int32 ; So a single "wrong" write to an INT pointer is enough.

    Super User
    September 29, 2024

    So 4 bytes are off. Probably due to an out of bounds write. You can set a hardware watchpoint at that location to find out what is modifying the data. Unlikely to be a DMA issue, more likely due to a bug in your program.

    Visitor II
    September 30, 2024

    If it was out of bounds, wouldn't all the following bytes be out of bound ?

    Super User
    September 30, 2024

    No, a single out of bounds write will only corrupt what is written, not everything after that as well.