Command Line ERASE Problem

Started by EdH, September 14, 2006, 03:27:25 PM

Previous topic - Next topic

EdH

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

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

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

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

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

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

Andy,

The 2 files should be in your inbox...

Thanks, again.

Ed

Andy Ayre

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

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

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

#10
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!

Andy Ayre

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

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

#13
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.

Andy Ayre

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