Hi,
I'm trying to read data from a smart card via a Toshiba 16bit MCU's UART interface set at a slow 4+K baudrate. My receive ISR however seems to pull out the 1st 2 bytes of the transmission from the receive buffer twice. i.e., when the smart card sends 0x1, 0x2, 0x3, ..., 0xa, My receive ISR will receive 0x1, 0x2, 0x1, 0x2, 0x3, ...,0xa. I've checked the I/O line with a logic analyzer and the smart card isn't resending the 1st 2 bytes. I've checked the bit period on both the MCU and smart card and they both agree(i.e. similar baudrate) so it's not a synchronization problem either.
Does anyone know what might be causing it? My receive ISR is simple, and currently does no error checking: ISR() { fifo[i++] = receivebuffer }
I've tried putting in breakpoints when when i == 2 in the ISR, and indeed the receivebuffer is 0x1 rather than 0x3, so the ISR seems to be doing its job just fine, except the receivebuffer doesn't seem to have the right data.
Any ideas? Thanks!