First pass through USART RX handler takes a long time
Posted: Sat Jul 14, 2012 6:46 am
This is on an 8 MHz ATmega644A. I'm sending 115k bps serial data to the MCU. If I put a millisecond or more between characters, it seems to receive very reliably. But if I send at full speed, it's very unreliable.
I twiddle an LED and use an o'scope to time how long it sits inside the RX interrupt handler. The first time, after sitting idle for some time, it seems to take a lot longer than subsequent times.
Could this be the case? I also am suspicious that my o'scope is missing the falling edge of the pulse, and the rising edge of the next pulse, and making two trips through the ISR look like one. But it's a decent Tektronix scope, and it never seems to miss on the subsequent interrupts, so I don't think that's it.
It could also be the baud generator just has too much error in it. I bought a different crystal which should give me zero-error baud.
I twiddle an LED and use an o'scope to time how long it sits inside the RX interrupt handler. The first time, after sitting idle for some time, it seems to take a lot longer than subsequent times.
Could this be the case? I also am suspicious that my o'scope is missing the falling edge of the pulse, and the rising edge of the next pulse, and making two trips through the ISR look like one. But it's a decent Tektronix scope, and it never seems to miss on the subsequent interrupts, so I don't think that's it.
It could also be the baud generator just has too much error in it. I bought a different crystal which should give me zero-error baud.