I'm learning embedded programming (I'm not an Electrical Engineer). Sorry if this is not the right place or I'm asking this question incorrectly, but I had a very tough time trying to figure out a solution. I'm using a ATMega32 with a GPS module and a 16x2 LCD. I just want to read a NMEA sentence over UART and send the parsed data to the LCD. I read the sentence in a buffer and then spit it out to the display.But I get inconsistent data sometimes.. The GPS is always on and the AVR powers up in the middle and waits for the start of a sentence and then continues on receiving.
My question is: how can two devices sync if one is always sending (GPS sends data at 1 Hz rate) and the other receives at random times. How is UART synchronization achieved? I know about start and stop bits, but once the UART gets a bad packet (raising a framing error for example) how can it recover and synchronize?
please explain what happens at hardware level also or if you can,point me to some online resource, I can't find what I'm looking for.
Thanks so much!