LPCXpresso
Par Torlus, Friday 26 August 2011 à 08:55 :: Home :: #239 :: rss
In 2005, I became interested in the NXP's LPC family of ARM-based microcontrollers.
Back in the days, when PIC32 and AVR32 architectures were yet to come, being able to use such a popular 32-bit processor as a replacement to 8-bit ones looked very exciting.
I purchased a simple LPC2106 header board from Olimex and started playing with it.
Withing a few hours, the time to get yourself required stuff such as a serial cable, a MAX232, the ISP programming software, and a GCC cross-compiler, you could get ready to use it.
Debugging was another story, as projects such as OpenOCD were in early stages.
The LPC2106 was based on the ARM7TDMI core, could run as fast as 60MHz, and featured a decent set of peripherals such SPI, UART, I2C, Timers, PWM...
However, it had some drawbacks, especially the GPIO that could not be faster than 5MHz, which was quite disappointing (it has been corrected since, in later revisions of the chip).
Overall, it has been a quite good experience. However I didn't feel as it was yet ready to blow away its counterparts from the microcontrollers market.
It looked more like a microcomputer architecture crammed into a microcontroller, and probably couldn't fight on all fronts against specialized architectures.
However, time has passed since, and I thought it was the right moment to see how the LPC family has expanded...
After some research, I've decided to give a try to one of these LPCXpresso kits, featuring a NXP LPC1343 microcontroller.
You can purchase them at Farnell where they have a section dedicated to NXP products.
At a first glance, there are many thing appealing in this little device :
- You don't get one board, but TWO boards assembled together.
The first one is a header board containing the LPC1343 itself, with an 12MHz oscillator that can drive the MCU up to its 72MHz limit using the on-chip PLL.
The second one is a full-featured USB programmer and JTAG debugger, labelled LPC-Link.
- The price is pretty low, especially when you consider that you get a full featured USB programmer/debugger for that price.
- It is endorsed by NXP.
- Software support looks good. It is based on a customized version Eclipse CDT.
Eclipse sure has its pros and cons, but considering the state of the art when it comes to programming IDEs for microcontrollers, I'd say it's not a bad thing.
I just received the kit some weeks ago, let's see how thing have improved since my first attempt...
My old LPC2106 header board (top) and the LPCXpresso kit (bottom)
First, let's have a look at the hardware. It looks indeed like two seperated boards in the design, however splitting them would require to carefully cut them using a thin saw.
The target board design is straightforward : it comes in a handy DIL package, making it easy to mount on a breadboard, once you solder headers to it.
It includes a LPC1343 in LQFP-48 package, with all its I/Os exposed to the pin headers, as well as a tiny prototyping area.
Apart from the 12MHz oscillator, there's also a small LED, which can be handy if you want to quick-check that your basic board setup is OK.
The LPC-Link board is based on a LPC3154, and features regulators and bus buffers. It also includes various handy test points for the required core and peripheral voltages.
It also includes a small 10-pin JTAG header, and an USB Mini-B plug for connection to the host PC.
The only thing required to start is the proper USB cable.
Software installation went painlessly on my Windows XP host.
After the installation step, you have to activate the product, which means registering online, and get an activation code sent by e-mail.
Some examples projects can be retreived from the LPCXpresso support website, and imported into your workspace.
Just a side note for those of you that are not familiar with Eclipse : it is quite guaranteed that you'll find it cumbersome.
You'll probably going to hate it at first, as you will have to get accustomed to definitions like "perspectives", "views", "workspaces", etc.
You'll encounter one of the largest combination of drop-down menus, unbearable configuration screens and such.
But after a while, you'll find it not that bad, although the C development environnement is less advanced than its Java counterpart (for what Eclipse was designed first).
The IDE provides rather good code auto-completion, source/header files browsing, context-sensitive help, and many more.
Loading a project and debugging it opens the "Debug perspective".
On the screenshot below, you can see how it looks like.
Click here to get a full view of the debugger interface
The debugger's user interface is quite neat, and you get usual features you expect, such as code stepping, execution stack, variables and registers monitoring.
One interesting feature, as shown above, is the "Peripheral" view.
You can easily monitor peripheral register values, and value changes (highlited in yellow).
Significant bit groups within a given 32-bit register are dispalyed separately, making it easier to understand what's going on.
Apart from the IDE/compiler/debugger, Code Red has bundled some useful software libraries :
- The CMSIS library.
CMSIS stands for Cortex Microcontroller Software Interface Standard, and has been initiated by ARM.
It guarantees a common way to access core registers and peripherals, across various compilers and manufacturers, which surely isn't a bad thing.
- Two standard C libraries : Red Hat's Newlib and Code Red's Redlib.
Redlib is a stripped-down, customizable C standard library, which aims at using the less storage space possible.
Both libraries are available in three different variants. For debugging, the "semihost" one is pretty handy.
It allows you to use file I/O functions, such as "printf". In this case, "printf" will have its output sent to the debugger's console.
Now, let's have a look at the LPC1343 itself. It is based on an ARM Cortex-M3 core.
The Cortex-M3 is a specialized architecture designed for microcontrollers.
Unlike the ARM7TDMI, it features separates busses for instructions and data (Harvard architecture), as well as a system bus.
The ARM instruction set is not supported (!), and you're left with only the Thumb-2 instruction set... That's somewhat heartbreaking to me, as I loved the ARM instruction set's beautiful design.
However, it features a complete set of peripherals, including USB, I2C, GPIO, UART, ADC, Watchdogs.
There's also a very versatile SSP controller, which is (among other things) able to do SPI operations on 4-bit to 16-bit words.
It would have been very helpful at the time with my silly custom handheld console project.
The LCD controller used a weird 9-bit words serial interface, so the LPC2106's SPI controller wasn't able to handle it, and I had to use GPIO to make it work.
It would be probably worth giving it another try with this new device...
In conclusion, I've been pretty impressed by the way things have evolved since my first attempt.
The LPCXpresso hardware is great, having a full-featured programmer/debugger as well as an evaluation board at that price is very neat.
Software support is very good. "At last", I'd say.
In my opinion, while the importance of software has been understood by many industries in the computing field, it seemed that microcontrollers-related software offerings were far outdated.
That's probably the main reason why Arduino stuff is so successful... Nothing really new on the hardware side, but an innovative way to deal with software development.
I'm glad to see that the "dark" days are now gone, and I'm pretty excited by what I've seen so far.
I have yet to see what PIC32 and AVR32 are worth (both on hardware and software sides), but NXP has already set the bar very high...

Commentaires
Aucun commentaire pour le moment.
Ajouter un commentaire
Les commentaires pour ce billet sont fermés.