**** Advance Notice ****

This site will be closed on 31 December 2015,

Important Information for users of NXP LPCXpresso

This site is for users of Code Red branded products.

NXP LPCXpresso users should visit the LPCXpresso FAQ's for up-to-date information relevant to that product.

Programming mbed binaries onto an RDB1768v2 board

Code Red Technologies RDB1768v2 board uses the same NXP LPC1768 MCU that is used on mbed MCU board (http://mbed.org/nxp/lpc1768/).

The RDB1768v2 also implements Drag2Flash functionality which is similar in nature to mbed's USB flash drive.

This means it is possible to install binaries which have been created using the mbed online compiler onto the RDB1768v2 board and run them. Note that there are some limitations to this functionality due to the different usage of the LPC1768's pins by the mbed board and the RDB1768v2, which we will consider later.

mbed hello world

As a first example, consider the standard mbed "hello world" program, which simply flashes LED1 on the mbed board. You can download a pre-built copy of this (HelloWorld_LPC1768.bin) from:

To run this on the RDB1768v2 board, use the Drag2Flash functionality as follows.....

  1. Connect the RDB1768v2 board to your PC via the debug usb connection.
  2. The PC should open a Drag2Flash filer window

  3. Copy the required binary file from the PC's filing system into the Drag2Flash filer window

  4. Press switch SW4 on the RDB1768v2 board (located between the usb debug port and the line-out connector) to start the copy of the binary into the LPC1768's flash memory.

    If you have dragged more than one file to the board over the Drag2Flash interface, then the file with the most recent creation date will be copied. Note that by default, Windows will normally show the modified date, rather than the creation date.

  5. During the copy, the Debug LED will flash at 2Hz (rather than the normal 1Hz), and Leds2 and 3 will also periodically flash. Execution of the code will start when the copying to the LPC1768's flash memory completes.

You should now see LED7 (the red USB "goodlink" led) flashing on your RDB1768v2 board.

mbed serial hello world

A second simple mbed example is the serial port-based hello world available at:

You will need to log in to your mbed account and use the mbed online compiler in order to create a binary for this.

This program prints "hello world" out over the serial port, then echoes back any character entered in a connected terminal back, incremented by 1. On the mbed board, the serial port is connected to the PC through a "USB Virtual Serial Port" which communicates over the same USB cable that is used for programming.

On the RDB1768v2 board, the LPC1768 serial port is exposed using a real serial port connector. You will need to connect this to your PC either using a serial cable, or using a serial-USB convertor cable (depending upon whether your PC actually has a serial port). Then configure your terminal program to talk to the serial port at 9600 baud.

You should then be able to program the serial hello world application into the RDB1768v2 board using the Drag2Flash functionality.

IO differences between the mbed and RDB1768v2 boards

Although both the mbed and RDB1768v2 boards make use of the same NXP LPC1768 MCU, there are some differences in the IO configuration of the two boards.

Consider for example the 4 leds on the mbed board...

mbed Led

LPC1768 pin




LED7 USB goodlink



Not connected



Not connected



Not connected

As can be seen, as supplied only one led on the mbed board matches up to a led on the RDB1768v2 board. The other pins used for leds on the mbed board are not actually connected at all on the RDB1768v2 board (though the user can access them through the user headers).

Similarly consider the 4 "user leds" on the RDB1768v2 and the corresponding functionality on the mbed board:

RDB1768v2 Led

LPC1768 pin




Not connected










Thus if you are taking code from mbed and wanting to run it on the RDB1768v2, you will need to check how the corresponding functionality is configured on the two boards. For a more comprehensive comparison of the IO connections on the RDB1768v2 board, please see the "Mapping of peripherals to LPC1768 IO pins" in the RDB1768v2 documentation, and for mbed see the board schematic.

Writing code explicitly for RDB1768v2 with mbed tools

It is quite possible to write code using the mbed tools that makes explicit use of features available on the RDB1768v2 that are not implemented (or are implemented differently) on the mbed board itself.

For example, consider the simple case where we want to flash Led2 on the RDB1768v2. From the above table you can see that this is connected to P1.24 of the LPC1768, which is not connected on the mbed board. This means that it is not immediately obvious how to drive this using the mbed C++ libraries. However we can do this quite easily by specifying the pin directly. Thus the standard mbed "hello world" program becomes:

// Flash LED2 on RDB1768v2
#include "mbed.h"
DigitalOut myled(P1_24);  // "P1_24" was "LED1" in original code
int main() {
    while(1) {
        myled = 1;
        myled = 0;

Build this code with the mbed compiler, then use Drag2Flash to install the binary produced onto your RDB1768v2 board, and you should then see LED2 flashing.

The full list of pins and their corresponding mbed DIP pin names can be found in:


ADC Example

The RDB1768v2 has a potentiometer connected to P0.23 (which is mbed DIP pin p20). We can modify the standard AnalogIn example from the mbed handbook to read the potentiometer as follows:

// Turn on an LED when AnalogIn goes above 0.3
#include "mbed.h"
AnalogIn ain(P0_23);   // Was p20 in original mbed example
DigitalOut led(LED1);
int main() {
    while (1){
        if(ain > 0.3) {
            led = 1;
        } else {
            led = 0;

Build this code with the mbed compiler, then use Drag2Flash to install the binary produced onto your RDB1768v2 board, and you should then see LED7 go on and off as your rotate the potentiometer.

Additional References

RDB1768_mbed (last edited 2010-05-13 16:08:34 by CrSupportAb)