Programming the lpc11u24 directly (no mbed)

30 May 2012

A few days ago I was courious to know if it is possible to programm the lpc11u24. I wrote a post and, like always, I got a lot of help from the forum. Today I though, I could bring it to the nexte level : prgram the lpc11u24 directly.

I found a good post on the topic : http://mbed.org/users/chris/notebook/prototype-to-hardware/ (it is for the LPC1768). I made a homemade PCB and soldered the IC that I bought from digikey on my PCB. Now, I want to programm it but got some questions:

  1. do I really need the crystall (there is also an internal clock!?)
  2. Can I test without capacitors?
  3. Has anyone try to do the same as I want to do?
  4. Can I use a FTDI cable directly?
  5. Any hint?

thanks

30 May 2012

Hi,

I wrote a Notebook Page similar to Chris' on programming the LPC1768, and a YouTube Video as well - but I have not looked into the LPC1124.

Assuming that the two processes are similar...

1. You will need the crystal - clock doublers internal but no clock I stand corrected, you only need a crystal if using USB

2. You will need the caps - to smooth out switching and prevent brown-outs

3. ?

4. I don't think so but I might be wrong?

5. ?

30 May 2012

You don't need a crystal unless you want to use the usb mode described below

Quote:

The LPC11Uxx include three independent oscillators. These are the system oscillator, the Internal RC oscillator (IRC), and the Watchdog oscillator. Each oscillator can be used for more than one purpose as required in a particular application. Following reset, the LPC11Uxx will operate from the Internal RC oscillator until switched by software. This allows systems to operate without an external crystal and the bootloader code to operate at a known frequency.

Note that LPC11U24 has two ISP modes, one is through the serial port and the second is through the USB. Basically it is similar to an mbed board, you just copy the bin file in the drive.

Quote:

The LPC11U2x supports ISP from the USB port through enumeration as a Mass Storage Class (MSC) Device when connected to a USB host interface (Windows operating system only).

For the LPC11U2x parts, the state of PIO0_3 determines whether the UART or USB interface will be used: • If PIO0_3 is sampled HIGH, the bootloader connects the LPC1U2x as a MSC USB device to a PC host. The LPC11U2x flash memory space is represented as a drive in the host’s Windows operating system. • If PIO0_3 is sampled LOW, the bootloader configures the UART serial port using pins PIO0_18 and PIO0_19 for RXD and TXD and calls the ISP command handler.

The LPC11U2x is enumerated as a Mass Storage Class (MSC) device to a PC or another embedded system. In order to connect via the USB interface, the LPC11U2x must use the external crystal at a frequency of 12 MHz. The MSC device presents an easy integration with the PC’s Windows operating system. The LPC11U2x flash memory space is represented as a drive in the host file system. The entire available user flash is mapped to a file of the size of the LPC11U2x flash in the host’s folder with the default name ‘firmware.bin’. The ‘firmware.bin’ file can be deleted and a new file can be copied into the directory, thereby updating the user code in flash. Note that the filename of the new flash image file is not important. After a reset or a power cycle, the new file is visible in the host’s file system under it’s default name ‘firmware.bin’.

P.S. the quotes are from the LPC11Uxx user manual

Alex

31 May 2012

Have you tried to flash the LPC11U24,

the USB option sounds amazing, I am assuming you still need BIN2HEX to make the file

Ceri

31 May 2012

Yes you still need the BIN2HEX , at least if you are using an offline compiler because the online mbed will generate the bin directly.

I haven't used this mode, I only own an mbed LPC11U24 so when I tried to use this mode in the board I saw a drive letter appear and disappear almost immediately and the cause is that the mbed chip uses jtag and overrides this mode. It will work fine in a bare chip or in an mbed board if you disable the mbed chip.

This USB mode seems amazing, makes me wonder why mbed has used the second chip to provide a functionality that basically already existed and as a cause prevent anyone from being able to use the jtag pins to debug (since they are occupied).

Alex

01 Jun 2012

Thanks a lot for your answers.

With the links you gave me : http://mbed.org/users/ms523/notebook/turning-an-mbed-circuit-into-a-custom-pcb/ and http://mbed.org/users/chris/notebook/prototype-to-hardware/ I am working my way to do programming stuff on the LPC11U24.

First, here is my wiring table (I am using a mbedLPC11u24 to programme a LPC11u24):

p30(isp)    PIO0_1       (pin 5)
p29(reset)  RESET/PIO0_0 (pin 4)
p9(TX)      RXD0/P1_18   (pin 61)
p10(RX)     TXD0/P1_19   (pin 62)

