diff options
Diffstat (limited to 'downloader')
-rwxr-xr-x | downloader/downloader.py | 6 | ||||
-rw-r--r-- | downloader/proto.txt | 4 |
2 files changed, 6 insertions, 4 deletions
diff --git a/downloader/downloader.py b/downloader/downloader.py index f90eced..b85326f 100755 --- a/downloader/downloader.py +++ b/downloader/downloader.py @@ -108,9 +108,11 @@ def exec_command(dev, cmd, param, answer): 5: "address invalid", 6: "address prohibited", 7: "value out of bounds" } - cstr = bytearray(struct.pack('<BB', cmd, 0) + param) + dev.flushInput() + dev.flushOutput() + + cstr = bytearray(struct.pack('<BB', cmd, len(param)+3) + param) cstr.extend(struct.pack("<B", calc_csum(cstr))) - cstr[1] = len(cstr) dev.write(cstr) astr = bytearray() diff --git a/downloader/proto.txt b/downloader/proto.txt index 17dec93..98beebe 100644 --- a/downloader/proto.txt +++ b/downloader/proto.txt @@ -157,12 +157,12 @@ write eeprom: ~~~~~~~~~~~~~ command: - 7 | len=4+2<len(data) | addr | data | <csum> + 7 | len=4+len(data) | addr | data | <csum> answer: 7 | len=4 | <ret> | <csum> - The bootloader writes <data> (which has to contain exactly <len> bytes) to address + The bootloader writes <data> (which has to contain exactly <len>-4 bytes) to address <addr> inside the eeprom. len is 1byte long and the value must not exceed <mess> bytes. |