Flash Magic Forum

In-System Programming Support => ARM Cortex => Topic started by: ddeletic on October 25, 2010, 10:42:51 PM

Title: LPC1768 from command line
Post by: ddeletic on October 25, 2010, 10:42:51 PM
Hi there,

I'm trying to program a LPC1768 device using FlashMagic (build 5.70.2079) from the command line (fm.exe @cmdfile.fms). Cmdfile.fms contains the following:

com   (4, 57600)
device(lpc1768, 12.000000)
hardware (bootexec, 300, 300)
hexfile  (Z:\RedWall\Code\project\App\RedBack_Debug_v1.xx.hex, nochecksums, nofill, protectisp)

More often than not, this fails with 'Hex file programming failed: invalid command (Z:\...\RedBack_Debug_v1.xx.hex)'. I stress that it also succeeds from time to time. This same hex file can be programmed using FlashMagic's GUI every time. I have tried short file names, short paths, longer timeouts,... I have exhausted my pool of things to try. Attached is a debug dump. I hope you guys can shed some light onto the problem. I can also confirm that the device is blank prior to running FM.

I used an almost identical system to program LPC2368 (admittedly with an earlier version of FM) without any problems.


Title: Re: LPC1768 from command line
Post by: Andy Ayre on October 27, 2010, 12:42:01 PM
I see Flash Magic sending the following command:

tx> W 268435968 512\d

The device then echos back:

rx> W 268035968 512\d

which is incorrect - the four has been changed into a zero. My guess is that the device received the line of text incorrectly because it then sends error code 14:

rx> 14\d\a

You might want to try reducing the baudrate. Other than that I would look for an intermittent electrical connection somewhere in the communication path. Perhaps try a different PC also.

Andy
Title: Re: LPC1768 from command line
Post by: ddeletic on October 27, 2010, 06:00:05 PM
Thanks Andy,

reducing baud rate did help. Programming is now much more reliable (running at 19200, I'm yet to fail it).

Now, the question is, why running from GUI at 57600 is always successful and running from command line is not (using the same physical connection). I have high confidence that my physical connection is good. I use it all the time to program shorter hex files (a few bytes) into LPC1768 and also to program LPC2368 at 115200 baud, using long hex files.

Also, I have a feeling that comms in that debug session (I cannot read debug file) failed on the first write. Is it something to do with the fact that 512 bytes is written? As I mention, I can program a very short file at 57600 no problem...

Any thoughts would be appreciated, although, as I said, slower baud rate works now.

Thanks again,
Dejan
Title: Re: LPC1768 from command line
Post by: ddeletic on October 28, 2010, 03:47:36 PM
OK, I found an offending capacitor on my PCB - I wasn't aware of its existence - hardware guys forgot to mention it. Now, I can go up to 115200 (sometimes) from command line. GUI is still much more reliable (why !?!???!).

Again, thanks for your help.
Cheers,
Dejan
Title: Re: LPC1768 from command line
Post by: Andy Ayre on November 01, 2010, 06:41:00 AM
Not sure. The command line interface and the GUI both use the exact same DLL which is where the communications code is. Are t1 and t2 set to different values perhaps?

Andy