Home LPC2000 LPC2148 LPC-P2148 Board

Main Menu

LPC-P2148 Board
Article Index
LPC-P2148 Board
SPI and LED Display
RS232
LCD (4-Bit)
PWM and A/D
Simple RTC Clock
Interrupts
Servo with PWM
All Pages

thumbIt's been a while since I updated anything here. I left PICs temporarily and played with TI MSP430's for a while. Now I'm tinkering with ARM7's. I ordered an Olimex LPC-P2148 board from Optimal Microsystems to learn with. Nice board.

I bought an Olimex ARM-USB-TINY, also from Optimal Microsystems, for programming and debugging.

At first I had no success getting Eclipse with the yagarto GCC toolchain working with the ARM-USB-TINY, so I downloaded Crossworks for ARM by Rowley Associates. Crossworks is a very nice IDE and debugger that uses the GCC toolchain, and it works great with the ARM-USB-TINY. A "Personal License" is only $150. I ran the 30-day demo till it expired.

 

Then I switched to Eclipse/yagarto with OpenOCD. Took some time to get it working, but it works. I'll probably stick with it now.

 

Here's a look at the Olimex LPC-P2148 board (left), and the ARM-USB-TINY (right).

LPC-P2148 Board ARM-USB-TINY

 

Here I'm using the Predko 2-Wire LCD circuit with two pins of the LPC2148. Works just fine. I ported the C code from my PIC 16F88 source.

LPC2148 w/LCD LCD Closeup

 

I'll be posting my little newb demo programs for the LPC-P2148 here as I learn stuff. To start, here's a little program that makes horrible noises and flashes the LEDs when you push the buttons on the board:

 

Buttons, LEDs and Piezo Beeper

#include "LPC214x.h"
#define PLOCK 0x400
void init(void);
void feed(void);

int main(void)
{
int i,j;
init();
IODIR0 |= 0x00003c00; //set pin directions
IOSET0 = 0x00001c00; //LEDs off, piezo bits prepped
IOCLR0 = 0x00002000;
while(1){
if((IOPIN0 & 0x00008000) == 0){ //button 1 pressed?
for(i=100;i<2500;i+=5){ //annoying ascending tones
IOPIN0 ^= 0x00003000;
for(j=0;j<i;j++);
}
IOPIN0 ^= 0x00000400; //blink LED 1
}
else if((IOPIN0 & 0x00010000) == 0){ //button 2 pressed?
for(i=2500;i>100;i-=5){ //annoying descending tones
IOPIN0 ^= 0x00003000;
for(j=0;j<i;j++);
}
IOPIN0 ^= 0x00000800; //blink LED 2
}
}
}

void init(void)
{
PLLCFG=0x24; //set multiplier/divider values
PLLFEED=0xaa;
PLLFEED=0x55;
PLLCON=0x01; //enable PLL
PLLFEED=0xaa;
PLLFEED=0x55;
while(!(PLLSTAT & PLOCK)); //wait for the PLL to lock to set frequency
PLLCON=0x3; //connect the PLL as the clock source
PLLFEED=0xaa;
PLLFEED=0x55;
MAMCR=0x02; //enable MAM
MAMTIM=0x04; //set number of clocks for flash memory fetch
VPBDIV=0x01; //set peripheral clock(pclk) to system clock(cclk)
}