LPC1768 Application code not executing after a flash upgrade using Flash Magic

Started by cayden, May 26, 2016, 10:12:36 PM

Previous topic - Next topic


 I am having a problem a problem where my user application code is not running after I perform a flash upgrade followed by a reset. The processor seems to be just stuck in ISP mode.

My Setup:
- Using an mbed board as the USB-Serial interface to program a custom board that has an LPC1768
- I have the UART0 interface of the LPC1768 on my custom board connected P28 & P27 of mbed board.
- I have two external push switches conected to the reset pin and P2_10 pin.
- Used the BIN2HEX to perform conversion of the binary file from the mbed IDE

- It appears that the flash magic tool is programming the device successfully as you can see from this attachment named Success.png.
- After the flash is programmed I reset my custom board and the processor seems to stay in ISP mode. I say this because I can read the DEvice SIgnature from the ISP menu in Flash Magic.
- What seems odd is when I click on 'information' in the file menu it does not show a memory range for the hex file which is 60.18KB. See Attachment info.png

Please help.

Andy Ayre

The info window tells me something is wrong with the hex file.

You will need to open it in notepad and see if the records in there are inside the address range of the part. You can see the expected address range in section two of the main window in Flash Magic.

Reading hex files is easy - the format is described here:


If that doesn't help please email us the hex file.
Embedded Systems Academy, Inc.
support at esacademy dot com


Thank you for your quick response. It seems there is something wrong with the hex file as I don't see any start codes. I used BIN2HEX to do the conversion which never reported an error during the process. Is there any conversion tool you recommend to do the conversion? I guess flash magic doesn't have a check for hex file validity because it appeared to download it to the part with no issue and the 'verify' works too. Attached is my hex & bin file.

I'm presuming the bin file I have is good because I can program the lpc1768 when its on the mbed board and everything is ok.

Andy Ayre

Your conversion program has converted your binary file to ASCII containing hexadecimal characters. It's not an Intel hex file.

I haven't tried it myself but look at the first link on this page:


I am surprised Flash Magic didn't complain about your file - we will investigate for improvements in a future release.

Embedded Systems Academy, Inc.
support at esacademy dot com


The first link on this page:


is the program I used and this outputs the hex file in the ASCII format I attached in the previous comment

Andy Ayre

This is what the start of your file looks like in Notepad:


This is what an Intel HEX file looks like in Notepad:


Notice how each line starts with a colon. The first two characters after that are always "10" which indicates the line length, so that is always the same.

It looks like this can do the conversion: http://srecord.sourceforge.net/

Use the output type "Intel". Here is a possible command line I've guessed at:

Quotesrec_cat foo.bin -binary -o foo.hex -intel

See: http://srecord.sourceforge.net/man/man1/srec_examples.html and http://srecord.sourceforge.net/man/man5/srec_intel.html

Embedded Systems Academy, Inc.
support at esacademy dot com


Thanks so much for your help!

This is really strange. The srecord tool seems to think that there is no data in the binary file and so doesn't create an output hex file. Here's the command and output file:

C:\Users\chris\OneDrive\Documents\Srecord\srecord-1.64-win32>srec_cat prototype.bin -o prototype.hex -intel
srec_cat: prototype.bin: 1: warning: ignoring garbage lines
srec_cat: prototype.bin: 3: file contains no data



Andy Ayre

Have you tried contacting the author of these tools so they can look at your binary file and see what is going on?
Embedded Systems Academy, Inc.
support at esacademy dot com


Andy you were right. The hex file (without the start codes) was the issue. I messed up the srec command initially. It should have been.....

srec_cat prototype.bin -binary -o prototype.hex -intel

I left out the "-binary" flag initally.

I can now program the LPC with flash Magic.

Thank you so much for your help!