Reply by Mircea Stanciu June 18, 20082008-06-18
I see the problem. Thank you all for good answers.

Not case for RDA.
Sometimes I miss some small details in that PDF :)

Well I am going to continue my project.

--- In l..., Gabriel CULINCO
wrote:
>
> Use IIR_CTI because sending only one character at a time you will
have "character time out".
> Use UIIR_RDA to see if your stack is full and then read it.
> I hope this help you.
> Gabi
> ----- Original Message ----
> From: Mircea Stanciu
> To: l...
> Sent: Tuesday, June 17, 2008 2:23:30 AM
> Subject: [lpc2000] LPC2378 UART IRQ problem
> I have interrupt active on UART1 RX and TX
>
> U1IER = 0x7
>
> TX works perfectly!
>
> I wanted to implement RX interrupt.
>
> The program never goes to "case UIIR_RDA" when i press something on
> terminal. The handle_uart1_ irq is triggered when i press something on
> terminal but the register U1IIR remain unchanged.
>
> I have no debug methods :(, only to set some status to see on serial.
>
> __irq __nested __arm void handle_uart1_ irq (void)
> {
> volatile BYTE bRX;
> volatile BYTE bDummy = 0x00;
> volatile DWORD dwIrqIdentify;
> volatile DWORD dwIrqPending;
> volatile DWORD dwUIIR;
>
> /* mask only interrupt identification bits */
> dwUIIR = U1IIR;
> dwIrqIdentify = (dwUIIR >> 1)&0x00000007;
> dwIrqPending = dwUIIR & 0x00000001;
>
> /* line status */
> //BYTE bLineStatus = U1LSR;
>
> switch( dwIrqIdentify )
> {
> /* transmit holding register empty */
> case UIIR_THRE:
> ...
> break;
>
> /* receive data available */
> case UIIR_RDA:
> bRX = U1RBR;
> pEvent->enqueue( EVENT_DEMO2) ;
>
> break;
>
> /* receive line status */
> case UIIR_RLS:
> pEvent->enqueue( EVENT_DEMO2) ;
> /* line errors - dummy read to clear irq */
> bDummy = U1LSR;
> break;
>
> /* character timeout indicator */
> case UIIR_CTI:
> pEvent->enqueue( EVENT_DEMO2) ;
> /* line errors - dummy read to clear irq */
> bDummy = U1RBR;
> break;
>
> case UIIR_MI:
> pEvent->enqueue( EVENT_DEMO2) ;
> bDummy = U1MSR;
> break;
>
> default:
> break;
> }
>
> /* acknowledge interrupt */
> VICADDRESS = 0x00000000;
> return;
> }
>
>
>
>
>
>

An Engineer's Guide to the LPC2100 Series

Reply by Gabriel CULINCO June 17, 20082008-06-17
Use IIR_CTI because sending only one character at a time you will have "character time out".
Use UIIR_RDA to see if your stack is full and then read it.
I hope this help you.
Gabi
----- Original Message ----
From: Mircea Stanciu
To: l...
Sent: Tuesday, June 17, 2008 2:23:30 AM
Subject: [lpc2000] LPC2378 UART IRQ problem
I have interrupt active on UART1 RX and TX

U1IER = 0x7

TX works perfectly!

I wanted to implement RX interrupt.

The program never goes to "case UIIR_RDA" when i press something on
terminal. The handle_uart1_ irq is triggered when i press something on
terminal but the register U1IIR remain unchanged.

I have no debug methods :(, only to set some status to see on serial.

__irq __nested __arm void handle_uart1_ irq (void)
{
volatile BYTE bRX;
volatile BYTE bDummy = 0x00;
volatile DWORD dwIrqIdentify;
volatile DWORD dwIrqPending;
volatile DWORD dwUIIR;

/* mask only interrupt identification bits */
dwUIIR = U1IIR;
dwIrqIdentify = (dwUIIR >> 1)&0x00000007;
dwIrqPending = dwUIIR & 0x00000001;

/* line status */
//BYTE bLineStatus = U1LSR;

switch( dwIrqIdentify )
{
/* transmit holding register empty */
case UIIR_THRE:
...
break;

/* receive data available */
case UIIR_RDA:
bRX = U1RBR;
pEvent->enqueue( EVENT_DEMO2) ;

break;

/* receive line status */
case UIIR_RLS:
pEvent->enqueue( EVENT_DEMO2) ;
/* line errors - dummy read to clear irq */
bDummy = U1LSR;
break;

/* character timeout indicator */
case UIIR_CTI:
pEvent->enqueue( EVENT_DEMO2) ;
/* line errors - dummy read to clear irq */
bDummy = U1RBR;
break;

case UIIR_MI:
pEvent->enqueue( EVENT_DEMO2) ;
bDummy = U1MSR;
break;

default:
break;
}

/* acknowledge interrupt */
VICADDRESS = 0x00000000;
return;
}


Reply by mjames_doveridge June 17, 20082008-06-17
> Unless you are a very, very fast typist, or you have a very, very low
> baud rate, I would be amazed if the RBR interrupt ever fired. CTI
> will go off first.
>
> I get no RBR with a human terminal interface. To get RBR, I have to
> run a protocol from the PC that sends many characters at full speed.
>
> Rgds,
> Martin
>
Folllow-up:

CTI is not a case of /* line errors - dummy read to clear irq */

Read user manual about CTI: it is not an error condition.

Rgds,
Martin

Reply by mjames_doveridge June 17, 20082008-06-17
--- In l..., "Mircea Stanciu" wrote:
>
> I have interrupt active on UART1 RX and TX
>
> U1IER = 0x7
>
> TX works perfectly!
>
> I wanted to implement RX interrupt.
>
> The program never goes to "case UIIR_RDA" when i press something on
> terminal. The handle_uart1_irq is triggered when i press something on
> terminal but the register U1IIR remain unchanged.
>

Unless you are a very, very fast typist, or you have a very, very low
baud rate, I would be amazed if the RBR interrupt ever fired. CTI
will go off first.

I get no RBR with a human terminal interface. To get RBR, I have to
run a protocol from the PC that sends many characters at full speed.

Rgds,
Martin

Reply by Mircea Stanciu June 17, 20082008-06-17
I have interrupt active on UART1 RX and TX

U1IER = 0x7

TX works perfectly!

I wanted to implement RX interrupt.

The program never goes to "case UIIR_RDA" when i press something on
terminal. The handle_uart1_irq is triggered when i press something on
terminal but the register U1IIR remain unchanged.

I have no debug methods :(, only to set some status to see on serial.

__irq __nested __arm void handle_uart1_irq (void)
{
volatile BYTE bRX;
volatile BYTE bDummy = 0x00;
volatile DWORD dwIrqIdentify;
volatile DWORD dwIrqPending;
volatile DWORD dwUIIR;

/* mask only interrupt identification bits */
dwUIIR = U1IIR;
dwIrqIdentify = (dwUIIR >> 1)&0x00000007;
dwIrqPending = dwUIIR & 0x00000001;

/* line status */
//BYTE bLineStatus = U1LSR;

switch( dwIrqIdentify )
{
/* transmit holding register empty */
case UIIR_THRE:
...
break;

/* receive data available */
case UIIR_RDA:
bRX = U1RBR;
pEvent->enqueue(EVENT_DEMO2);

break;

/* receive line status */
case UIIR_RLS:
pEvent->enqueue(EVENT_DEMO2);
/* line errors - dummy read to clear irq */
bDummy = U1LSR;
break;

/* character timeout indicator */
case UIIR_CTI:
pEvent->enqueue(EVENT_DEMO2);
/* line errors - dummy read to clear irq */
bDummy = U1RBR;
break;

case UIIR_MI:
pEvent->enqueue(EVENT_DEMO2);
bDummy = U1MSR;
break;

default:
break;
}

/* acknowledge interrupt */
VICADDRESS = 0x00000000;
return;
}