Zero-cost firmware update

You might be wondering, like I was, if it is possible to upgrade your microcontroller firmware over the same USB port that you use to communicate with your microcontroller. If you are already using an FTDI USB-to-Serial port interface chip, to communicate between your PC and your PIC microcontroller, here is an idea that will let the FTDI chip double up as an in-circuit programmer. No extra components are required, and no resources or memory space is used in the PIC Chip. Heck, it’s even possible to program a “blank” PIC chip, or a PIC chip where the contents of its program FLASH memory has been corrupted.

This idea should work on microcontrollers from other brands like Atmel, NXP, Motorola, or Zilog, although I have not tested this. I have successfully been able to configure a  Xilinx chip using the same FTDI chip, though.

How it works:

In this example, I use an FTDI232R and a PIC16F886, but it could be anything.

The FTDI chip has two pins, RX and TX that is be used to communicate with your PIC chip’s serial port. In additional to that, most of the FTDI chips have a handful of ports used for LEDs and serial port handshaking.

The secret is a little-used FTDI feature called BitBangMode and a small FTDI utility called MProg3. With this utility you can re-program the CBUS pins as ordinary I/O. After reprogramming, you can connect these pins directly to the PIC chip’s MCLR, PGD and PGC pins. The PIC programming algorithm can then be implemented in a Visual Basic program, toggling MCLR, PGD and PGC up and down using the standard FTDI driver. That’s all there is to it.

Hardware and Software

As always, the Visual Basic .NET program was developed using Visual Studio 2008 Express. This remarkable compiler is another freebie from Microsoft.

 

Comments

  • Vernell Morale  says:

    Thank you, it’s a great post 🙂

  • Ebenstein  says:

    It’s actually a nice and helpful piece of information. I’m happy that you simply shared this helpful info with us. Please keep us informed like this. Thanks for sharing.


Leave a reply