AnsweredAssumed Answered

Memory corruption when using USART1

Question asked by oldbury.thomas.001 on Oct 18, 2014
Latest reply on Oct 20, 2014 by oldbury.thomas.001
When I write data to USART1 register  (for Tx) either via USART1->SR or USART_SendData(USART1, ...) I am experiencing an odd data corruption issue. The data out of the USART port is transmitted correctly however other data in SRAM is corrupted.

The most significant data corruption occurs in a large data array consisting of about 230 x 16-bit values. The values get replaced with E0 or F0 alternately in this pattern (E0 E0 F0 F0 E0 E0 F0 F0 etc.)  Every value gets replaced in this pattern, not just a few values.

I have tried turning off interrupts to no avail. One thing I noticed is this bug only started occurring when I used SPI  & DMA to transmit data at the same time. The SPI DMA has priority over the USART. Before when I was just transmitting data over SPI without DMA, this corruption issue did not happen. (Note, the array of values isn't what is actually transmitted - the values get transposed into a variable pulse width bit stream and the corruption appears not to affect this particular operation which essentially replaces bit 1s with one byte and bit 0s with another byte. In my case the SPI data controls some RGB LED array, and the RGB LED data stream is correctly encoded for the incorrect data.)

And, if I disable all USART function, I also do not get any memory corruption issues.

Any ideas would be much appreciated,  have read errata sheets and cannot seem to figure out what would cause this. 

Outcomes