Advertisement

Quick Links

AN10548
Getting started with LPC288x
Rev. 01 — 8 January 2007
Document information
Info
Content
Keywords
LPC2880, LPC2888, Flash, Interrupt handling, Timer, CGU
Abstract
This application note provides code examples for the various peripherals
of the LPC288x. This application note also makes an attempt to draw a
comparison of the LPC288x with the other devices of the LPC2000 family
Application note

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the LPC288 Series and is the answer not in the manual?

Questions and answers

Summary of Contents for NXP Semiconductors LPC288 Series

  • Page 1 AN10548 Getting started with LPC288x Rev. 01 — 8 January 2007 Application note Document information Info Content Keywords LPC2880, LPC2888, Flash, Interrupt handling, Timer, CGU Abstract This application note provides code examples for the various peripherals of the LPC288x. This application note also makes an attempt to draw a comparison of the LPC288x with the other devices of the LPC2000 family...
  • Page 2 AN10548 NXP Semiconductors Getting started with LPC288x Revision history Date Description 20070108 Initial version Contact information For additional information, please visit: http://www.nxp.com For sales office addresses, please send an email to: salesaddresses@nxp.com AN10548_1 © NXP B.V. 2007. All rights reserved.
  • Page 3: Introduction

    AN10548 NXP Semiconductors Getting started with LPC288x 1. Introduction The LPC288x (LPC2880/LPC2888) includes an ARM7TDMI CPU with an 8 kB cache. The LPC2888 includes a 1 MB Flash memory system. It has an on-chip DC-to-DC converter that can generate the required voltages from a single battery or from USB power.
  • Page 4: Basic Startup Code

    AN10548 NXP Semiconductors Getting started with LPC288x 2. Basic startup code The startup assembly code for the LPC288x is similar to the other LPC2000 devices since it is also based on the ARM7TDMI-S architecture. One has to of course take into...
  • Page 5: Port Pins

    AN10548 NXP Semiconductors Getting started with LPC288x 3. Port pins The LPC288x has 89 GPIO pins that are split into 8 ports (Port0 to Port7). Some major differences in the port structure are as follows: 1. In other LPC2000 devices all the port pins were initialized to their GPIO configuration on reset.
  • Page 6: Code Example

    AN10548 NXP Semiconductors Getting started with LPC288x 2. Selection stage registers: a. Use the respective Frequency Select register to select one of the 7 input clocks. b. The Switch Configuration and Switch Status registers would be typically used while dynamic clock switching (shown below with an example).
  • Page 7 AN10548 NXP Semiconductors Getting started with LPC288x /* Selection stage- UART */ UARTSCR=0x1; /* Enables Side 1 of selection stage */ UARTFSR1=0x1; /* Select the clock source as the 12MHz crystal */ /**************************************************************** * Switching clocks between 60MHz and 32.768KHz osc. input * Parameter 's' has a defined value.
  • Page 8 AN10548 NXP Semiconductors Getting started with LPC288x U0_LCR = 0x3; /* Read the Switch status register to check * which side of the stage is enabled temp=UARTSSR; if(temp & 1) /* Set the clock on Side 2 */ UARTFSR2=new_clk; /* Write to the Switch Configuration register */ UARTSCR=(temp &...
  • Page 9 AN10548 NXP Semiconductors Getting started with LPC288x i++; U0_THR=CARRIAGE_RET; U0_THR=LINE_FEED; while(!(U0_LSR & TEMT)){} i=0; /**************************************************************** MAIN **************************************************************** int main(void) /* Characters arrays */ char lpc[]="LPC288x"; char a[]="+++++++++++++++++++++++++++++++++++++"; char b[]="-------------------------------------"; char uart_12[]="UART Running from 12MHz Oscillator"; char uart_pll[]="UART Running from Main PLL";...
  • Page 10 AN10548 NXP Semiconductors Getting started with LPC288x printP(uart_pll,1); printP(lpc,5); printP(b,1); /* Switching to 32.768KHz and configuring the UART dividers for the same */ switch_clk(2); /* Printing characters */ printP(uart_32,1); printP(lpc,5); printP(b,1); See Fig 1 for sample output. Fig 1. Sample output AN10548_1 ©...
  • Page 11: Interrupt Handling (Using The Cache And Timer0)

    AN10548 NXP Semiconductors Getting started with LPC288x 5. Interrupt handling (using the cache and Timer0) Interrupt handling in the other LPC2000 devices was handled by the Vectored Interrupt Controller (VIC) and it is different than the interrupt controller in the LPC288x. The main difference between the two controllers is that there was a provision in the VIC to insert an Interrupt Vector Table (IVT) within the VIC itself.
  • Page 12: Cache And Interrupt Vector Table (Ivt) Configuration

    AN10548 NXP Semiconductors Getting started with LPC288x Fig 3. Interrupt sources 5.3 Cache and Interrupt Vector Table (IVT) configuration While programming interrupts for the LPC288x the following should be considered: 1. Cache configuration: There is no memory residing at 0x0. In other LPC2000 devices, the on-chip flash always existed from 0x0.
  • Page 13: Simple Interrupt Handling

    AN10548 NXP Semiconductors Getting started with LPC288x Fig 4. Interrupt vector table As shown in Fig 4, each interrupt source has 2 entries in the IVT. The first entry is the address of the ISR and the second entry has the priority level of the interrupt source that can interrupt this particular interrupt.
  • Page 14: Code Example

    AN10548 NXP Semiconductors Getting started with LPC288x 2. The ARM7 core would execute the instruction that resides at 0x18, which would be a jump to a top-level handler that would read the INT_VECTOR0 register and then jump to the ISR.
  • Page 15 AN10548 NXP Semiconductors Getting started with LPC288x ENTRY ; First instruction to be executed which would jump to a ; section of assembly code with entry point as “reset”. Here ; the SP is set for the IRQ mode and the Supervisor mode.
  • Page 16: C Code

    AN10548 NXP Semiconductors Getting started with LPC288x 5.5.2 C code /* Header file and other macro definitions*/ #include"LPC288x.h" #define MASK_INDEX 0xFFFFF800 /* Mask bits for Index bits in the INT_VECTOR0 register*/ #define TABLE_BASE 0x40D000 /* Base address of IVT */...
  • Page 17 AN10548 NXP Semiconductors Getting started with LPC288x MODE0S_2=0xF; for(m=0;m<10000;m++){} /****************** Top Level ISR ************************* * This function will be called from 0x18 (IRQ vector). * Here, the INT_VECTOR0 register would be read, which will * have the ISR address of Timer0...
  • Page 18 AN10548 NXP Semiconductors Getting started with LPC288x ********************************************************* void install_handler(int ind,void (* f )(), int pr) unsigned int * temp; /* Use the Interrupt source number to index to the ISR address entry from base address*/ temp=(unsigned int *)(TABLE_BASE |(ind<<3));...
  • Page 19: Flash Programming

    AN10548 NXP Semiconductors Getting started with LPC288x 6. Flash programming The LPC2888 has a 1 MB on-chip Flash system, which can be programmed either via the USB interface or via the user application itself. Both these interfaces are different considering the other LPC2000 devices. LPC2000 devices can be programmed via the UART or via the bootloader IAP interface.
  • Page 20: Signature For Valid User Code

    AN10548 NXP Semiconductors Getting started with LPC288x Fig 6. Flash programming steps The details on how to use the flash memory controller registers are explained in the LPC288x User Manual. 6.2 Signature for valid user code In LPC2000 devices, in an attempt to execute user code, the on-chip bootloader disables the overlaying of the interrupt vectors from the boot block (on reset), then checksums the interrupt vectors in Sector 0 of the flash.
  • Page 21: C Code

    AN10548 NXP Semiconductors Getting started with LPC288x In LPC2888, if port pins P2.2 and P2.3 are left unconnected then the device enters Mode 0, which would be an attempt to execute user code from the internal flash. The bootloader would then check for a signature, which would reside at 0x104F F800. This signature or marker would be 0xAA55 AA55.
  • Page 22 AN10548 NXP Semiconductors Getting started with LPC288x #include"LPC288x.h" /*-------------------- MAIN --------------------- */ void C_entry() volatile unsigned char * FlashMemoryPointer; volatile unsigned int * LatchPointer; volatile unsigned int * Ramptr; unsigned int * Patch; unsigned int sec_size=0; int counter; /****** Flash Clock setup ******/ /* The Flash module needs a 66KHz clock so the value set in the F_CLK_TIME register is 60 F_CTRL = (FS_WEB | FS_CS);...
  • Page 23 AN10548 NXP Semiconductors Getting started with LPC288x /* Setting pointer for latches */ LatchPointer = (unsigned int *) FLASH_IMAGE_BASE; /****** Sector 0 ********/ while(sec_size<=0xFFFF) /* Wait for Flash to be ready */ while (( F_STAT & FS_RDY) != FS_RDY) { } /* Setting pointer for RAM buffer */ Ramptr= (unsigned int *) RAM_BUFFER_BASE;...
  • Page 24: Legal Information

    Notice: All referenced brands, product names, service names and trademarks are property of their respective owners. Right to make changes — NXP Semiconductors reserves the right to make changes to information published in this document, including without limitation specifications and product descriptions, at any time and without notice.
  • Page 25: Table Of Contents

    AN10548 NXP Semiconductors Getting started with LPC288x 8. Contents Introduction ............3 Basic startup code ..........4 Port pins...............5 Code example ............5 Clock Generation Unit (using UART) ....5 Basic configuration ..........5 Code example ............6 Interrupt handling (using the cache and Timer0) ................11 Basic configuration ..........11...

This manual is also suitable for:

Lpc2888

Table of Contents