Author Topic: Command Line ERASE Problem  (Read 26568 times)

EdH

  • Jr. Member
  • **
  • Posts: 5
    • View Profile
Command Line ERASE Problem
« on: September 14, 2006, 03:27:25 pm »
I'm using Flash Magic (V3.27.130) in conjuction with the External Programming feature of Keil uVision, and when I try to program my MCB900 board using Keil example MCB900 projects (HELLO, BLINKY or MEASURE) I get:

Flash Magic Version 3.27.130
8051/XA Driver Version 2.14.130
ARM Driver Version 1.13.128
(C) Embedded Systems Academy 2000-2006 All rights reserved
Connected
Device selected
Erase failed: invalid command (DEVICE)

The command line looks like this:

"FM.EXE" "DEVICE(P89LPC935,12.0) ERASE(DEVICE,PROTECTISP) HEXFILE("C:\Keil\C51\EXAMPLES\Philips LPC9xx\Measure\measure.HEX",NOCHECKSUMS,NOFILL,PROTECTISP) COM(1,9600) HARDWARE(KEILMCB900)"

I know this worked on earlier versions of Flash Magic, but I don't remember which version it was.

If I remove the "ERASE(DEVICE,PROTECTISP)" section, I no longer get the error, but, of course, flash is not erased.

I can erase and program the device successfully by running Flash Magic from the Windows dialog, but I would really like to get this working again  via command line from within uVision.  I tried moving the commands into a text file, but was unsuccessful there also.

Do you have any ideas on how to get this to work?

Andy Ayre

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2108
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: Command Line ERASE Problem
« Reply #1 on: September 14, 2006, 03:32:20 pm »
You have nested quote marks. Try moving all the directives to a text file, for example testboard1.txt:

DEVICE(P89LPC935,12.0)
ERASE(DEVICE,PROTECTISP)
HEXFILE("C:\Keil\C51\EXAMPLES\Philips LPC9xx\Measure\measure.HEX",NOCHECKSUMS,NOFILL,PROTECTISP)
COM(1,9600)
HARDWARE(KEILMCB900)

then call with:

FM.EXE @testboard1.txt

Embedded Systems Academy, Inc.
support at esacademy dot com

EdH

  • Jr. Member
  • **
  • Posts: 5
    • View Profile
Re: Command Line ERASE Problem
« Reply #2 on: September 14, 2006, 03:53:33 pm »
Thanks for the quick response , Andy.

I just tried using a text file with your changes, ran it from the command prompt, and got exactly the same error as before (I used fm.txt):

fm.exe @fm.txt

Flash Magic Version 3.27.130
8051/XA Driver Version 2.14.130
ARM Driver Version 1.13.128
(C) Embedded Systems Academy 2000-2006 All rights reserved
Connected
Device selected
Erase failed: invalid command (DEVICE)

Any other ideas?

Ed

Andy Ayre

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2108
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: Command Line ERASE Problem
« Reply #3 on: September 14, 2006, 03:58:42 pm »
That is odd. Here is my test:

>fm.exe @lpc932test.txt
Flash Magic Version 3.27.130
8051/XA Driver Version 2.20.130
ARM Driver Version 1.14.128
(C) Embedded Systems Academy 2000-2006 All rights reserved
Connected
Device selected
Manufacturer ID: 0x15
Device ID 1: 0xDD
Device ID 2: 0x1E
Erase complete (DEVICE)
Erase complete (BLOCK 1)
Erase complete (USED)
Hex file programming complete (lpc932blinky.hex)

and here is the lpc932test.txt file:

DEVICE(89LPC935,7.3728)
READSIGNATURE
COM(1,7200) HARDWARE(KEILMCB900, 50, 100)
ERASE(DEVICE, PROTECTISP)
ERASE(1, PROTECTISP)
ERASEUSED(lpc932blinky.hex, PROTECTISP)
HEXFILE(lpc932blinky.hex, NOCHECKSUMS, NOFILL, PROTECTISP)

I guess try adding a space after the comma, but that shouldn't have any effect. If that doesn't help then try cutting and pasting my directive and remove the ERASEUSED and HEXFILE ones.

Embedded Systems Academy, Inc.
support at esacademy dot com

EdH

  • Jr. Member
  • **
  • Posts: 5
    • View Profile
Re: Command Line ERASE Problem
« Reply #4 on: September 15, 2006, 07:03:56 am »
I tried your text file and it still failed with the same error.  After experimenting a little using your text file, I found that the ERASEUSED and the ERASE(1, PROTECTISP) work OK.  I only get the error when the ERASE(DEVICE, PROTECTISP) command is included.

This text file works:

