Hi
I am trying to receive bytes from UART0 and UART1 in Interrupt mode. I am enabling UART0 and UART1 Interrupt by the following code:
void initUART1_Intp(void) {
VICVectAddr0 = (unsigned long)U1ISR; //Set UART1 ISR Vector Address VICVectCntl0 = 0x20 |7; //Enable Slot, Set Channel 7 VICIntEnable = 0x80; //Enable Int UART1
U1IER = 0x01; //Enable the RDA interrupt }
void initUART0_Intp(void) {
VICVectAddr1 = (unsigned long)U0ISR; //Set UART0 ISR Vector Address VICVectCntl1 = 0x20 |6; //Enable Slot, Set Channel 6 VICIntEnable = 0x40; //Enable Int for UART0
U0IER = 0x01; //Enable the RDA(Rx Data Available) interrupt }
Is there any problem with this code specially at the last lines (U1IER = 0x01; ) and U0IER = 0x01;
My program is stopping here. Its not going after this statement.
Please help.
Don't play with any U<n>IER in the interrupt handler.
You should look at I<n>IIR to check what the interrupt handler is expected to do, so you know if you should read U<n>LSR, U<n>RBR, U<n>MSR or if maybe you should feed a character to U<n>THR (if you have anything to send).
Don't use a single byte and a flag for receiving data. If you can only handle a single character at a time, then it isn't really meaningful with interrupts since the main loop must still poll for that single character before it gets overwritten. Do change to a standard ring buffer where the ISR updates the insert position and the main loop processes characters until the read position reaches the insert position.
I<n>IIR should of course be U<n>IIR.