Hi,
I have a problem that I have to urgently solve. I am using LPC3250. I want to handle the IRQ interrupt for the receive data. I mean, when data comes to the receive fifos, I want to get an IRQ interrupt and handle the tasks.
I wrote the following codes to enable the interrupt:
MIC_ER = 0x200; // enable uart5 interrupts UNIER = 0x01; // enable receive data available interrupt. UNFCR = 0x06; // reset the transmit and receive fifos UNLCR = 0x00; // Reset DLAB to 0.
However, when I proceed in main, the code suddenly goes to the irq handler, although no data comes to fifo. In continuously takes irq interrupt and never stops at all. What may be the problem? Am I doing anything wrong in enabling bits?
I'll be very glad to hear from you. Thanks for your helps..
do other interrupt sources exhibit the same behavior? try to interrupt the processor by a timer, for instance. what happens?
I solved the continuous interrup problem. Now, there is another problem.
When I send data to the receive fifo, the interrupt comes. in the ISR, i check the U5IIR register, i hope to find 0x0100, but there is 0x0001, which means there is no interrupt.
The interrupt occurs at the right time, but I cannot see the occurance from the register.
What can be the reason for this?
Thanks for your helps..
Please start off by telling what the cause was for the previous problem.
Suprisingly I wrote U5IER = 0x01 above MIC_ER = 0x200, and the continuous interrupt problem was solved.
Now, I can get the interrupt when data is received. But, in the ISR, I have the following:
MIC_SR = 0x200 ; it means there is interrupt from UART5, which is good! U5IIR = 0x01 ; it means there is no interrupt seen in the UART5, which is not good at all. I expect to see U5IIR = 0x04, but I just cannot.
Is there a way to initialize the IIR register, or do I need to do anything else?
Have you verified that the header file is good, so you really are reading the correct register?
Hi, I solved the problem finally. But still have a few questions.
I disabled the MIC (Main Interrupt Controller). I only configured the Uart5 Interrupt register. (U5IER = 0x01). Now, I dont ever use any ISR, but the UART interrupt itself gives me the value. I poll the U5IIR register and see 0x04 there.
But, if I wouldnt use the MIC, so why does it have UART interrupt bits? For all these times I thought that I would first set MIC (MIC_ER = 0x200) and then set U5IER. But, MIC is completely useless here..
I am missing a point?
Note that many processors are designed devices to be interrupt-driven or polled.
If interrupt-driven or polled, you can check the status registers to see all interrupt sources that needs processing. If using interrupts, then the processor will automagically select the most prioritized interrupt to handle, and the interrupt handler can see if other interrupt sources needs processing, or not. With interrupts off, you can still let the main loop check which devices that should have generated an interrupt, if interrupts were allowed.
In the case of the register you have problms with - maybe the least significant bit is only valid when polling. Maybe that bit gets automatically cleared when you enter the interrupt handler, since you already know that you have an interrupt from the UART. So maybe the ISR never need to check the first bit. But when using interrupts, the ISR just must process any interrupt reasons from the UART, unless you want to get yet another interrupt as soon as you return from the interrupt handler.