Yahoo Groups archive

Lpc2000

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

Thread

LPC2106 UART0

LPC2106 UART0

2004-10-17 by mike robins

I purchased an LPC2106 board from olimex with a 14.7456 MHz crystal.
I'm having a very difficult time getting the serial port to work and output to the screen.
I'm trying to transmit at 57600,8,1,n.
The mcu osc is set up for 4 times the crystal.
I programmed the board with a precompiled uart program that echos characters back, and it worked fine, so the connections are good and the uc works.
 
Here is the code:
 
#include <C:\GNUARM\bin\lpc210x.h>
 
int main(void);
void Init(void);
void Delay (unsigned long a); 
 
int main(void)
{
 Init();     //Initialize clock
  IODIR=0x000000080;           //P0.7 is output(LED)
     
  //Setup UART
  PCONP &= 0x08;
  UART0_IER = 0x00;
  UART0_LCR = 0x80;
  UART0_DLL = 0x20;
  UART0_DLM = 0x00;
  UART0_LCR = 0x03;
  UART0_FCR = 0x07;
 while (1) 
    {
  // flash LED
   IOCLR |= 0x00000080;                    //LED on
      Delay(100000);
      IOSET |= 0x00000080;                     //LED off
      Delay(100000);           
   
  // Transmit Hi
  while((UART0_LSR & 0x40) == 0){}
   UART0_THR = 'H';
  while((UART0_LSR & 0x40) == 0){}
   UART0_THR = 'i';
 } 
}

void Init(void)
{
 // Init PLL
    PLLCFG=0x23;                 // P=2, M=4, PLLfreq = 235,9296 Mhz, CCLK = 58,9824 Mhz
    PLLFEED=0xAA;     // 14.7456MHz
 PLLFEED=0x55;   
    PLLCON=0x01;                 // Enable the PLL
    PLLFEED=0xAA;
 PLLFEED=0x55;
    while(!(PLLSTAT & 0x0400)){}  // Wait for PLL to lock
    PLLCON=0x03;                 // Connect PLL as clock source
    PLLFEED=0xAA;
 PLLFEED=0x55;   
    //Init MAM & Flash memory fetch
 MAMTIM=0x07;
 MAMCR=0x00;
 MAMMAP=0x01;
    VPBDIV=0x01;                 //pclk = cclk
}
void Delay (unsigned long a)
{
    while (--a!=0){}
}
 
 
The code flashes the LED but "Hi" is not sent???
Any help would be greatly appreciated.

		
---------------------------------
Do you Yahoo!?
vote.yahoo.com - Register online to vote today!

[Non-text portions of this message have been removed]

Re: [lpc2000] LPC2106 UART0

2004-10-17 by Robert Adsett

At 09:52 AM 10/17/04 -0700, you wrote:
>I purchased an LPC2106 board from olimex with a 14.7456 MHz crystal.
>I'm having a very difficult time getting the serial port to work and 
>output to the screen.
>I'm trying to transmit at 57600,8,1,n.
>The mcu osc is set up for 4 times the crystal.
>I programmed the board with a precompiled uart program that echos 
>characters back, and it worked fine, so the connections are good and the 
>uc works.

It doesn't look like you've set up the UART pins (PINSEL0)

Robert

" 'Freedom' has no meaning of itself.  There are always restrictions,
be they legal, genetic, or physical.  If you don't believe me, try to
chew a radio signal. "

                         Kelvin Throop, III

Re: LPC2106 UART0

2004-10-17 by mkrbns

Okay it works now.  Thank you.

--- In lpc2000@yahoogroups.com, Robert Adsett <subscriptions@a...> 
wrote:
> At 09:52 AM 10/17/04 -0700, you wrote:
> >I purchased an LPC2106 board from olimex with a 14.7456 MHz 
crystal.
> >I'm having a very difficult time getting the serial port to work 
and 
> >output to the screen.
> >I'm trying to transmit at 57600,8,1,n.
> >The mcu osc is set up for 4 times the crystal.
> >I programmed the board with a precompiled uart program that echos 
> >characters back, and it worked fine, so the connections are good 
and the 
> >uc works.
> 
> It doesn't look like you've set up the UART pins (PINSEL0)
> 
> Robert
> 
> " 'Freedom' has no meaning of itself.  There are always 
restrictions,
> be they legal, genetic, or physical.  If you don't believe me, try 
to
Show quoted textHide quoted text
> chew a radio signal. "
> 
>                          Kelvin Throop, III

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.