DipCortex - Getting Started with mbed

NOTE : Page Moved

We have now moved this wiki to the team page here : https://mbed.org/teams/Solder-Splash/wiki/DipCortex-Getting-Started-with-mbed

NOTE : Page Moved

DipCortex

The DipCortex boards use NXP LPC11U24 (M0) and LPC1347 (M3) and are available from http://www.soldersplash.co.uk

Unlike the mbed boards there is no Uart to USB on the DipCortex, Instead you can use the USBDevice library to send serial data over USB.

Updating the WiFi DipCortex Firmware

The DipCortex boards have a built in mass storage boot-loader, this appears as drive when connected to your PC. To update the firmware first you need to get the DipCortex into bootloader mode. Attach it to the your PC via USB while holding the boot button. Delete the "firmware.bin" on the drive and copy over the new .bin file compiled on mbed.

NOTE : Linux and MAC OSX may not copy over the file in the way the NXP bootloader expects, if you have a problem updating the board using Linux or MAC OSX please refer to these app notes :

http://www.nxp.com/documents/software/AN11305.zip

http://www.nxp.com/documents/application_note/AN10986.pdf

DipCortex Pin Out

Can be found here :

WiFi : http://www.soldersplash.co.uk/products/wifi-dipcortex/

M3/M0 : http://www.soldersplash.co.uk/products/dipcortex/

The Standard DipCortex M3/M0 has two buttons and two LEDs, One LED is shared with the boot button on P0_1, the LED is active when the pin is driven high. To use the button, set the pin as an input with the pull up enabled, when pressed the PIN will read a zero.

The second LED ins on PIN21 - P1_22 it is active low, drive the output low to enable the LED.

The WiFi DipCortex only has space for the one LED which again it shares the same PIN as the button on P0_1.

LEDs

#include "mbed.h"

// WiFi DipCortex has 1 LED shared with the button on P0_1
DigitalOut Led(P0_1);

// DipCortex has 2 LEDs P0_1 and P1_22
DigitalOut Led2(P1_22);

int main()
{
    while(1)
    {
        Led2 = !Led2;
        Led = !Led;
        wait_ms(250);
    }
}

Button

The boot button on the DipCortex can be used in your code, it is attached to the boot pin P0_1

The button requires an internal pull up to be enabled :

DigitalIn Button(P0_1);
Button.mode(PullUp);

EEprom

The DipCortex has 4KB of non volatile EEprom that can be used to store data, this example shows you how to use it

Import programDipCortex-USB-EEProm

DipCortex USB CDC + EEprom

Tips

The DipCortex's, LPC11U24/401 and LPC1347 have extra banks of RAM that mbed by default does not use. But if enabled you can in your application. DipCortex WiFi, M3 and M0 has a RAM bank called USBSRAM located at 0x20004000 to 0x20004800. DipCortex WiFi and M3 has a second RAM bank again 2KB is size called RAM1 Located at 0x20000000 to 0x20000800.

To make use of it you need to enable power to each RAM bank as follows :

// RAM1 - M3 & WiFi
LPC_SYSCON->SYSAHBCLKCTRL |= 0x1 << 26;
// USBSRAM - M3, WiFi & M0
LPC_SYSCON->SYSAHBCLKCTRL |= 0x1 << 27;

Note that USBSRAM is used by the USBDevice library.

Mbed's library uses slightly different names for the banks depending on the processor selected. To tell the linker to place a variable into a certain RAM bank you can do the following :

// DipCortex M3
char tmpBuffer[512] __attribute__((section("AHBSRAM0"))); // RAM1
char tmpBuffer[512] __attribute__((section("AHBSRAM1"))); // USB RAM

// DipCortex M0
char tmpBuffer[512] __attribute__((section("USBRAM"))); // USB RAM

Example Projects

Projects that implement USB CDC require a driver, which you can find here : http://www.soldersplash.co.uk/docs/DipCortex-USB-CDC.zip

Import programDipCortex-ADC-USB

DipCortex - Read 7 Analog channels and stream the data over USB CDC

Import programDipCortex-PWM

DipCortex PwmOut Example

Import programDipCortex-USB-CDC

Create a UART to USB Serial bridge with the DipCortex

Import programWiFiDip-UsbKitchenSink

WiFi DipCortex USB CDC

Note : This is the older version that doesn't implement the USB CDC serial port.

Import programWiFiDip-KitchenSink

WiFi DipCortex / CC3000 Demo - Contains a menu driven set of tests to initalise and control the CC3000 radio. Also allowing you to test various TCP and UDP connections.

User Projects

Import programWiFiDipCortex_Cheerlights

Cheerlights client using WiFiDIPCortex and WS2801 RGB LED strip


1 comment on DipCortex - Getting Started with mbed:

30 Jan 2014

Note that there currently is an issue with the pinnames when you select DipCortex M0 as the platform. It turns out that in this case the compiler selects the target LPC11U24 and uses the PinNames.h for the mbed DIP 11U24. This defines p19 = P0_16 and p20 = P0_22, which leads to a crash when you try to declare a Serial port on p19/p20. The defines are correct for the DipCortex M3: p19 = P1_13, p20 = P1_14,

Until this is resolved you should use the actual portpin names like P1_13 instead of the abbreviation p19.

Please log in to post comments.