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

cayden

 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

Results:
- 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:

https://en.wikipedia.org/wiki/Intel_HEX

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

cayden

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:

http://www.batlabs.com/fileutil.html

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

Andy
Embedded Systems Academy, Inc.
support at esacademy dot com

cayden

The first link on this page:

http://www.batlabs.com/fileutil.html

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:

00800010450200004D0200004F0200005102000053020000550200002672FFEF000000000000
0000000000005702000059020000000000005B0200005D0200005F0200005F0200005F020000
5F0200005F0200005F0200005F0200005F0200005F0200005F0200005F0200005F0200005F02
00005F0200005F0200005F0200005F0200005F0200005F0200005F0200005F0200005F020000
5F0200005F0200005F0200005F0200005F0200005F0200005F0200005F0200005F0200005F02
00005F02000000F002F800F098F80AA090E8000C82448344AAF10107DA4501D100F08DF8AFF2
090EBAE80F0013F0010F18BFFB1A43F00103184790720000B0720000103A24BF78C878C1FAD8
520724BF30C830C144BF04680C60704700000023002400250026103A28BF78C1FBD8520728BF


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

:10000000F01F0010510100004901000049010000EB
:1000100000000000000000000000000000000000E0
:100020000000000000000000000000004901000086
:10003000000000000000000049010000490100002C
:100040004901000049010000490100004901000088
:100050004901000049010000490100004901000078
:100060004901000049010000490100004901000068
:100070004901000049010000490100004901000058
:100080004901000049010000490100004901000048


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

Andy
Embedded Systems Academy, Inc.
support at esacademy dot com

cayden

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

C:\Users\chris\OneDrive\Documents\Srecord\srecord-1.64-win32>

cayden


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

cayden

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!