DEVICE(89LPC935,7.372)
READSIGNATURE
COM(1,7200) HARDWARE(KEILMCB900, 50, 100) ERASE(1, PROTECTISP)
ERASEUSED(blinky.hex, PROTECTISP) HEXFILE(blinky.hex, NOCHECKSUMS, NOFILL, PROTECTISP)

Here is the result:

>fm @fm.txt

Flash Magic Version 3.27.130
8051/XA Driver Version 2.14.130
ARM Driver Version 1.13.128
(C) Embedded Systems Academy 2000-2006 All rights reserved
Connected
Device selected
Manufacturer ID: 0x15
Device ID 1: 0xDD
Device ID 2: 0x1E
Erase complete (BLOCK 1)
Erase complete (USED)
Hex file programming complete (blinky.hex)


This text file gives the "Erase failed: invalid commend (DEVICE)" error:

DEVICE(89LPC935,7.372)
READSIGNATURE
COM(1,7200) HARDWARE(KEILMCB900, 50, 100) ERASE(DEVICE, PROTECTISP) ERASE(1, PROTECTISP)
ERASEUSED(blinky.hex, PROTECTISP) HEXFILE(blinky.hex, NOCHECKSUMS, NOFILL, PROTECTISP)

Here is the result:

>fm @fm.txt

Flash Magic Version 3.27.130
8051/XA Driver Version 2.14.130
ARM Driver Version 1.13.128
(C) Embedded Systems Academy 2000-2006 All rights reserved
Connected
Device selected
Manufacturer ID: 0x15
Device ID 1: 0xDD
Device ID 2: 0x1E
Erase failed: invalid command (DEVICE)


I tried this on another PC (both are running WinXP, SP2) with the same results.

I noticed that you are using:

8051/XA Driver Version 2.20.130
ARM Driver Version 1.14.128

These drivers (especially the 8051/XA) are newer than what I downloaded yesterday:

8051/XA Driver Version 2.14.130
ARM Driver Version 1.13.128

Could this make a difference?

Ed

Andy Ayre

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2108
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: Command Line ERASE Problem
« Reply #5 on: September 15, 2006, 08:19:30 am »
Hmm. This is very odd. I tested this with the exact same version of FM that you are using:

C:\Program Files\Flash Magic>fm.exe @lpc935test.txt
Flash Magic Version 3.27.130
8051/XA Driver Version 2.14.130
ARM Driver Version 1.13.128
(C) Embedded Systems Academy 2000-2006 All rights reserved
Connected
Device selected
Manufacturer ID: 0x15
Device ID 1: 0xDD
Device ID 2: 0x1E
Erase complete (DEVICE)
Erase complete (BLOCK 1)
Erase complete (USED)
Hex file programming complete (lpc932blinky.hex)

and it worked fine. Please email me the directives file and hex file you are using so I can try it myself. My email address is at the bottom of this post and in the Help -> About window.

Embedded Systems Academy, Inc.
support at esacademy dot com

EdH

  • Jr. Member
  • **
  • Posts: 5
    • View Profile
Re: Command Line ERASE Problem
« Reply #6 on: September 15, 2006, 09:35:32 am »
Andy,

The 2 files should be in your inbox...

Thanks, again.

Ed

Andy Ayre

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2108
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: Command Line ERASE Problem
« Reply #7 on: September 15, 2006, 11:18:56 am »
Your files worked fine for me:

C:\Program Files\Flash Magic>fm.exe @fm.txt
Flash Magic Version 3.27.130
8051/XA Driver Version 2.14.130
ARM Driver Version 1.13.128
(C) Embedded Systems Academy 2000-2006 All rights reserved
Connected
Device selected
Manufacturer ID: 0x15
Device ID 1: 0xDD
Device ID 2: 0x1E
Erase complete (DEVICE)
Erase complete (BLOCK 1)
Erase complete (USED)
Hex file programming complete (blinky.hex)

Which version of Windows are you using and which language?
Does reinstalling FM help?

Embedded Systems Academy, Inc.
support at esacademy dot com

EdH

  • Jr. Member
  • **
  • Posts: 5
    • View Profile
Re: Command Line ERASE Problem
« Reply #8 on: September 15, 2006, 03:25:01 pm »
I'm using Windows XP Professional, Version 2002, Service Pack 2, English(US) version.

I did try uninstalling FM, re-downloading, and re-installing FM but still get the same error.

It's odd that the only command that causes an error is:

ERASE(DEVICE, PROTECTISP)

I have tried moving this command after the ERASE(1, PROTECTISP) and after the ERASEUSED(blinky.hex, PROTECTISP).  Those commands always work, but ERASE(DEVICE,  PROTECTISP) still gives the error.

