LPC1768 from command line

Started by ddeletic, October 25, 2010, 10:42:51 PM

Previous topic - Next topic

ddeletic

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.



Andy Ayre

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
Embedded Systems Academy, Inc.
support at esacademy dot com

ddeletic

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

ddeletic

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

Andy Ayre

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
Embedded Systems Academy, Inc.
support at esacademy dot com