7 years, 2 months ago.

Programming the Reference Design

I'd like a reference design that lets me easily transition from a working mbed configuration to a custom PCB. The Reference design on this page has a JTAG for programming (I think). Is it possible to generata a reference design that mimics the exact functionality of the mbed? Maybe this one does and I just cant see it!

The mbed-like reference design I suggest would have a USB connector and a push-button (or maybe just a jumper). When you connect the custom PCB to a PC, it would connect up a drive (like the mbed does) that is recognizable to windows. When you do a compile, from the mbed web-compiler, and then save, the compiled .bin would go to this drive on the new PCB. When you push the pushbutton, the new PCB would load the newest .bin and go ... No JTAG, no FlashMagic and nothing new to learn ...

Is this possible and or easy to do?

Question relating to:

3 Answers

7 years, 2 months ago.

Hello, This is what I have done, based on a LPC11U24 mbed board : On your custom board, you will need at least to implement the LPC11U24, one 12MHz crystal with the 2 capacitors, the USB port. For this port, you have to put the pull-up resistors, and preferably some protection devices. You can find both together in a single device like USBUF01 from ST. Then add a reset switch with a pull-up, and most important a push button between PIO0_1 and ground. VERY important : connect USB_VBUS pin of the processor to USB Vbus through a 100 Ohm resistor. This will tell the processor boot code that a USB is present, and that programming should be done via USB and not serial link. As power supply, you can use the power from USB, if your device does not need too much current. Take the +5V from the USB bus, add any kind of regulator (I use LD1117 from ST) to create the +3.3V. Add some decoupling capacitors on the processor Vdd pins, some capacitors next to the regulator as recommended, and .. that's all. Then you have a minimum design, purely compatible with the code you would have written for your mbed. Add all your necessary peripherals, as on you mbed developpement board.

Plug your device on a PC usb, and you should see a new mass storage device comming. Delete the firmware.bin pseudo file present on this device. Copy/paste your .bin file from mbed compiler, don't care about the file name, reset the device, and it will start on your code. If you need to reprogram, press the switch on PIO0_1, keep it pressed while resetting the de vice. It will be forced back into programming mode.

Quite simple, it works, and thanks again to the mbed team ! PP

james kain
7 years, 2 months ago.

Thanks for the detailed insight ... The LPC11U24 wont work for me ... I need the LPC1768 .. Why wont this idea work there as well?

The LPC1768 doesnt have that functionality, it is specific for the 11u24 (and its friends).

posted by Erik - 04 Dec 2012

Hello, I have not experienced the 1768, so all I can say with caution, is that the structure of the mbed boards are the same, so you can use the target part of the mbed design as a starting point. Forget the proprietary part that is only used for controlling the target processor via serial debug interface. Check how to force the processor into programming mode via USB. I have seen some articles from mbed people in the 'cookbook' on how to convert to a custom design, but I don't remember if this was about LPC11 or LPC17. Sorry not to be able to help more. PP

posted by Philippe PRUNET 04 Dec 2012
7 years, 2 months ago.

You mean USB secondary bootloader instead of serial ( flashmagic ) bootloader ? If you are satisfied with LPC1768 flash holding the ( only one , not newest ) binary image of your program and running after reset and an extra key press , there may be a solution to your problem !

NXP have allready published an App note called " LPC1700 , USB secondary bootloader " that uses NXP's part of internal flash as mass storage device for firmware placement , so when you reset the device and press another key , the file placed in internal flash becomes new firmware . One of the extra features of magic chip , is that "magic chip " bootloader selects the newest firmware upon a lot of firmwares stored in an external SPI flash making life for new developers very easy !!! , but you can always use the public USB bootloader available by this app note for your production boards, if you are not interested in selecting from different firmware files ,but just one.

http://ics.nxp.com/support/documents/microcontrollers/?scope=LPC1768 look for AN10866

Have a look here , for how this is done at this video review of a 1768 board , after 21 min :00 sec


http://www.nxp.com/documents/other/AN10866.zip this is the App note for the secondary USB bootloader

posted by X M 06 Dec 2012

Thanks for this. Its really perfect solution for my goals. I also note the video says "it works like the mbed" so this is exacty what I need. As you said above, the PCB really needs two buttons, one (i guess) to set the ISP pin and then one for the reset. I think the isp button might be better as a jumper for a more operational PCB cause the reprogramming should happen very infrequently. I'm not exactly sure of the details of this hardware. Does it need an FDTI chip or just hook up the USB? Once you connect the USB/power ... does it "just work" with the on-board flash enumerated as a hard drive? It would be great if someone smarter than I would document this better for the mbed community! This type of presentation should replace the "prototype-to-hardware" module that is in the Handbook!

posted by james kain 06 Dec 2012