usb15: add protocol notes

This commit is contained in:
Grigori Goronzy 2016-05-15 02:29:52 +02:00
parent 7ba95eab68
commit c046e886e3

35
doc/usb15-protocol.txt Normal file
View File

@ -0,0 +1,35 @@
STC15 series USB ISP protocol
=============================
- host does OUT and IN control transfers for write and read
- IN transfer with wLength = 132, wValue = 0, wIndex = 0, bRequest = 0 are used for all reads
- OUT transfers with arbitrary size are used for writes
- packets from MCU
always start with 0x46 0xb9, similar to serial protocols
third byte is packet length
followed by data bytes
8 bit checksum at the end, looks like 8 bit modular subtraction
- packet types
most likely derived from the serial protocol, at least partially
info packet
- same as with serial protocol
option packet
- generally same as with serial protocol, some header stuff omitted
- flash data
wIndex specifies write address
wValue is 0xa55a
bRequest is 0x22 for first packet, 0x02 for the following ones
unusually encoded: a total of 128 bytes per packet, with every 7 byte checksummed in some way, for a total of 18x7 byte segments and a final 2 byte segment
checksum: 8 bit inverted modular sum
- option packet
wIndex is 0
wValue is 0xa55a
bRequest is 4
seems to use the same checksumming scheme