HARSFEN0602ElmoHARmonicaSoftwareManual

PRELIMINARYDRAFT

6.3.2.2The CP command

The CP command clears the entire user area in the serial flash. It may take a significant time. In special, CP sets the Program Valid flag to –1.

Possible Execution Failures:

1)Motor is on.

2)Program is running.

6.3.2.3The CC command

The command CC=xxxx does as follows:

Read the actual length of the user partition from the TOC. Calculate 32-bit checksum for the entire actual user partition.

The checksum shall be calculated by summing all the consecutive 2-bytes sequences (short int numbers) that form the user program space and the checksum number itself. The total summing result must be zero to pass. If the resulting checksum matches xxxx then:

Set the program ready flag.

Copy functions and variables symbol tables from the user partition to internal dsp flash memory

Else an error code is return.

CCreturns 1 if the program ready flag in the serial flash is set Otherwise it returns zero.

Possible Execution Failures:

1)Actual length in the TOC is less then 2 flash pages, or is beyond user program address limit.

2)Calculated checksum doesn’t match to xxxx.

61

6.3.3Downloading a Program

6.3.3.1The DL command

The Dl command executes downloading a program. Downloading to a non-protected area in the Flash goes as follows: LP[1]=start;

DL##xxxxxxxxx<ESC>CS;

where above xxxxxxxxx denotes the escape-sequenced data payload. Start denotes the byte address in the user program flash.

CS denotes the 16 bits checksum for the message, including the DL##. DL takes time, since it has to burn & verify.

Possible Execution Failures:

1) Attempt to write to protected area in the flash. It may happen that DL will start to write legally to the Flash, but its last bytes will attempt an illegal (protected) write. In any case DL command will be rejected, and the contents of the serial flash is unpredictable.

2)DL is used when motor is on.

3)DL is used when program is running.

4)Faulty checksum – DL will be rejected but creates no harm.

5)Verify error – If DL attempts to write to a previously written area in the flash, probably the writing will fail by verify error. In that case the contents of the Flash is unpredictable and the Flash has to be cleared and completely re-written.

6)DL string is too long. The maximum length of a DL string is 500 bytes, due to internal Dama limits.

7)Program Valid flag is not –1. In that case DL command will not be executed (CP must be issued before DL).

6.3.3.2Program downloading process

Page 63
Image 63
Elmo HARSFEN0602, HARmonica CP command, CC command, Downloading a Program DL command, Program downloading process