Friday 5 July 2013

FlashMagic learning notes

Tutorial: Flashing the LPC1114 with FlashMagic - microBuilder.eu

http://www.microbuilder.eu/Projects/LPC1114ReferenceDesign/FlashMagic.aspx

Deployed your compiled code to the LPC1114 with the freely available FlashMagic tool

Unlike the LPC1343, the LPC1114 doesn't have a convenient USB bootloader (which isn't surprising, since it also doesn't have USB).  While you can easily flash the device using a dedicated HW debugger like the Segger J-Link for ARM or one of the many HW debuggers supported by Crossworks for ARM (if you're using Crossworks), if you don't have access to a HW debugger you can still program the device with FlashMagic, a free software utility sponsored by NXP.  FlashMagic can also be used to 'debrick' your device if you have written something to the firmware that prevents you from connecting over SWD (for example, going directly into deep-sleep mode after bootup).

FlashMagic works with the ISP bootloader built into almost every LPC device from NXP, and allows you to update the flash contents on your MCU via a simple UART connection.  In the case of the LPC1114 Reference Board, you simply need to set the ISP jumper, reset the device, and you should automatically enter ISP mode.

The only HW required for this is an inexpensive UART converter with 3.3V logic, such as the FT232R Breakout Board available in our online store.  Using the FT232R Breakout Board as an example, you simply need to connect the LPC1114 to the breakout board as follows:

Connecting the FT232RL to the LPC1114 Reference Board

FT232R Breakout Board LPC1114

GND GND

TXD RXD

RXD TXD

Note on UART Settings: If you are not sure what the baud rate and COM port are for your USB to UART converter, you can go into the Windows Device Manager, and look at the Properties window for the device, which should be in the Ports (COM & LPT) sections. The appropriate information can be found and modified in the 'Port Settings' tab. We'd suggest setting the bis per second to at least 57600, since it will default to a relatively slow 9600.

Step One: Enter ISP mode

Connect the UART adapter to the LPC1114 as shown in the table above.
Set the ISP jumper to the on possition.

Reset the board by pressing and releasing the RESET button.

Step Two: Configure FlashMagic

Start FlashMagic if you haven't already done so.

Click on the 'Select Device...' button and select the appropriate device from the popup window. In the case of the LPC1114 Reference Board, this would be the LPC1114/301:

Set the Baud Rate, COM Port and Oscillator Frequency (12.0 in the case of the LPC1114 Reference Board).

Check the Erase blocks used by Hex file checkbox

Located the firmare.hex file created when you built your project with the Browse... button. This is the compiled code that will be written to the flash device.
Check the Verify after programming button

The final setting should look similar to this:

Confirming the UART connection: You can check the UART connection and make sure that you are indeed in ISP mode by selecting the 'ISP > Read Device Signature...' menu item. If everything is properly configured, and the device is in ISP mode you should something similar to this screen.

Step Three: Flash the Device

To flash the device with the supplied firmware, you simply need to click the Start button. Once the flashing process is complete, you can put the ISP jumper back to it's off position, reset the LPC1114, and your new firmware should start executing.  You can use this precompiled .hex file for the LPC1114 Reference Board as a test, which will cause the LED on pin 3.5 to blink on and off every 3 seconds.

If you have any problems, you probably haven't entered ISP mode on the board (set the ISP jumper to the appropriate position and reset the device), or your UART port isn't properly configured. Double check your settings in the Windows Device Manager and in FlashMagic, make sure you have properly set the ISP jumper on the LPC1114 Reference Board and try again.  If you are using the FT232R Breakout Board available in our online store, you may want to make sure you have the latest FTDI drivers installed as well.

.END

No comments:

Post a Comment