Andy Ayre

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2108
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: Command Line ERASE Problem
« Reply #9 on: September 18, 2006, 08:27:49 am »
I'm using the same version of Windows, so this has me stumped. I'm not sure why it would work ok for me and not for you. The logic to decode the command line is the same for both of us and so is the input.

If you are interested in helping me out with this by testing a series of DLLs with additional debug information added, please let me know by Email and we can do that. I'm not sure of another way to attack the problem.

Embedded Systems Academy, Inc.
support at esacademy dot com

Rick

  • Jr. Member
  • **
  • Posts: 11
    • View Profile
Re: Command Line ERASE Problem
« Reply #10 on: December 03, 2007, 09:08:24 am »
I realise this is an old topic, but I'm having the EXACT same problems.

MCB900 board.

Loads fine on the computers at university, but not at home.

University PCs are running uVision 3.02c, FM 1.95

I'm on uVision 3.03c, FM 3.33

"FM.EXE" "DEVICE(P89LPC935,12.0) ERASE(DEVICE,PROTECTISP) HEXFILE("C:\Keil\C51\Examples\LPC9xx\Blinky\Blinky.HEX",NOCHECKSUMS,NOFILL,PROTECTISP) COM(1,9600) HARDWARE(KEILMCB900)"
Flash Magic Version 3.33.157
8051/XA Driver Version 2.22.156
ARM Driver Version 1.17.157
(C) Embedded Systems Academy 2000-2006 All rights reserved
Connected
Device selected
Erase failed: invalid command (DEVICE)

That's the output I get when I try to compile on the machine at home.

The board is connected via COM1, with the same cable as used at university, and no USB converters are being used.

I'm on XP SP2, UK (International) English.

I'd be grateful if anyone could offer some help, since this is a major obstacle to ease of working on my thesis project.

Many thanks in advance.


EDIT: Just to add to this post, I've checked my port by shorting the pins on the cable, and the PC COM port is working fine (no echo without short, input echoed with short). The board also appears to be fine (all Hyperterminal input echoed when connected, nothing echoed when cable disconnected)

EDIT AGAIN: If I try to program the file directly in FM, I get a popup saying

"Failed to read the device signature (Operation Failed. (reading signature)). Accessing a device using the wrong protocol could render the device unusable. Do you want to continue?"

I always click no, since this is a university board, and I'd rather not risk damaging it!
« Last Edit: December 03, 2007, 09:28:05 am by Rick »

Andy Ayre

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2108
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: Command Line ERASE Problem
« Reply #11 on: December 04, 2007, 08:11:19 am »
Please download the latest version and give that a try. Post back if it does not help.

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

Rick

  • Jr. Member
  • **
  • Posts: 11
    • View Profile
Re: Command Line ERASE Problem
« Reply #12 on: December 04, 2007, 09:41:10 am »
I shall, many thanks. Due to other commitments I won't be able to try it until late Thursday or Friday, I shall post back on here regardless of the result.

Thanks for your reply.

Rick

  • Jr. Member
  • **
  • Posts: 11
    • View Profile
Re: Command Line ERASE Problem
« Reply #13 on: December 07, 2007, 01:50:35 am »
I have now repeated with version 4.01, and I still have problems, but I have a more helpful error message for you :).

I would like to add, that it STILL works perfectly on the computers in the lab, so I am somewhat confused as to the potential hardware implications of this message?


"FM.EXE" "DEVICE(P89LPC935,12.0) ERASE(DEVICE,PROTECTISP) HEXFILE("C:\Blinky\Blinky.HEX",NOCHECKSUMS,NOFILL,PROTECTISP) COM(1,9600) HARDWARE(KEILMCB900)"
Flash Magic Version 4.01.259
8051/XA Driver Version 2.41.258
ARM Driver Version 1.31.258
(C) Embedded Systems Academy 2000-2007 All rights reserved
NON PRODUCTION USE ONLY
Connected
Device selected
Erase failed: invalid command - Operation Failed. (Unable to erase page 112 - erase disabled via security bits) (DEVICE)


EDIT: Oh, I meant to add, I try to Read the security bits in FM itself, but I cannot connect at any baud rate, it always says that it can't connect at the specified baud rate. I tried installing FM 1.71, and managed to read them (all unset), but I was still unable to program it.
« Last Edit: December 07, 2007, 01:59:46 am by Rick »

Andy Ayre

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2108
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: Command Line ERASE Problem
« Reply #14 on: December 07, 2007, 07:48:37 am »
OK, please add the directive "DEBUG", rerun and send me via email C:\flashmagic.fmd. This will let me see the comms.

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