|
Download Protocol - Synchronization ProcessBefore you can start sending any data to the datalink, you have to send a series of sync bytes:
Once the watch has gotten the Sync bytes, it will look for a series of at
least four
Once in initialization mode, it will start looking for the data bytes. If
it sees a Once it has gone into data transfer mode, it expects a series of 2 byte groups where the low bit of the first byte and the high bit of the second byte (I call these the middle bits) must match to be sync bits. It expects these sync bits to alternate between 0 and 1. Any 2 byte group which does not match this will be thrown out. Also, if no valid bytes are received within 1/5 second, the transfer operation is aborted. Sync BitsWith these sync bits, you can only transfer 14 bits of data for every 16 bits sent. (There are actually 2 extra sync bits on the screen to act as start and stop bits). If you look at it, that means that you can get 7 bytes transferred for every 8 bytes sent. The organization of these bits are: abcdefg- -ijklmnh qrstuop+ +yzABvwx GHICDEF- -OPJKLMN WQRSTUV+ +XYZ1234 Where - and + represent the sync bits (zero and one) in the byte pairs. If you decode these bits into the corresponding bytes, you get: abcdefgh ijklmnop qrstuvwx yzABCDEF GHIJKLMN OPQRSTUV WXYZ1234 Note that you always have to send in byte pairs, but the code is smart enough to throw away an extra byte which does not fit in a packet. All packets end with a 2 byte 16-Bit CRC. I think that the most interesting packet of all of this is the CPACKET_JMPMEM. It is possible to reset the watch by just sending this packet in the stream:
What this does is tells it to jump to location 04 3e which happens to be
the address of where the 4th byte in the packet is stored. The code executes
the 18 94 which is a
Would change the download tone to be a LOW C. Replace the 01 with any value
up to 0f and you can actually play a tune as it is downloading. (The note
at You can also use this code to indicate a status on the watch by setting the individual segments on the bottom:
Would turn on the AM indicator. Of course since you can't look at the watch while it is downloading, it would be little silly. However, this can be a great debug aid for someone working on the download protocol since the symbols are not cleared out once the download process starts. The CPACKET_MEM packet is also pretty useful. You can use it to set any of the locations in ram to a particular value. This might be useful if you know that you have a certain Wristapp already loaded and you want to change some data stored in the wristapp. All you need is the address to store the data in and the data that you want to put there. Packet Format
This skip packet does get sent to the Datalink, but its contents are completely ignored.
This JMPMEM packet is useful for jumping to/calling specific locations in memory during the download process.
This is the Initialization packet to start loading a section. There are three formats based on the section to be loaded.
This is the data packet sent after a CPACKET_SECT. The number of packets sent will be dependent on the section and is indicated in the CPACKET_SECT packet. Once these packets start getting sent, there should be no other packets until a CPACKET_END is encountered (although there is really no error checking done on it). If the download is terminated without the last CPACKET_END being seen or the right number of CPACKET_DATA packets, the entire section is ignored.
This packet marks the end of a section.
This Packet is used to clear out a section.
This packet is used to set the alarm information for a single alarm.
This single packet is used to set the time. It should be sent early in the process in ensure the best synchronization with the CPU clock time.
This packet is used to store a number of bytes into memory at a fixed location. Note that it is not used for loading up a wristapp because other information has to be reset when a wristapp has been loaded.
This packet is used to control the hourly chimes and button beep flags.
|