cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with SPI DMA for transmitting over 200bytes

generallishin
Associate II

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

 

6 REPLIES 6
AScha.3
Chief II

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. :)

 

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

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.

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

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

but then data after those 4 bytes are correct.

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

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

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

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