lpcware

LPC1769 UART problem

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by karanmehta93 on Wed Jan 01 15:27:33 MST 2014
I am using UART to receive two bytes at a time with a LPC1769 from Atmega8. The UART starts with an falling edge interrupt generated in LPC1769 by using a GPIO pin of Atmega8. Since the two bytes are required in order, the code remains inside a loop until the whole byte is received and then copies it into a variable name "val1". It does the same thing again for variable "val2".
However during the course of time, I find that sometimes, unusually, the bytes val1 and val2 get interchanged. It severely affects my program.
Since I am controlling motors also along with this, the spikes of motor can be a reason for that.
I wanted to know the possible reasons for the bytes getting interchanged even when UART is used with interrupt.
Also suggest me possible methods to avoid the same problem again.

Outcomes