summaryrefslogtreecommitdiff
path: root/downloader/proto.txt
diff options
context:
space:
mode:
Diffstat (limited to 'downloader/proto.txt')
-rw-r--r--downloader/proto.txt52
1 files changed, 27 insertions, 25 deletions
diff --git a/downloader/proto.txt b/downloader/proto.txt
index e85368e..17dec93 100644
--- a/downloader/proto.txt
+++ b/downloader/proto.txt
@@ -17,11 +17,13 @@ Command List:
Description:
------------
-Every command consits of one byte command code, a fixed number of bytes as
-arguments and ends with a XOR checksum over all bytes sent. All data is
+Every command consits of one byte command code, one byte length which counts all
+bytes of the command including the command code and checksum. The length is followed
+by zero or more data and a XOR checksum over all bytes sent. All data is
transferred LSB first (aka little endian). All addresses and words are 2bytes long.
-Every answer to a command starts with the command code. One byte return value,
-optionally some data and a checksum (XOR over all bytes received)
+Every answer to a command starts with the command code a length field which counts all
+bytes of the answer, one byte return value optionally some data and a checksum
+(XOR over all bytes received).
The return codes have the following meaning:
code | Error
@@ -38,10 +40,10 @@ The return codes have the following meaning:
identify:
~~~~~~~~~
command:
- 1 | <csum> (in this case <csum> will always be 1)
+ 1 | len=3 | <csum>
answer:
- 1 | <ret> | version | name | devid | fss | mess | supported | <csum>
+ 1 | len=22 | <ret> | version | name | devid | fss | mess | supported | <csum>
version:
2bytes, protocol version
@@ -64,7 +66,7 @@ identify:
operation first.
mess:
- 2bytes, maximum eeprom segment size
+ 1byte, maximum eeprom segment size
This represents the maximum number of eeprom bytes which may be written or
read at once. Unlike <fss> value it is ok to write or read less than <mess>
bytes.
@@ -89,10 +91,10 @@ boot:
~~~~~
command:
- 2 | <csum> (in this case <csum> will always be 2)
+ 2 | len=3 | <csum>
answer:
- 2 | <ret> | <csum>
+ 2 | len=4 | <ret> | <csum>
This instucts the bootloader to boot to the user application directly (no reset)
@@ -101,10 +103,10 @@ reset:
~~~~~~
command:
- 3 | <csum> (in this case <csum> will always be 3)
+ 3 | len=3 | <csum>
answer:
- 3 | <ret> | <csum>
+ 3 | len=4 | <ret> | <csum>
The device performs a reboot. If the boot condition (i.e.: port pin) is not met
this instructs the device to boot to the user application.
@@ -114,10 +116,10 @@ read flash:
~~~~~~~~~~~
command:
- 4 | addr | <csum>
+ 4 | len=5 | addr | <csum>
answer:
- 4 | <ret> | data | <csum>
+ 4 | len=4+2*<fss> | <ret> | data | <csum>
The bootloader reads <fss> words from flash address <addr> and returns it as
<data>.
@@ -127,10 +129,10 @@ write flash:
~~~~~~~~~~~~
command:
- 5 | addr | data | <csum>
+ 5 | len=5+2*<fss> | addr | data | <csum>
answer:
- 5 | <ret> | <csum>
+ 5 | len=4 | <ret> | <csum>
The bootloader writes <data> (which has to contain exactly <fss> words) to address
<addr> inside the flash. The start address has to be aligned to <fss> boundaries.
@@ -142,36 +144,36 @@ read eeprom:
~~~~~~~~~~~~
command:
- 6 | addr | len | <csum>
+ 6 | len=5 | addr | len | <csum>
answer:
- 6 | <ret> | data | <csum>
+ 6 | len=4+<len> | <ret> | data | <csum>
The bootloader reads <len> bytes from eeprom at address <addr> and returns it as
- <data>. len is 2bytes long.
+ <data>. len is 1byte long.
write eeprom:
~~~~~~~~~~~~~
command:
- 7 | addr | len | data | <csum>
+ 7 | len=4+2<len(data) | addr | data | <csum>
answer:
- 7 | <ret> | <csum>
+ 7 | len=4 | <ret> | <csum>
The bootloader writes <data> (which has to contain exactly <len> bytes) to address
- <addr> inside the eeprom. len is 2bytes long and the value must not exceed <mess> bytes.
+ <addr> inside the eeprom. len is 1byte long and the value must not exceed <mess> bytes.
read config:
~~~~~~~~~~~~
command:
- 8 | nr | <csum>
+ 8 | len=3 | nr | <csum>
answer:
- 8 | <ret> | word | <csum>
+ 8 | len=6 | <ret> | word | <csum>
The bootloader reads and returns the configuration word number <nr>. <nr> is one
byte long.
@@ -181,10 +183,10 @@ write config:
~~~~~~~~~~~~~
command:
- 9 | nr | word | <csum>
+ 9 | len=5 | nr | word | <csum>
answer:
- 9 | <ret> | <csum>
+ 9 | len=4 | <ret> | <csum>
The bootloader writes <word> onto configuration word number <nr>. <nr> is one
byte long.