Setting COM with command line

Started by Peter Sorrell, March 25, 2009, 03:19:02 AM

Previous topic - Next topic

Peter Sorrell

I want to use the command line facility to read the contents of flash into a file.
First I need to configure the communications and I have tried using "fm COM(3, 38400)".
I get no response from this command, but the manual says I should get either:
"Connected" or
"Connection failed: <reason>"
I have tried other port and baud rate settings, but nothing works.

Please help

Andy Ayre

You are setting the COM port configuration, but you are not giving Flash Magic anything to do. Try adding a HEXFILE directive.

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

Peter Sorrell

Thanks for your prompt response Andy.

I have tried the following command:
"fm com(3,38400) read(0x0000,0x3ffff,test.hex)"
and get one of the following two responses:
"Connection failed: COM port error " or
"Connection failed: unable to connect (no response from device)"

I have also tried:
"fm com(3,38400) hexfile(check.hex,NOCHECKSUMS,NOFILL,NOPROTECTISP)"
with the same result

Please note that the Windows version works fine, so I assume that the COM port is OK.

Andy Ayre

Start the graphical version.
Go to File -> Save Command Line Directives
Save as directives.txt
Run the command line version with FM @directives.txt

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

Peter Sorrell

I have done as you suggest and get a directives.txt as follows:
COM(3, 38400)
DEVICE(LPC2367, 4.000000)
HARDWARE(BOOTEXEC, 50, 100)
ERASE(DEVICE, PROTECTISP)
HEXFILE(C:\Program Files\Flash Magic\check.hex, NOCHECKSUMS, NOFILL, PROTECTISP)
VERIFY(C:\Program Files\Flash Magic\check.hex, NOCHECKSUMS)

When I run the command "fm @directives.txt" I get the message "Connection failed: invalid command"

Andy Ayre

Hmm...strange. This means that it failed to autobaud with the bootloader. I tried your directives with the current version and a Keil MCB2100 board and it worked for me. I had to change the COM port number from 3 to 1 though.

Are you using the current version?

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

Peter Sorrell


Peter Sorrell

I am using a USB-to-serial adapter for my comms.
However I have tried another PC direct to COM1 and still get the same results.

Andy Ayre

Embedded Systems Academy, Inc.
support at esacademy dot com

Peter Sorrell

I have installed Flash Magic 4.62.1584 and the command line interface seems to work OK.
I have used the following command:
fm @readflash.txt
where readflash is:
COM(3, 38400)
DEVICE(LPC2367, 4.000000)
HARDWARE(BOOTEXEC, 50, 100)
READ(0x0000,0x3FFFF,TEST.HEX)

The only problem is that the resultant hex file is in a different format from the original:
Start of original file:
:020000040000FA
:1000000018F09FE518F09FE518F09FE518F09FE5C0
:1000100018F09FE5586FA0B818F09FE518F09FE51D

Start of retrieved file:
:020000040000FA
:4000000018F09FE518F09FE518F09FE518F09FE518F09FE5586FA0B818F09FE518F09FE540000000F03C0100343D0100843D0100CC3D0100000000001C3E0100A4BD010065

Can the format be changed?


Andy Ayre

The output hex file should be valid according to the specification from Intel.

To shorten the lines you could try running it through hex2bin and then bin2hex. Search on Google for these files.

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

Peter Sorrell