And I ground PIO0_3 (pin 19) to choose UART programming mode.

Then, I modified the code the source code for the serial port bridge "mbedISP" found at http://mbed.org/users/chris/notebook/prototype-to-hardware. Here it is (I only changed the line : Serial target (p9,p10); actually):

#include "mbed.h"
#include "SoftSerial.h"

DigitalOut led1(LED1);
DigitalOut led2(LED2);

SoftSerial pc(p25,p26);
Serial target (p9,p10);

// We'll drive this low, and then set the as inputs
// this mimics an open collector style ouput
DigitalInOut reset (p29);
DigitalInOut isp   (p30);

int main() {

    pc.baud(19200);
    target.baud(19200);
   
    // ISP Input with pullup
    isp.input();
    isp.mode(PullUp);

    // pulse reset low
    reset.output();
    reset = 0;
    wait (0.01);
    
    // reset input, with pullup
    reset.input();
    reset.mode(PullUp);
    
    while (!pc.readable()) {}   
   
    // pull ISP and nReset low
    reset.output();
    isp.output();
    reset = 0;
    isp = 0;
    
    wait (0.1);
    
    // Bring target out of reset
    reset.input();
    reset.mode(PullUp);
    
    wait (0.1);

    while (1) {
    
        if (pc.readable()) {
            target.putc(pc.getc());
            led1 = !led1;
        }
    
        if (target.readable()) {
            pc.putc(target.getc());
            led2 = !led2;
        }
    
    }
}

I wired my homemade board on the mbed. Now I want to connect the decoupling and the caps and resistors (I will use through-hole) for the reset line and the ISP as described in your post: http://mbed.org/users/ms523/notebook/turning-an-mbed-circuit-into-a-custom-pcb/ . I looked in the datasheet : http://www.nxp.com/documents/user_manual/UM10462.pdf but I did not found info on that. Should I? Or where did you found the values for your caps en resistors?

thanks

29 Jul 2012

Led1 goes on and off when I type something in tera term. Led2 goes on after I typed the first character and then it stays on for ever...

I dont get any synchronized here... My pins are as follow :

MBED       ==>  LPC11U24  
=====================================  
p30(isp)   ==>  PIO0_1 (pin 5)
p29(reset) ==>  RESET/PIO0_0 (pin 4)
p9(TX)     ==>  RXD/PIO0_18 (pin 61)
p10(RX)    ==>  TXD/PIO0_19 (pin 62)
GND        ==>  (pin 19)
VOUT       ==>  (pin 10) 
GND        ==>  (pin 7)
03 Jun 2012

I have been caught our three or four times by this. because the LPC11U24 only has one serial port :-S

I personally use FT232 because Flash Magic can set / clear the Reset / ISP pins, although in your terminal program, you will need to set DTR, as this is the ISP pin.

although I am working on terminal program with some additional features.

Ceri

03 Jun 2012

I have been caught our three or four times by this. because the LPC11U24 only has one serial port :-S

I personally use FT232 because Flash Magic can set / clear the Reset / ISP pins, although in your terminal program, you will need to set DTR, as this is the ISP pin.

although I am working on terminal program with some additional features.

Ceri

05 Jun 2012

There is only one serial you are right. That is why I use the SoftwareSerial.

I did not understand exactly what you mean. Were you able to programme the LPC11u24 directly?

08 Jun 2012

Hi All,

Yes, you can boot load the LPC11U24 directly over USB. It enumerates as a USB flash drive, which sounds like a great idea :-)

I'll write a proper blog post on it at some point, but the essentials are :

- Bring the LPC11U24 out of reset with

  • the ISP pin (PIO0.1) held LOW
  • the ISP mode select pin (PIO0.3) held high
  • USB connected (make sure you have all the filters and FETs in place

- On your PC, a drive will appear called CRP_DISABLED, that will contain a single file called firmware.bin.

- Delete this file and copy on your new binary. Happily, a binary from the mbed online compiler works a treat with no meddling :-)

- Reset the LPC11U24 with the ISP pin high, and your code will run.

The only caveat is that it doesn't seem to work on Macs. I've not yet tested Linux.

Hope that helps or is of interest!

Thanks, Chris

14 Jun 2012

Thanks for your reply,

sounds like great idea to boot load over USB. However it seems a bit more complicated. I wish I could programme it through UART

15 Jun 2012

From the comments above, Espesialy the first few, I think serial bootloading is very simple,!

You migh not even need a crystal??

Ceri

19 Nov 2012

Hi guys, I have produced several of my own boards and always upload to them using the USB method. It's not difficult at all!

