Yahoo Groups archive

Lpc2000

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

Message

Re: [lpc2000] Re: UART1 for LPC2148

2006-02-24 by Bertrik Sikken

I think the baudrate is incorrect.
The divisor that you're using now does not make sense to me
(looks like a bug in the baudrate calculation program).
Try 78 for U1DLL (calculated from PCLK/(16*baudrate))
and set U1FDR to 0.

Bertrik

dodge1955 wrote:
> Bertrik and Guille,
> 
> Here is my new code.  Still doesn't work right.  I've even tweaked the
> MULVAL and DIVVAL numbers to better match the 12Mhz at 9600 baud.  It
> doesn't come out perfect with a 12Mhz clock.  P0.8 blinks like mad,
> but still no data out on 9600 PROCOMM.  PROCOMM works great directly
> to my 9600 baud display.  But can't get it to work thru the 2148
> chip's UART1.  Am I still missing something?
> 
> Sutton - dodge55
> 
> PINSEL0 |= 0x00010000;
> PCONP |= 0x00000010;
> U1FDR = 0x0000009A;          // MULVAL = 9, DIVVAL = 10
> U1LCR = 0x83;                   // enable Divisor Latches
> U1DLM = 0;
> U1DLL = 0x25;                   // 9601.71 baud
> U1LCR = 0x03;                // 8 bits, 1 stop, no parity, DLAB = 0
> U1FCR = 1;
> U1TER = 0x80;
> U1IER = 0;
> 
> 
> 
> void my_putchar(char c)
> {
>    if ((U1LSR & 0x20) != 0)      // TX buffer empty
>    {
>       U1THR = c;
>    }
> }
> 
> 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]);
>    }
> }
> 
> 
> 
> 
> 
> 
> --- In lpc2000@yahoogroups.com, "dodge1955" <sutton@...> 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,
>> 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.
>>
>> 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;
>> }
>>
>> void uart1_out(void) __irq
>> {
>>    VICVectAddr = 0;
>> }

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.