usb-protocol.txt 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828
  1. The TI-84 Plus USB Protocol
  2. Benjamin Moody (and some updates by R. Liévin)
  3. March 31, 2006
  4. The TI-89 Titanium USB Protocol
  5. Romain Liévin
  6. May 2, 2006
  7. ======================================================================
  8. 1 Introduction
  9. ---------------
  10. This represents my current understanding of the protocol used to
  11. communicate with the OS and boot code of the TI-84 Plus. It is based
  12. mainly on:
  13. - Logs of the communication between the calculator and TI-Connect,
  14. obtained by Romain Liévin and Dan Englender;
  15. - My own analysis of the boot code and OS of the TI-84 Plus SE.
  16. I've been investigating the 84 Plus because that's the calculator I'm
  17. more familiar with. Nevertheless it looks like a lot of this is
  18. applicable to the TI-89 Titanium as well.
  19. Since I don't, as of this writing, have one of these calculators to
  20. play with, I haven't personally tested any of this!
  21. Now, on with the protocol...
  22. 2 Raw Packets
  23. --------------
  24. All data sent over USB is encoded as part of a "raw packet." These
  25. packets have a fixed maximum size specified by the calculator: 255
  26. bytes for the 84 Plus, or 1023 bytes for the Titanium. It seems that
  27. a raw packet may or may not be sent as a single USB transfer (but
  28. sending more than one raw packet as a single transfer is probably not
  29. wise.)
  30. Raw packets have a five-byte header followed by an n-byte data
  31. section:
  32. LL LL LL LL TT DD ...
  33. where
  34. LLLLLLLL = length of the data section;
  35. TT = packet type;
  36. DD = data bytes (LLLLLLLL of them.)
  37. It should be noted that, unlike the DBUS protocol, the length is
  38. transmitted in big endian order (most significant byte first.) In
  39. fact, all 16- and 32-bit numbers sent as part of the USB protocol
  40. (with the exception of numbers that are actually part of variable
  41. data) are transmitted in big-endian order.
  42. For example,
  43. 0x00000004 0x01 0x00 0x00 0x04 0x00
  44. 0x00000002 0x05 0xE0 0x00
  45. 0x00000010 0x04 0x00 0x00 0x00 0x0A 0x00 0x01 0x00 0x03
  46. 0x00 0x01 0x00 0x00 0x00 0x00 0x07 0xD0
  47. are all valid and complete raw packets.
  48. There are five types of raw packets, indicated by the TT field:
  49. TT = 1: Buffer Size Request
  50. TT = 2: Buffer Size Allocation
  51. TT = 3: Virtual Packet Data with Continuation
  52. TT = 4: Virtual Packet Data Final
  53. TT = 5: Virtual Packet Data Acknowledgement
  54. Each of these plays its own crucial role in the protocol, and each
  55. will be discussed in the following sections.
  56. 3 Buffer Size Negotiation
  57. --------------------------
  58. Before any real communication can take place, one crucial question
  59. must be settled: how big can a single raw packet be? At the moment
  60. the TI-84 Plus limits incoming and outgoing raw packets to 255 bytes,
  61. and the 89 Titanium limits them to 1023 bytes, yet that may change in
  62. the future.
  63. The device wishing to initiate communication, therefore, begins by
  64. sending a type 1 (Buffer Size Request) raw packet. The contents of
  65. this packet are a 32-bit integer (big endian, remember) which is the
  66. largest size of raw packet the device is willing to handle. Note
  67. that this length does not include the header; so the TI-84 Plus,
  68. which can handle a total raw packet size of 255 bytes, sends the
  69. number 0xFA, or 250.
  70. The Titanium sends the number 0x3FF or 1023 but acts slightly differently.
  71. It should handle 1028 bytes but instead sends 5 bytes of header and next,
  72. 1023 bytes.
  73. The receiving device must then decide whether the chosen buffer size
  74. is acceptable, or whether it must be made smaller still. (For
  75. example, TI-Connect gives a maximum packet size of one kilobyte,
  76. which is too large for the TI-84 Plus to handle.) The receiving
  77. device chooses a buffer size acceptable to both parties and sends a
  78. type 2 (Buffer Size Allocation) raw packet, whose contents are a
  79. 32-bit integer equal to the chosen size.
  80. The complete negotiation between TI-Connect and a TI-84 Plus thus
  81. goes as follows:
  82. TI-Connect sends 9 bytes stating that it can send and receive packets
  83. up to one kilobyte:
  84. PC->TI: 0x00000004 0x01 0x00000400
  85. The calculator requires a smaller buffer, and replies:
  86. TI->PC: 0x00000004 0x02 0x000000FA
  87. Now both parties have agreed on a buffer size (0xFA.) Of course,
  88. both devices should now take care not to send packets larger than
  89. this size.
  90. It seems that this negotiation must be done at the start of every
  91. "operation;" after the communication is finished, the calculator will
  92. forget about the previously established buffer size.
  93. 4 Virtual Packets
  94. ------------------
  95. 250 bytes is never enough, though. To actually send data back and
  96. forth we want to be able to send blocks of arbitrary size. This is
  97. where virtual packets come in.
  98. A virtual packet is always sent as the payload of one or more raw
  99. packets. Specifically, it is sent as the payload of zero or more
  100. type 3 (Virtual Packet Data with Continuation) raw packets followed
  101. by a single type 4 (Virtual Packet Data Final) raw packet. Only one
  102. virtual packet may be sent at a time; each virtual packet thus ends
  103. with its own type 4 raw packet. The virtual packet is then obtained
  104. by concatenating the contents of the raw packets, in order.
  105. So what is the actual structure of a virtual packet? Very much like
  106. the structure of a raw packet, yet subtly different. It has a
  107. six-byte header instead of five:
  108. LL LL LL LL TT TT DD ...
  109. where, like a raw packet,
  110. LLLLLLLL = length of the data section;
  111. TTTT = packet type;
  112. DD = data bytes (LLLLLLLL of them.)
  113. Thus there can potentially be as many as 65536 different virtual
  114. packet types defined. At the moment there are only about 22 of them,
  115. yet there is room for expansion.
  116. An example is sorely needed at this point. Here is a fairly common
  117. packet, the standard "ping," as it would be sent in a single type 4
  118. raw packet:
  119. 0x00000010 0x04
  120. 0x0000000A 0x0001
  121. 0x00 0x03 0x00 0x01 0x00 0x00 0x00 0x00 0x07 0xD0
  122. Note that the length of this virtual packet's data section is 10, or
  123. 0x0A. But the header is an additional 6 bytes, which brings the
  124. total size of the raw packet's data section to 0x10.
  125. The same virtual packet could also be sent (though it generally
  126. isn't) as a type 3 followed by a type 4:
  127. 0x00000008 0x03
  128. 0x0000000A 0x0001
  129. 0x00 0x03
  130. 0x00000008 0x04
  131. 0x00 0x01 0x00 0x00 0x00 0x00 0x07 0xD0
  132. The actual distribution of data between the raw packets is not
  133. important; in either case the calculator will "unwrap" the same 16
  134. bytes.
  135. Finally, each type 3 or type 4 raw packet must be acknowledged by the
  136. receiving device; this acknowledgement takes the form of a type 5
  137. (Virtual Packet Data Acknowledgement) raw packet. The contents of
  138. this packet are always the 16-bit number 0xE000. I have no idea why.
  139. So the complete transmission of a 10-byte ping, beginning with the
  140. buffer size negotiation, looks like this:
  141. PC->TI: 0x00000004 0x01 0x00000400
  142. TI->PC: 0x00000004 0x02 0x000000FA
  143. PC->TI: 0x00000010 0x04
  144. 0x0000000A 0x0001
  145. 0x00 0x03 0x00 0x01 0x00 0x00 0x00 0x00 0x07 0xD0
  146. TI->PC: 0x00000002 0x05 0xE000
  147. From now on I will ignore all of these details. Where I write that
  148. the calculator "sends a virtual packet with XXXX as its contents"
  149. this implies that the appropriate data will be encoded and sent as a
  150. series of type 3 and 4 raw packets, and of course the PC will
  151. acknowledge each one.
  152. 5 Virtual Packet Types
  153. -----------------------
  154. The following are the types of virtual packets I have been able to
  155. identify thus far. There may be more out there.
  156. TTTT Description
  157. 0x0001 Ping / Set Mode
  158. 0x0002 Begin OS Transfer
  159. 0x0003 Acknowledgement of OS Transfer
  160. 0x0004 OS Header (signature)
  161. 0x0005 OS Data
  162. 0x0006 Acknowledgement of EOT
  163. 0x0007 Parameter Request
  164. 0x0008 Parameter Data
  165. 0x0009 Request Directory Listing
  166. 0x000A Variable Header
  167. 0x000B Request to Send
  168. 0x000C Request Variable
  169. 0x000D Variable Contents
  170. 0x000E Parameter Set
  171. 0x0010 Delete Variable
  172. 0x0011 Unknown
  173. 0x0012 Acknowledgement of Mode Setting
  174. 0xAA00 Acknowledgement of Data
  175. 0xBB00 Delay Acknowledgement
  176. 0xDD00 End of Transmission
  177. 0xEE00 Error
  178. Type 0x0001: Ping / Set Mode
  179. ----------------------------
  180. The "ping" packet is sent to begin every transmission, immediately
  181. following the buffer size negotiation. In fact, it must always be
  182. the first packet sent, as it determines the set of commands the
  183. calculator will accept. The contents of this packet are:
  184. MM MM MM MM MM MM XX XX XX XX
  185. MMMMMMMMMMMM = mode ID;
  186. XXXXXXXX = unknown.
  187. The 84 Plus checks XXXXXXXX to be between 2000 and 131071
  188. (inclusive.) I have no idea what this represents. If it is too
  189. small, an 0x001C error is sent; if it is too big, an 0x001D error is
  190. sent.
  191. Next, MMMMMMMMMMMM is checked. This determines what types of
  192. packets will be allowed in the following transmission. The
  193. following mode ID's are accepted by the 84 Plus OS:
  194. 0x000100010000 Startup mode; only ping is accepted.
  195. 0x000200010000 Basic mode; ping, OS transfer, and parameter
  196. request are accepted.
  197. 0x000300010000 Normal operation mode; ping, parameter request,
  198. directory listing, request to send, request
  199. variable, parameter set, variable delete, and
  200. command 0x0011 are accepted.
  201. The 84 Plus boot code only accepts the first two mode ID's.
  202. If the mode ID is acceptable, a type 0x0012 (Acknowledgement of Mode
  203. Setting) is sent in response. This contains the value of XXXXXXXX.
  204. Type 0x0002: Begin OS Transfer
  205. ------------------------------
  206. This packet begins an OS transfer (or maybe also a certificate
  207. transfer?) It's only accepted in mode 2. An 0x0003
  208. (Acknowledgement of OS Transfer) is sent in response.
  209. The contents of this packet are:
  210. XX XX XX XX XX XX XX HH HL LH LL
  211. XXXXXXXX = unknown.
  212. HHHLLHLL = size of OS data plus header (page, offset and flag), TI84+ only
  213. HHHLLHLL = size of OS data, Titanium only
  214. Type 0x0003: Acknowledgement of OS Transfer
  215. -------------------------------------------
  216. This packet is sent in response to an 0x0002 packet. Its contents
  217. is the following:
  218. HH HL LH LL 00 00 00 00
  219. where HHHLLHLL is the maximum allowed size of an 0x0005 packet.
  220. Type 0x0004: OS Header ?
  221. ------------------------
  222. This packet is sent before sending OS data. It may contains the header.
  223. Same format as packet type 0x0005.
  224. Type 0x0005: OS Data
  225. --------------------
  226. This packet contains OS data. It is analogous to a combination of
  227. the VAR and XDP packets in the DBUS protocol. Its contents are:
  228. AA AA PP FF DD ...
  229. AAAA = Z80 logical address to write data (zero for header and
  230. signature)
  231. PP = page to write data (zero for header and signature)
  232. FF = flag (zero for normal data, 0x80 for header or signature)
  233. DD = OS data, up to 256 bytes.
  234. Type 0x0006: Acknowledgement of EOT
  235. -----------------------------------
  236. This packet is sent in response to an 0xdd00 (End of Transmission)
  237. packet. It seems it is only sent in Flash transfers. Its first
  238. byte is 1 if validation succeeded, or 0 if it failed.
  239. Type 0x0007: Parameter Request
  240. ------------------------------
  241. This packet requests calculator "parameters". This packet's contents are
  242. NN NN ( II II ) ...
  243. NNNN = number of parameters requested;
  244. IIII = 16-bit ID of each parameter requested.
  245. For example, sending a type 0x0007 packet containing
  246. 0x0001 0x0002
  247. requests parameter number 2, which happens to be the product name.
  248. Type 0x0008: Parameter Data
  249. ---------------------------
  250. This packet is sent in response to an 0x0007 (Parameter Request)
  251. packet, whose contents are:
  252. NN NN ( II II VV [ LL LL DD ... ] ) ...
  253. NNNN = number of parameters requested;
  254. for each parameter:
  255. IIII = 16-bit parameter ID;
  256. VV = 0 if the given parameter ID is valid, 1 if it isn't;
  257. and if VV = 0:
  258. LLLL = length of the parameter data;
  259. DD = parameter data (LLLL bytes.)
  260. So for parameter 0x0002, the calculator might reply with a type
  261. 0x0008 packet containing:
  262. 0x0001 (one parameter requested)
  263. 0x0002 (parameter number 2)
  264. 0x00 (parameter is valid)
  265. 0x0019 (parameter data is 0x19 bytes long)
  266. 0x54 0x49 0x2D 0x38 (parameter data: in this case, an
  267. 0x34 0x20 0x50 0x6C ASCII string)
  268. 0x75 0x73 0x20 0x53
  269. 0x69 0x6C 0x76 0x65
  270. 0x72 0x20 0x45 0x64
  271. 0x69 0x74 0x69 0x6F
  272. 0x6E
  273. Multiple parameters can be requested at once; for example a type
  274. 0x0007 packet could contain:
  275. 0x0004 0x0002 0x000E 0x0011 0x0025
  276. if you wanted to retrieve not only the product name, but also the
  277. amount of free RAM, free archive space, and the current time from the
  278. calculator's clock.
  279. Type 0x0009: Request Directory Listing
  280. --------------------------------------
  281. This packet requests a directory listing. Each packet sent in reply
  282. will contain both the variable name and certain variable attributes;
  283. this packet allows you to specify which attributes you're interested
  284. in. Its contents should be:
  285. NN NN NN NN ( II II ) ... 0x00 0x01 0x00 0x01 0x00 0x01 0x01
  286. \---------- ?????????? ----------/
  287. NNNNNNNN = number of variable attributes requested;
  288. IIII = 16-bit ID of each attribute requested.
  289. The calculator will reply with a series of 0x000A packets, each
  290. containing a variable name and the requested attributes.
  291. Type 0x000A: Variable Header
  292. ----------------------------
  293. This packet is sent either
  294. (a) as part of a directory listing; or
  295. (b) in response to an 0x000C (Request Variable) packet.
  296. In addition to the name, it can contain zero or more variable
  297. "attributes," which can be any sort of variable metadata (type,
  298. size, archived state, perhaps the folder name...)
  299. The contents of this packet are (TI84+):
  300. LL LL UU ... 0x00 | NN NN ( II II VV [ JJ JJ DD ... ] ) ...
  301. \__/
  302. |
  303. NULL terminator
  304. The contents of this packet are (Titanium):
  305. LL UU ... 0x00 LL UU ... 0x00 | NN NN ( II II VV [ JJ JJ DD ... ] ) ...
  306. \_________/ \_________/
  307. folder varname
  308. Note that the header changes between TI84+ & Titanium (vars only, FLASH app follows the
  309. same scheme as TI84+). The same header apply for 0x000B, 0x000C and 0x0010 packets.
  310. You will have to update them consequently...
  311. Kevin Kofler says that a generic format for all hand-helds could be:
  312. LL MM UU ... 0x00 | NN NN ( II II VV [ JJ JJ DD ... ] ) ...
  313. LL UU ... 0x00 MM UU ... 0x00 | NN NN ( II II VV [ JJ JJ DD ... ] ) ...
  314. LLLL = length of variable's name;
  315. UU = variable name in UTF-8 (LLLL bytes);
  316. NNNN = number of variable attributes;
  317. for each attribute:
  318. IIII = 16-bit attribute ID;
  319. VV = 0 if attribute is valid;
  320. and if VV = 0:
  321. JJJJ = length of attribute data;
  322. DD = attribute data (JJJJ bytes.)
  323. For example:
  324. 0x0001 0x41 (Variable name: "A")
  325. 0x00 (???)
  326. 0x0006 (6 attributes present)
  327. 0x0002 (Attribute number 2 / data type:)
  328. 0x00 0x0004 (Attribute is valid, data is 4 bytes)
  329. 0xF0070000 (Data type.)
  330. 0x0003 (Attribute number 3 / is variable archived?:)
  331. 0x00 0x0001 (Attribute is valid, data is 1 byte)
  332. 0x00 (Variable is not archived.)
  333. 0x0005 (Attribute number 5)
  334. 0x01 (Attribute is invalid)
  335. 0x0001 (Attribute number 1 / variable data size:)
  336. 0x00 0x0004 (Attribute is valid, data is 4 bytes)
  337. 0x00000009 (Variable data is 9 bytes.)
  338. 0x0041 (Attribute number 41)
  339. 0x01 (Attribute is invalid)
  340. 0x0042 (Attribute number 42)
  341. 0x01 (Attribute is invalid)
  342. Known attributes:
  343. 0x0001 4 bytes Variable size
  344. 0x0002 4 bytes Variable type
  345. 0x0003 1 byte Is archived / in Flash
  346. 0x0004 1 byte Unknown (always 0).
  347. 0x0005 4 bytes First four bytes of an AppVar. By TI's convention, the first four
  348. bytes identify the program that created the AppVar.
  349. 0x0008 1 byte Variable "version". This is 0 for most variables, but 1 for programs
  350. that include 83+-specific functions (and thus won't work on an 82 or 83.)
  351. It's probably increased for 84+-specific functions as well.
  352. 0x0008 4 bytes Set to 1 when sending app on Titanium (Titanium only).
  353. 0x0011 4 bytes Variable type : used for requesting variables instead of type 0x0002.
  354. 0x0013 1 byte Unknown (always 0, used for deleting of variable)
  355. 0x0041 1 byte Is locked
  356. 0x0042 1 byte Unknown
  357. A variable type is the standard type ID plus either 0xF0030000,
  358. 0xF0070000, or 0xF00B0000. (Perhaps this varies with the device
  359. type.)
  360. Titanium: 0xF00C0000.
  361. Type 0x000B: Request to Send
  362. ----------------------------
  363. This is a variation of the variable header packet. Its contents are:
  364. LL LL UU ... 00 | 00 00 00 09 01 NN NN ( II II JJ JJ DD ... ) ...
  365. \/ \_varsize_/ \?/
  366. |
  367. NULL terminator
  368. LLLL = length of name;
  369. UU = variable name in UTF-8 (LLLL bytes);
  370. NNNN = number of attributes;
  371. and for each attribute:
  372. IIII = 16-bit attribute ID (see above);
  373. JJJJ = length of attribute data;
  374. DD = attribute data (JJJJ bytes.)
  375. Note the lack of VV bytes, as all attributes the PC is sending are
  376. presumably valid.
  377. Type 0x000C: Variable Request
  378. -----------------------------
  379. This is also a variation of the variable header packet. It requests
  380. both a variable header and the variable contents, so it includes
  381. BOTH a list of attributes the PC provides (data type) and a list of
  382. attributes the calculator needs to provide (variable size, is it
  383. archived?) Its contents are:
  384. /----- ?????????? -----\
  385. LL LL UU ... 0x00 | 0x01 0xFF 0xFF 0xFF 0xFF
  386. NN NN ( II II ) ...
  387. MM MM ( II II JJ JJ DD ... ) 0x00 0x00
  388. \- ??? -/
  389. LLLL = length of name;
  390. UU = variable name in UTF-8 (LLLL bytes);
  391. NNNN = number of attributes requested;
  392. for each attribute:
  393. IIII = 16-bit attribute ID;
  394. MMMM = number of attributes specified;
  395. for each attribute:
  396. IIII = 16-bit attribute ID;
  397. JJJJ = length of attribute data;
  398. DD = attribute data (JJJJ bytes.)
  399. Note: When you specify the variable type, you must use attribute
  400. 0x0011 rather than 0x0002. I don't know why.
  401. Type 0x000D: Variable Contents
  402. ------------------------------
  403. This packet simply contains the contents of the variable previously
  404. agreed upon. All meta-data is sent as part of the 0x000A or 0x000B
  405. packet.
  406. Type 0x000E: Parameter Set
  407. --------------------------
  408. This packet attempts to set a parameter value.
  409. You can also remotely assign values to certain parameters. (This is
  410. the way to set the clock, for instance.) To set a parameter, send an
  411. 0x000E packet containing:
  412. II II LL LL DD ...
  413. The calculator will either acknowledge with 0xAA00, or return an
  414. 0x0022 error if the parameter ID is invalid. Note that only one
  415. parameter can be set at once.
  416. Type 0x0010: Delete Variable
  417. ----------------------------
  418. This is yet another variation of the variable header packet. Its
  419. contents are:
  420. LL LL UU ... 0x00 | NN NN ( II II JJ JJ DD ... ) ...
  421. 0x01 0x00 0x00 0x00 0x00
  422. LLLL = length of name;
  423. UU = variable name in UTF-8 (LLLL bytes);
  424. NNNN = number of attributes;
  425. and for each attribute:
  426. IIII = 16-bit attribute ID (see above);
  427. JJJJ = length of attribute data;
  428. DD = attribute data (JJJJ bytes.)
  429. If successful, the calculator sends an 0xAA00 (Acknowledgement of
  430. Data) packet in response.
  431. Type 0x0012: Acknowledgement of Mode Setting
  432. --------------------------------------------
  433. This packet is sent in response to a ping. Its contents are four
  434. bytes: the same XXXXXXXX value sent in the ping.
  435. Type 0xAA00: Acknowledgement of Data
  436. ------------------------------------
  437. This packet is sent to acknowledge many different commands. Its
  438. contents are a single byte, which always appears to be 1.
  439. Type 0xBB00
  440. -----------
  441. This is a strange one. The calculator appears to ignore this packet
  442. when it is received. Sometimes it is sent after an 0x0007 packet is
  443. received; sometimes it isn't. It usually contains the number
  444. 0x0001d4c0 (120000) or 0x00057E40 (360000).
  445. [Incidentally, I have an idea about the BB00 packet. Its contents seem to
  446. be used as a timeout. Perhaps it simply means "wait for X milliseconds
  447. for the next packet," and it's sent whenever the calculator expects to
  448. take a long time to respond. That would seem to make sense in the
  449. contexts where it is used.]
  450. Type 0xDD00: End of Transmission
  451. --------------------------------
  452. This packet is sent when an OS transfer or directory listing is
  453. done.
  454. Type 0xEE00: Error
  455. ------------------
  456. This packet indicates an error; the contents are a 2-byte error
  457. code.
  458. Error codes include:
  459. 00 04 = invalid argument or name
  460. 00 06 = can't delete app
  461. 00 08 = transmission error or invalid code
  462. 00 09 = using basic mode while being in boot mode
  463. 00 0c = out of memory
  464. 00 0e = invalid name
  465. 00 12 = can't overwrite, variable is locked/archived
  466. 00 1c = mode token too small
  467. 00 1d = mode token too large
  468. 00 22 = invalid parameter ID
  469. 00 2b = battery low (sending OS)
  470. 00 34 = invalid FLASH app?
  471. 6 Variable Transfers
  472. ---------------------
  473. Transferring variable data is done by the same overall method used in
  474. the DBUS protocol. Before sending or requesting a variable, you may
  475. want to retrieve a directory listing, which is done as follows:
  476. PC->TI: Request Directory Listing (0x0009)
  477. TI->PC: Variable Header (0x000A)
  478. TI->PC: Variable Header (0x000A)
  479. ...
  480. TI->PC: End of Transmission (0xDD00)
  481. To request a variable to be sent:
  482. PC->TI: Request Variable (0x000C)
  483. TI->PC: Variable Header (0x000A)
  484. TI->PC: Variable Contents (0x000D)
  485. To request to send a variable (silently):
  486. PC->TI: Request to Send (0x000B)
  487. TI->PC: Acknowledge (0xAA00)
  488. PC->TI: Variable Contents (0x000D)
  489. TI->PC: Acknowledge (0xAA00)
  490. PC->TI: End of Transmission (0xDD00)
  491. To request that a variable be deleted:
  492. PC->TI: Delete Variable (0x0010)
  493. TI->PC: Acknowledge (0xBB00), Titanium only or TI84+ when deleting FLASH app (garbage collecing).
  494. TI->PC: Acknowledge (0xAA00)
  495. 7 Flash Transfers
  496. ------------------
  497. Transferring FLASH apps is done by the same overall method used in
  498. the DBUS protocol.
  499. To request a FLASH app to be sent (same as requesting of var):
  500. PC->TI: Request Variable (0x000C)
  501. TI->PC: Variable Header (0x000A)
  502. TI->PC: Variable Contents (0x000D)
  503. To request to send a FLASH app:
  504. PC->TI: Request to Send (0x000B)
  505. TI->PC: Acknowledge (0xBB00)
  506. TI->PC: Acknowledge (0xAA00)
  507. PC->TI: Variable Contents (0x000D)
  508. TI->PC: Acknowledge (0xBB00)
  509. TI->PC: Acknowledge (0xAA00)
  510. PC->TI: End of Transmission (0xDD00)
  511. 8 OS Transfers
  512. --------------
  513. Transferring FLASH OS is done on the following scheme:
  514. PC->TI: Ping / Set Mode (to basic mode)
  515. TI->PC: Acknowledge (0x0012)
  516. PC->TI: Begin OS Transfer (0x0002)
  517. TI->PC: Buffer Size Request (size = 256 + 10 bytes) (*)
  518. PC->TI: Buffer Size Negotiation (*)
  519. TI->PC: Acknowledge of OS Transfer (0x0003)
  520. PC->TI: OS Header (0x0004)
  521. TI->PC: Acknowledge (0xBB00), Titanium only
  522. TI->PC: Acknowledge of OS Transfer (0x0003)
  523. PC->TI: OS Data (0x0005)
  524. TI->PC: Acknowledge (0xBB00), Titanium only
  525. TI->PC: Acknowledge (0xAA00)
  526. ...
  527. PC->TI: OS Data (0x0005)
  528. TI->PC: Acknowledge (0xBB00), Titanium only
  529. TI->PC: Acknowledge (0xAA00)
  530. PC->TI: End Of Transmission (0xDD00)
  531. TI->PC: Acknowledge (0xBB00), TI84+ only
  532. TI->PC: Acknowledge of EOT (0x0006)
  533. Note (TI84+):
  534. OS header and first packet have AAAA=4000, PP=7A, FF=80.
  535. Last packet has AAAA=4100, PP=7A, FF=80.
  536. Others begins with AAAA=4000 and FF=00.
  537. Note (Titanium):
  538. OS header contains the certificate part.
  539. Other packets are raw data.
  540. (*) the negotiation takes place on the first transfer attempt. If transfer failed (hand-held
  541. in boot mode, waiting for OS receival), then this step is skipped.
  542. 9 Calculator Parameters
  543. ------------------------
  544. A great deal of non-variable data (much more than was ever available
  545. through the DBUS protocol) is available in the form of "parameters."
  546. These are simply strings of binary data which can be read from (and
  547. some written to) the calculator.
  548. The following parameters are present on the TI-84 Plus as of OS 2.40
  549. and Titanium as of OS 3.00:
  550. (B = parameter available in boot mode; W = parameter writable.)
  551. ID B W Type Description
  552. 0001 * Int32 Product number? (0x0000000A for the 84 Plus)
  553. 0002 * String Product name, e.g. "TI-84 Plus Silver Edition"
  554. 0003 * 5 bytes Main part of calculator ID in binary (TI84+), Full part of ID-LIST in ASCII (Titanium)
  555. 0004 * Int16 Hardware version
  556. 0005 * Unknown Unknown (TI84+), 18-bytes ID-LIST (Titanium)
  557. 0006 Byte Language ID
  558. 0007 Byte Sub-Language ID
  559. 0008 * Int16 DBUS device type (0x0073 for the 84 Plus, 0x98 for the Titanium)
  560. 0009 * 4 bytes Boot Version (16 bit major, 8 bit minor, 8 bit micro)
  561. 000A * Byte 0 = no OS loaded (boot mode), 1 = OS loaded
  562. 000B 4 bytes OS Version (16 bit major, 8 bit minor, 8 bit micro)
  563. 000C * Int64 Amount of RAM physically present
  564. 000D * Int64 Maximum amount of RAM available to user
  565. 000E Int64 Amount of RAM currently free
  566. 000F * Int64 Amount of FlashROM physically present
  567. 0010 * Int64 Maximum amount of Flash available to user
  568. 0011 Int64 Amount of Flash currently free
  569. 0012 Int64 Maximum number of App pages available
  570. 0013 Int64 Number of App pages free
  571. 0019 Byte Unknown (always 1)
  572. 001A Byte Unknown (always 0)
  573. 001B Byte Unknown (always 0)
  574. 001C Byte Unknown (always 1)
  575. 001D Byte Unknown (always 1)
  576. 001E Int16 LCD width?
  577. 001F Int16 LCD height?
  578. 0022 768 bytes LCD contents
  579. 0023 Byte Unknown (always 1)
  580. 0024 * Byte 0 = clock off, 1 = clock on
  581. 0025 * Int32 Clock (seconds since 1997 Jan 1)
  582. 0027 * Byte 0 = Y/M/D, 1 = M/D/Y, 2 = D/M/Y | 3 = M.D.Y, 4 = D.M.Y, 5 = Y.M.D, 6 = M-D-Y, 7 = D-M-Y, 8 = Y-M-D (Titanium date style)
  583. 0028 * Byte 0 = 12 hour, 1 = 24 hour mode
  584. 0029 Byte Unknown (always 0)
  585. 002D * Byte 0 = battery low, 1 = battery good
  586. 0030 * 32 bytes Unknown
  587. 0031 Unknown List of Certificates
  588. 0032 * Byte Unknown (0 or 1 according to system flag 5,(iy+51))
  589. 0036 16 bytes Calculator ID, maybe?
  590. 0037 * Byte 0 = not at homescreen, 1 = at homescreen
  591. 0038 Byte Unknown (always 0)
  592. 0039 Byte 0 = screen not split, 1 = screen split
  593. To request a parameter to be sent
  594. PC->TI: Request Parameter (0x0007)
  595. TI->PC: Acknowledge (0xBB00), TI84+ only
  596. TI->PC: Parameter Data (0x0008)
  597. To request to send a parameter
  598. PC->TI: Parameter Set (0x000E)
  599. TI->PC: Acknowledge (0xAA00)
  600. ---
  601. $Id
  602. Available on TiLP CVS at <http://svn.tilp.info/cgi-bin/viewcvs.cgi/linkguide/trunk/usb-protocol.txt?rev=2245&root=tilp&view=auto>