Skip Navigation LinksProjects > LPC2148 Reference Design > LPC2148 Code Base

LPC2148 Code Base

FreeRTOS, LPCUCB and drivers for the core peripherals on the LPC2148 MCU.

One of the biggest challenges when getting started with any MCU is simply to get the startup code written and to properly configure the device and core peripherals (SPI, I2C, UART, etc.). In order to help you get started as quickly as possible with the LPC2148, we've put together a basic project containing code for most of the main peripherals on the 2148 (SPI, I2C, UART, ADC, PWM), as well as USB (Serial/CDC only). The project also uses FreeRTOS 6.0.1 for basic task management to allow you to easily simulate a 'multi-tasking' environment, and contains a complete command-line interface ("Monitor") to allow you to easily interact with many of the on-board peripherals from terminal software like Realterm. (The command-line is accessible via either USB or through a serial connection on UART0, depending on the settings in ProjectConfig.h.)

This code is largely based on J.C. Wren's excellent LPC2148 demo code. We've moved select parts of his code into Crossworks for ARM (Crossworks is based on the GCC compiler so the code was 95% compatible), added a few additional drivers, and rewrote certain parts of the code where there were compatibility issues between newlibc and the standard library used by Crossworks.  90% of the credit for this code belongs to him for providing an exceptionally thorough and robust starting point ... and he definately has all of our gratitude!  This entire project wouldn't have been possible without his willingness to publish his own code and allow others to freely use it.  (Please note that we've upgraded certain software components where appropriate -- such as FreeRTOS -- and made additions where we thought they were useful, which may cause some compatibility issues if you are trying to merge parts of J.C. Wren's demo code into our own code base!) 

This project is still a work in progress. We will continue to add new drivers and update sections of the code as appropriate.  We've decided to make the current version available in a "beta" form simply to gauge interest, and to give people a bit of a head start with this device. If you have any comments or suggestions, please feel free to contact us since you're constructive feedback is helpful to us! 

While this software is based on our LPC2148 Reference Design, you should be able to easily adjust the code to work with any development board or project based on the LPC2100 MCU family.

Downloads

Latest Release

The latest version of the LPC2148 Code Base can be downloaded below. We also provide two pre-compiled binaries to help test the hardware out. If you don't own a JTAG debugger, you can transfer the pre-compiled files to the LPC2148 with the freely available Flash Magic. You simply need to set the ISP jumper on the board to "ON", connecting the board to your PC using UART0, reset the board, and then transfer the files via Flash Magic.

Source Code
Version Number Release Date Release Notes
Download 0.1 - BETA 15 December 2009 Initial BETA release
Pre-Compiled Binaries (Intel Hex Format)
Version Number Release Date Release Notes
Download 0.1 15 December 2009 Initial BETA Release

License

Creative Commons LicenseThis work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License. Use of this work should be attributed to: J.C. Wren (who is the original author of a large part of the core code used in the LPC2148 Code Base) and to microbuilder.eu (the current version available here for the LPC2148 Reference Design).

Supported Peripherals

The following system peripherals are supported in the latest release of the LPC2148 Code Base:

  • CPU (Set to 48MHz, Fast GPIO)
  • ADC (Analog to Digital Convertor)
  • I2C (Interrupt driven generic I2C code)
  • PWM (Pulse Width Modulator)
  • SPI (Generic SPI code)
  • UART (Interrupt driven UART code)
  • USB (Simulates a serial port over USB, defaults to 9600 Baud 8N1. Based on LPCUSB.)
Included Drivers

Drivers for the following external hardware are included in the latest release of the LPC2148 Code Base:

  • LED (Toggles an LED at a fixed rate)
  • Taos TSL2561 (TAOS TSL2561 I2C luminosity sensor)
Other Software

To help get your prototypes working with a minimum of time and effort, the LPC2148 Code Base also includes:

  • Monitor - A simple console that works over UART or USB Serial, and allows you to interact with the device using terminal software like RealTerm. (You can select whether to use UART or USB for the communication in ProjectConfig.h).  See the Getting Started with 'Monitor' tutorial for more information. 
  • FreeRTOS 6.0.1 - An open source real-time OS to simulate a multi-tasking environment.
  • uIP - An open source TCP/IP stack.  Includes a basic webserver to be able to access the LPC2148 through any web brower.
  • LPCUSB - Open source USB stack for the LPC2148.