You are viewing an older revision! See the latest version

Prototype To Hardware

Introduction

There has been a lot of questions in the forum about just how easy it would be to move forward from an mbed Microcontroller to actually use the target MCU (NXP LPC1768), avoiding the need to design in £30+ modules

Before showning just how easy it can be, there are a couple of points to make clear:

  • You can use the mbed libraries commercially for free, on an unsupported as-is basis
  • The mbed compiler generates a raw binary targetting the MCU, there is no bootloader magic going on inthe binary
  • The binary runs on the LPC1768 bare metal, there is no runtime environment
  • The only magic taking place on the mbed Microcontroller is the "mbed Interface" - It's not actually all that magic, it is just a USB device that can program the raw binary into the LPC1768s flash memory So with that in mind it should be clear that if you wish to take your design to the next stage you can spin your own PCB, solder down the LPC1768 and reuse the binary you made with your mbed Microcontroller prototype, you can.

The purpose is to show you how you can get your binary into the LPC1768 on your own PCB, and what other things you can do.

mbed Prototype

The first thing to do is write a (very) simple program that prints "hello world!" to hyperterminal, and flashes and LED forever. I'll do this on an mbed module first, and then attempt to port it to an LPC1768 on an custom PCB.

I'm driving both ends of the LED as I have a PCB for an LPC1768 that i can port the binary to as an experiment, and doing the double ended driving is the simplest way.

Here is the code :

#include "mbed.h"

Serial pc (USBTX,USBRX);

DigitalOut ledA(p26);
DigitalOut ledK(p24);

int main() {

    pc.printf("Hello world!\n");

    ledK = 0;

    while(1) {
        ledA = 1;
        wait(0.2);
        ledA = 0;
        wait(0.2);
    }
} 

Here is the result :

Teraterm OutputThe hardware
/media/uploads/chris/mbed-hello-world.png/media/uploads/chris/mbed-led.jpg

All wikipages