I will need some help on this.
I tried for several hours but I do not know where else to look. Some time ago I was interfacing a GPS module with an ATmega164p and everything was just fine. I could get the NMEA string in and I could send text over the serial port out. So I had to work in another project and now, several months later, I´m back on this. Checking if everything was ok, I realize I could not get NMEA strings anymore and neither send strings over the serial. I Checked everything I could remember and all looks fine. So I hook the scope probe to GPS serial output and everything is fine at 9600. But checking the serial TX output from micro controller I noted that the speed is way over 400.000 baud! How can it be possible? I´m using a 4MHz xtal. My baud is set to 9600 (25). For this speed a bit width should be 104.17us, but I´m getting 2us.
Anyone have any idea where to look?
Here some pieces of the serial code settings and the fuses (image):
int baud = 25; // 25=9600 UBRR0H = (unsigned char) (baud >> 8); // define baud UBRR0L = (unsigned char) baud; UCSR0B = (1<<TXEN0) | (1<<RXEN0); // set TX RX UCSR0C = (1<<UCSZ00)|(1<<UCSZ01); // 8 bits UCSR0B |= (1 << RXCIE0); UBRR1H = (unsigned char) (baud >> 8); // define baud UBRR1L = (unsigned char) baud; UCSR1B = (1<<TXEN1) | (1<<RXEN1); // set TX RX UCSR1C = (1<<UCSZ10)|(1<<UCSZ11); // 8 bit UCSR1B |= (1 << RXCIE1);