This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

interrups not working properly

hi,
I am new to implementing interrupts and arm 7 as well.
I have just tried one example after reading the manual as well as some post.
I have few questions about the register values.
1)How do we get the value of VICVectCntl?I read the document but it's not clear.Please can someone explain me..
VICVectCntl1 = 0x20 | 7;

2)My code ehoes the character i enter on serial port uart1 but after the character it keeps on echoing 00
eg: 06 00 00..
and i see when i debug that it executes putchar_uart1()
indefinately and does not echoes any othe character i type after the first one.
Please any suggestions would help me

//main.c
#include <stdio.h>
#include <RTL.h>
#include <LPC214x.H>
int main(void)
{
init_serial1();
printf("testing \n");
while(1);
}
//end of main

//serial.c
void init_serial1 (void)  {

  PINSEL0 = 0x00050000;
  U1LCR = 0x83;
  U1DLL = 8;         //115200 baudrate
  U1LCR = 0x03;

  /* set up the interrupts */
U1IER = 0x05;   //
VICVectAddr1 = (unsigned long) u1_interrupt;   /* set interrupt vector */
VICVectCntl1 = 0x20 | 7;
VICIntEnable = 0x00000080;   /* enable uart1 interrupts */

}

void u1_interrupt (void)
{
 char intrpt;
 intrpt = U1RBR;
 putchar_uart1( intrpt );
 U1IER = 0x00;
 VICVectAddr = 0;   /* acknowledge interrupt */
}//end u1_interrupt()

int putchar_uart1(int ch)
{
  while (!(U1LSR & 0x20));
  return (U1THR = ch);
}

Parents Reply Children
  • hi martin,
    thanks once again.I went through this example
    http://www.keil.com/download/docs/330.asp

    and one thing that is not clear to me is when is com_putchar() and com_getchar() called?
    Can i call these methods from main?when should i call these method ?How should i synchronise the interrupts and calling these functions.I don't want to use fputc.

    Please tell me the easy way of understanding it

    What I understoofd is whenever a UART1 interrupt is raised it is handled by following interrupt service routine where depending on the interrupt,
    1)the character received is inserted in the buffer if it is Character Time-Out interrupt
    2)the character is removed from the buffer and stored in u1thr register if it is thre interrupt.
    void sio_irq (void) __irq {}.

    I hope i could make myself clear.If not,please let me know.
    My main objective is
    write an interrupt routine that picks up received characters from one FIFO and puts them in the transmit FIFO for the other port (start by putting the characters into the transmit FIFO of the same port to verify that you get a perfect echo function).
    Please help

  • Hello ss dd,

    com_putchr() and com_get_char() are called via fputc() and fgetc() using retargetting. Please see file Retarget.c.

    Best Regards,
    Martin Guenther

  • hi,

    My Rx interrupt is working fine but not the thre interrupt.Please can u give me a small but complete example of how thre interrupts work