Sutton: try making sure you have room in the transmit buffer before
sending a character:
void my_putchar(char c)
{
while(!(U0LSR & 0x20));
U0THR = c;
}
This is my setup code:
PCONP |= PCONP_PCUART0;
PINSEL0 = (PINSEL0 & 0xfffffffc) | 0x00000001; // TX only
U0LCR = 0x83; // 8 bits, no Parity, 1 Stop bit, DLAB = 1
U0DLL = UART0_DIV_LOW;
U0DLM = UART0_DIV_HIGH;
U0LCR = 0x03; // DLAB = 0
U0IER = 0x00; // No interrupts
U0FCR = 0x01; // Use FIFO
U0TER = 0x80; // Transmitter enabled
Hope this helps.
Guille
--- In lpc2000@yahoogroups.com, Bertrik Sikken <bertrik@...> wrote:
>
> 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
>Message
Re: UART1 for LPC2148
2006-02-24 by Guillermo Prandi
Attachments
- No local attachments were found for this message.