*Added cmdRESET to __all__ *Added more erase commands from Vex *resetPIC() no longer returns anything *Added document describing download protocol
| 1 | This file contains information on the protocol used by teh IFI Loader. |
| 2 | |
| 3 | The protocol is packet based. The PC sends a packet to the controller, and the controller sends its response. |
| 4 | |
| 5 | == Packet structure == |
| 6 | Each packet follows the same format: |
| 7 | 0F 0F <BODY> 04 |
| 8 | Where <tt><BODY></tt> is the escaped form of the format: |
| 9 | <CMD> <DATA> <HASH> |
| 10 | ; CMD : A single-byte identifier for the command, which is as follows: |
| 11 | :* 00 - INIT |
| 12 | :* 01 - READ |
| 13 | :* 02 - WRITE |
| 14 | :* 08 - RESET |
| 15 | :* 09 - ERASE |
| 16 | ; DATA : The arguments to the command. May be 0 bytes. |
| 17 | ; HASH : The hash of the rest of the body. Hash is calculated as 2's complement (~sum + 1). |
| 18 | |
| 19 | === Escaping === |
| 20 | Because of the special meaning of 0F, 04, and 05, whenever these data bytes appear in the body, they are prepended by a 05. That is, if the packet body is: |
| 21 | 09 E0 00 08 00 00 0F |
| 22 | The packet sent is: |
| 23 | 0F 0F 09 E0 00 08 00 00 05 0F 04 |
| 24 | |
| 25 | == Commands == |
| 26 | === INIT == |
| 27 | ; Number : 00 |
| 28 | ; Request Data : 02 |
| 29 | ; Response Data : 02 00 01 |
| 30 | |
| 31 | This packet is used to test if the controller is in program mode, and likely initialize it. |
| 32 | |
| 33 | === READ === |
| 34 | ; Number : 01 |
| 35 | ; Request Data : <LENGTH> <ADDRESS> |
| 36 | :; LENGTH : The ammount of data to return |
| 37 | :; ADDRESS : The location of the data (in terms of PIC programmers), in little endian format |
| 38 | ; Response Data : <LENGTH> <ADDRESS> <DATA> |
| 39 | :; LENGTH : The ammount of data returned |
| 40 | :; ADDRESS : The location of the data (in terms of PIC programmers), in little endian format |
| 41 | :; DATA : The data itself, the lowest address transmitted first |
| 42 | |
| 43 | This command reads a location in memory. Note that the memoryspace is not the same as program memory or EEPROM. See Microchip documentation. |
| 44 | |
| 45 | === WRITE === |
| 46 | ; Number : 02 |
| 47 | ; Request Data : <ADDRESS> <DATA> |
| 48 | :; ADDRESS : The location of the data (in terms of PIC programmers), in little endian format |
| 49 | :; DATA : The data itself, the lowest address transmitted first |
| 50 | ; Response Data : (Empty packet) |
| 51 | |
| 52 | Write data to memory. The memoryspace is the same as the READ command. |
| 53 | |
| 54 | There is a response packet, but its data is empty, ie it consists only of a command and a hash. |
| 55 | |
| 56 | === RESET === |
| 57 | ; Number : 08 |
| 58 | ; Request Data : 40 |
| 59 | ; Response Data : (None) |
| 60 | |
| 61 | Causes the controller to reset, exiting program mode and executing the program. No response packet is sent. |
| 62 | |
| 63 | === ERASE === |
| 64 | ; Number : 09 |
| 65 | ; Request Data : <BLOB> |
| 66 | :; BLOB : a 5-byte piece of data |
| 67 | ; Response Data : (Empty packet) |
| 68 | |
| 69 | Causes memory to be erased. The exact nature of the request data is unknown. |
| 70 | |
| 71 | There is a response packet, but its data is empty, ie it consists only of a command and a hash. |
Copyright © 2010 Geeknet, Inc. All rights reserved. Terms of Use