Re: UART receive ISR receives 1st 2 bytes twice



galapogos <goister@xxxxxxxxx> wrote:
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!

Is reading the 'receivebuffer' register enough ? Maybe your UART needs
special treatment to tell it you have read the buffer so at can clear
the interrupt ?


--
:wq
^X^Cy^K^X^C^C^C^C
.



Relevant Pages

  • Re: UART receive ISR receives 1st 2 bytes twice
    ... 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 ...
    (comp.arch.embedded)
  • UART receive ISR receives 1st 2 bytes twice
    ... 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 ... indeed the receivebuffer is 0x1 rather than 0x3, so the ISR seems to be ...
    (comp.arch.embedded)
  • Re: UART receive ISR receives 1st 2 bytes twice
    ... 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. ... Create your own test data stream, ...
    (comp.arch.embedded)
  • Re: UART receive ISR receives 1st 2 bytes twice
    ... I'm trying to read data from a smart card via a Toshiba 16bit MCU's ... My receive ISR however seems ... to pull out the 1st 2 bytes of the transmission from the receive buffer ... then moved to rxbuff2, and only rxbuff2 is accessible to the user. ...
    (comp.arch.embedded)
  • Re: UART receive ISR receives 1st 2 bytes twice
    ... 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. ... Create your own test data stream, ... How does the isr know, ...
    (comp.arch.embedded)