mbed Programmer

Mission Statement

To produce a low-cost programming platform that vastly simplifies the programming process for prototype-to-hardware migration.

Vision

I want this to be similar to a flash drive that when plugged into a PC will show up as a mass storage device. The device is then connected to the target PCB to be programmed. The User then uses the drag-and-drop process familiar to all mbed users to load the desired binary file onto the device. The target PCB is programmed by pressing a button on the device. The device provides feedback to the User via status and comms LEDs.

The whole process must feel like the mbed environment and programming process. It must be simple and give clear feedback to show that the target has been programmed.

Realisation

I started working on this project a few months ago after I heard about a team of engineers that wanted to use the mbed environment to develop a custom PCB. After completing the design they decided the best way to program it was to get an mbed, desolder the LPC1768 IC from it and connect flying leads to the SWD pins and connect them to the matching pins on the target PCB via a header. They then just dragged the binary onto the mbed and pressed the reset button. The mbed 'magic' chip then simply programmed the target device instead of the absent LPC1768!

While I thought this was an ingenious idea it also made me chuckle because it seemed a bit overkill. So I started to think about alternate way of doing it. I had already had experience of ISP programming (see my notebook page), and a cookbook page exists clearly explaining this method.

The problems with this method are that you need to convert the binary to hex and it takes a while to set-up. But the nail in the coffin is Flash Magic. Flash Magic is a great tool but legally you are only allowed to use it for personal use or prototyping (read the free license limitations here. If you wish to use it to make saleable product you need a licensed copy which costs around £400 + VAT (see here).

In a similar situation JTAG can be used to program the PCBs. This again can be very expensive with some JTAG programmers costing £1000s. In contrast I thought my device could be produced and sold for <£50

The mbed HDK should address this problem, But it is not ready yet. Also it will add cost to each and every PCB it is used on. My method is a one-off cost with very little added to the cost of the target PCB (just a programming header)

What am I gonna do about it?

So I started doing a lot of reading on the LPC1768 datasheet and searching on the web. I used the mbed community a lot and found that people had done most of the little bits I needed - just nobody had brought them all together.

The first thing I done was to get some flash memory where people can drag and drop their programs to. I then needed to get this appearing as a USB mass storage device (MSD) when it was connected to a PC (a big thanks to Little Llumpu for your work in this area). I then read a LOT of stuff about the FAT file system and wrote some code that looks through the files system and returns a pointer to the latest file written on the device that has a .bin file extension.

Following this was a LOT more reading on how to program the LPC1768 and the strange world of Uuencoding as well as the mechanics of how to write to the flash memory of the LPC1768 target device.

Finally I wrote some more code (for a hardware engineer I sure do write a lot of code!) that puts the target into, and brings it out of reset when it is programmed. Along the way I did my usual method of code development which involves lots of small chunks of code and lots of testing as I go. Finally I was left with a breadboard using an M0 mbed, a USB connector and a AT45 flash memory chip which together formed a system that would replicate the mbed 'magic chip' drag and drop programming environment.

800

Prototype to Hardware

Ironically I now needed to move from prototype to hardware and design and then program my custom PCB. The hardware design was pretty straight forward (that's my day job!) and I managed to get a small PCB made. The main thing I settled on at this stage was the pinout for the programming connector. I designed this in such a way that if one were to plug it in the wrong way round no damage would be done to either PCB.

A photo of the PCB is presented below...

800

The PCB is pretty small and uses the same USB cable as the mbed. When plugged into a PC the device shows up as a flash drive where the same binary files the mbed complier produces can be drag and dropped. The target PCB is plugged into connector on the device and programmed by pressing the white button. Simple.

I made a youtube video talking you through the prototype. I plan to change the form-factor into something a bit more robust and then we'll see where we can go with this.

Comments welcome Martin


12 comments on mbed Programmer:

07 Sep 2013

Hello Martin,

well done! Are you going to share details (schematic, code) of your programmer? What's the final hardware cost?

07 Sep 2013

Hi Martin, the circuitboard picture shows that you used a 6pin connector between the programmer and the target. Perhaps it is a good idea to align the pinout with the FTDI USB to Serial cables extended by 2 pins for ISPen and Reset. That allows you to use the FTDI cable (or one of its clones) for terminal interfacing later on when the programmer has been removed. The FTDI pinout is: 1=GND, 2=DTR, 3=VCC (3V3 or 5V depending on version), 4=TXD (output of FTDI), 5=RXD (input of FDTI), 6=RTS

See http://www.ftdichip.com/Products/Cables/USBTTLSerial.htm

Obviously it would be very nice when the programmer could also support serial to USB conversion in addition to the MSD function just like the mbed IF chip.

08 Sep 2013

Martin Kojtal wrote:

Hello Martin,

well done! Are you going to share details (schematic, code) of your programmer? What's the final hardware cost?

Hi Martin,

I'm not 100% sure what I'm going to do with it yet. My original plan was to make a batch of 50 or so and sell them on Ebay. If that doesn't work out I might release the gerber files and source code?

08 Sep 2013

Wim Huiskamp wrote:

Hi Martin, the circuitboard picture shows that you used a 6pin connector between the programmer and the target. Perhaps it is a good idea to align the pinout with the FTDI USB to Serial cables extended by 2 pins for ISPen and Reset. That allows you to use the FTDI cable (or one of its clones) for terminal interfacing later on when the programmer has been removed. The FTDI pinout is: 1=GND, 2=DTR, 3=VCC (3V3 or 5V depending on version), 4=TXD (output of FTDI), 5=RXD (input of FDTI), 6=RTS

See http://www.ftdichip.com/Products/Cables/USBTTLSerial.htm

Obviously it would be very nice when the programmer could also support serial to USB conversion in addition to the MSD function just like the mbed IF chip.

Hi Wim,

Thanks for this suggestion. I wanted to keep the programmer as clean and simple as possible but I can see how acting as a debug bridge to a terminal would be really useful. I will have a look into it some more.

Thanks Martin

15 Nov 2013

Thats great Martin. Where can I buy one?

I think you have a winner there!

02 Dec 2013

Hi Andrew. Sorry for the late reply but I have just got back from holiday. I have had a small sample batch made up and plan to sell them on ebay. It will take me a few days to set up.

31 Dec 2013

Hi Martin!, Do you have any updates on the samples that you will sell? :)

01 Jan 2014

Hi Martin,

This mbed ISP programmer is awesome! I am really interested in making one for my projects.Are you planning to share the schematics and code? Or are you planning to sell some boards. Please lemme knw!!!

01 Jan 2014

Brilliant! I'd buy one.

01 Jan 2014

Hi Martin, good work! I would also like to order a borad.

02 Jan 2014

Hi Guys,

I have now got a small sample batch ready to go. If you would like one then private message me and I will send one to you. Price will be £30 + Postage to wherever you are. This is a slightly discounted price compared with what I plan to sell them at as it is the first batch and I may decide to add more features / devices depending on what feedback I get.

I will also add another notebook / wiki page to better document how to use the programmer (but it is pretty simple). I may release the code or the schematics in the future but not both! (Gotta keep some IP back!)

Cheers Martin

15 Aug 2016

Hi Martin

I'm at the same stage as the team of engineers mentioned at the start of your project, in that I'm nearing completion of development (on mbed LPC1768) and am now looking at the bespoke target board design. My situation is reverse to you, I'm a software engineer who seems to do a lot of hardware!

Is your programmer still available and have you made your planned enhancements? Without one I also had the same idea as the one mentioned, i.e. to desolder the uP on the LPC1768 development board and use a patch cable to my target board!

Cheers

Chris

Please log in to post comments.