Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: [lpc2000] UART1 for LPC2148

2006-02-24 by Bertrik Sikken

dodge1955 wrote:
> I'm having a problem with getting UART1 to work on my Embedded Artists
> prototype board.  I have a serial display that has only 1 serial line.
> In other words, you can only transmit to the display.  I can't get
> P0.8 (UART1 TX) to send any data.  Here is my setup at 9600.  And,

You need to set bit 7 (DLAB) of the LCR before setting the
divider.

> another question is 'Do I really need an interrupt just to transmit?
> It seems like throwing a char out to U1THR should suffice.  It's
> probably something simple I'm missing.  Thanks.

No, I think you don't need an interrupt.

Another thing, although the bit for UART1 in the PCONP register
is supposed to default to 1, I would verify that it is
_really_ set.

> 
> Sutton - dodge55
> 
> 
> VICIntSelect = 0;
> VICVectAddr2 = (unsigned int) uart1_out;
> VICVectCntl2 = 0x20 | 7;  // enables the UART1 interrupt, slot 7
> U1FDR = 0x00000010;   // MULVAL = 1, DIVVAL = 0
> U1DLM = 0;
> U1DLL = 0x48;      // 9600 baud
> U1LCR = 0x03;     // 8 bits, 1 stop, no parity, DLAB = 0
> U1FCR = 1;
> VICIntEnable |= 0x00000080;
> 
> void display_write(char text[])
> {
>    unsigned char i;
> 
>    sprintf(display_output, "%s", text);
>    for (i = 0; i < strlen(display_output); i++)
>    {
>       my_putchar(display_output[i]);
>    }
> }
> 
> void my_putchar(char c)
> {
>    U1THR = c;
> }

I think it would be wise to check if the UART is able to accept the
character. You can do this by checking that bit 5 or 6 of the LSR.

> 
> void uart1_out(void) __irq
> {
>    VICVectAddr = 0;
> }

Regards,
Bertrik

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.