Author Topic: LPC1768 from command line  (Read 8890 times)

ddeletic

  • Jr. Member
  • **
  • Posts: 4
    • View Profile
LPC1768 from command line
« 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.



Andy Ayre

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2172
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: LPC1768 from command line
« Reply #1 on: October 27, 2010, 12:42:01 pm »
I see Flash Magic sending the following command:

Code: [Select]
tx> W 268435968 512\d
The device then echos back:

Code: [Select]
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:

Code: [Select]
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

  • Jr. Member
  • **
  • Posts: 4
    • View Profile
Re: LPC1768 from command line
« Reply #2 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

ddeletic

  • Jr. Member
  • **
  • Posts: 4
    • View Profile
Re: LPC1768 from command line
« Reply #3 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

Andy Ayre

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2172
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: LPC1768 from command line
« Reply #4 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
Embedded Systems Academy, Inc.
support at esacademy dot com