not able to Read U0RBR in UART0 interrupt(LPC2388)
Goran Ivan
Hi
Not able to Read U0RBR in UART0 interrupt(for receive - RDA
interrupt ). My UART0 interrupt is working (i have put the Break
point) but the U0RBR register showing always Zero value. In polling
method i am able read the values from U0RBR register so no issues in
communication. UART0 initialization code and UART0 Interrupt code
mentioned below. Please help me regarding the same.
RE: not able to Read U0RBR in UART0 interrupt(LPC2388)
Per Westermark
Why do you do an obligatory read from U0RBR directly you enter the
ISR?
Always poll U0IIR and decide what to do based on that result.
Never read registers that are "read-once" unless you know that they
have data available.
And why are you so scared of adding comments?
I see "if ((U0IIR & 0x0E) == 0x04)" but how do I know that
0x04 represents "Receive Data Available" if I haven't the processor
documentation available?
Next thing - when you get into the ISR, there may be more than one
pending interrupt reason. You don't seem to care about bit 0 of U0IIR
to see if there are more to do.
And why do you reset a variable that is already zero in case it
wasn't your address?
Have you really been careful in reading the processor manual? And
in debugging your code?
This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.
ARM websites use two types of cookie: (1) those that enable the site to function and perform as required; and (2) analytical cookies which anonymously track visitors only while using the site. If you are not happy with this use of these cookies please review our Privacy Policy to learn how they can be disabled. By disabling cookies some features of the site will not work.