AnsweredAssumed Answered

DMA on ST32l151 skips bytes when copying from SPI

Question asked by stokic.srdjan on Mar 10, 2014
Latest reply on Jan 25, 2016 by stokic.srdjan
Hi all,

I have a product where DMA copies 10 bytes from external ADC chip over SPI, and puts it into memory. Sampling speed is 2000 sps.

This works well most of the time, but very rarely (several times per minute), DMA skips a byte.

For example, bytes 3, 4, 5 are copied, 6 is skipped, and 7,8,9,10 are OK.

What is even more strange is that this happens only when I have compiler optimizations turned ON. When the optimizations are turned OFF, everything works as expected.

I did spend a considerable amount of time debugging this, but I couldn't find any source of problems in the code. Do you have any ideas or solutions, something that I can try to do?