19 Nov 2012

Then I guess I should try it (I was always afraid of it). Do you have a step by step procedure for dummies?

thanks

19 Nov 2012

Does your PCB have USB working, such as Mouse or HID Device ?

If so then it is super easy,

almost as easy as REAL MBED !!

press reset button,

press ISP button,

relese Reset button,

release ISP Button,

a new drive apears, CRP Disabled,

deleat the file, (firmware.bin)

build MBED ....

save to new drive,

press reset.

your code is now running :)

..................

Bit different if you do not have USB:

Repeat above button sequence,

using BIN2HEX make a hex of your bin file,

use flash magic to program part, using serial,

the same as USB serial .

Note: there is a pin (Pin 19 on LPC11U24)

which selects between USB/Serial programming USB = Hi, Serial = Low.

Hope that was informative,

Ceri

28 Nov 2012

Hi guys, I have attached a rar archive with my LPC11U24 reference project for the designspark PCB layout program. It includes the bare minimum for to get an LPC11U24 running and upload firmware via USB. I hope someone finds it useful.

Regards, James

/media/uploads/James1208/lpc11u24_reference.rar

21 Dec 2012

Very good, thanks.

If I understand right, I really don't need any USB chip, online a simple USB connector or even cut a USB cable. Also, have you fabricated a PCB using this layout?

thanks

21 Dec 2012

Very simple setup,

LPC11U24, few Resistors,capacitors, FTE, and 12Mhz Crystal, and a USB Connector (could be loose wire if you are on a budget (scrooge))

I have made 2 or 3 PCB's with LPC11U24 (48 & 64 pin)

All work very well, Espessialy since I did not pay too much care on balenced tracks, & EMC stuff.

Cheers

Ceri

23 Sep 2013

The USB loader looks like it could be a really convenient way to perform field-updates. I'm just left wondering what the minimum USB hardware would be assuming that

1: The USB function is only to be used for reprogramming and 2: The equipment will be un-powered during reprogramming

That implies that I'd a diode or similar to route bus power to a voltage regulator powering the IC, and a transistor or inverter to pull pin PIO0_1 low when bus power is present?

Also is it practical to try this out on the 11U MBED? or does the MBED hardware always get in the way?

I've been looking at AN11305, it includes suggestions for automating the update.

07 Dec 2015

Hi folks, I've tried this method with linux - alas no luck. Sequence is. 1. Setup 48 pin package mounted on a simple carrier board PIO_3 held high, usb connected 33.V generated using regulator from the USB 5V. FTOGGLE and NRESET both held high by 10k pullups with button switches pulling them down when pushed. PIO0_3/USB_VBUS held high (at 3.3V) via 10k from regulator - this is fixed 12MHz clock and caps across xtalin and xtalout green led across mbed p5 and p6 which are PIO0.9 (package pin 28) and PIO0.8 (package pin 27) respectively. pc running kubuntu 14.04.

2. drive appears as CRP_DISABLD ok 3. I can see the firmware.bin. 4. I delete this and compile blinky on mbed, then save direct to this drive. 5. I then unmount the drive and push the NRESET - still connected and powered derived from USB, USB still connected 6. CRP_DISABLD remounts and appears once again. 7. same file - firmware.bin is there - its still 32k in size. 8. No flashing of my LED connected across mbed p5 and p6 the USB - no sign that code is running and when the drive reappears the original firmware.bin is still there.

so it seems that my bin is not getting through - although it seems to be transferred as far as my linux box is concerned.

Anyone managed to get this to work under linux ? should I be bin2hex ing my mbed binaries ?

all the best

Chris

07 Dec 2015

Ah HA - just after posting this I found the solution - using dd rather than the desktop file manager (konqueror) the following (taken from the seeduino page : https://developer.mbed.org/users/seeed/notebook/programming-seeeduino-arch/) works. No idea why desktop copy doesn't work though

Download

Seeeduino Arch(LPC11U24) doesn't have an mbed interface. It uses USB In-System-Programming(ISP) to upgrade the firmware. To enter the USB ISP mode, connect the Arch with your computer and long press its button, and then a disk named "CRP DISABLD" will appear.

on windows delete firmware.bin in the "CRP DISABLD" disk. copy a new firmware into the disk.

on linux

if the disk is not mounted, mount the disk at {mnt_dir}

dd if={new_firmware.bin} of={mnt_dir}/firmware.bin conv=notrunc

on mac dd if={new_firmare.bin} of=/Volumes/CRP\ DISABLD/firmware.bin conv=notrunc

Quick press the button to run the new firmware.