annotate doc/comm-docu.txt @ 642:a9a0188091e4

fix rare upgrade issue with OSTC sport 2019 hardware
author heinrichsweikamp
date Thu, 14 Jan 2021 16:24:07 +0100
parents 185ba2f91f59
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
1 OSTC hwos Tech Firmware COMM Mode Documentation
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
2 ===============================================
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
3
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
4 Remarks: - timeouts restart on each received byte
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
5 - 3 byte start address and 3 byte length are expected in network byte format (big endian)
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
6
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
7
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
8 comm_mode_selection_loop: ## entry point when COMM Mode is started ##
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
9
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
10 try to receive 1 byte, timeout after 4 minutes
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
11 received 0xBB -> goto comm_download_mode
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
12 received 0xAA -> goto comm_service_mode_check
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
13 timeout -> send 0xFF
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
14 quit comm mode
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
15
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
16
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
17 comm_service_mode_check: ## received start byte for service mode, await service key ##
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
18
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
19 send 0x4B
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
20 |
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
21 | Attention: do not send the next 3 bytes in one batch, wait for
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
22 | the echo of each byte before sending the next one
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
23 |
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
24 try to receive 1 byte (upper byte of comm service key), timeout after 400 ms
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
25 echo received byte
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
26 try to receive 1 byte (high byte of comm service key), timeout after 400 ms
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
27 echo received byte
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
28 try to receive 1 byte (low byte of comm service key), timeout after 400 ms
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
29 echo received byte
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
30 service key correct -> enable comm_service_mode, goto comm_command_loop
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
31 service key not correct -> goto comm_mode_selection_loop
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
32 timeout -> goto comm_mode_selection_loop
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
33
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
34
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
35 comm_download_mode: ## received start byte for download mode ##
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
36
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
37 send 0xBB
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
38 goto comm_command_loop
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
39
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
40
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
41 comm_command_loop: ## wait for a command ##
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
42
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
43 if comm_service_mode is enabled -> send 0x4C
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
44 else -> send 0x4D
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
45
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
46 try to receive 1 byte, timeout after 2 minutes
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
47
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
48 timeout -> send 0xFF and quit comm mode
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
49 received 0x6E -> goto comm_show_text n show a text on the screen
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
50 received 0x69 -> goto comm_identify i send ID: serial, firmware, and custom text
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
51 received 0x6A -> goto comm_hardware_descriptor j send ID: hardware descriptor byte
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
52 received 0x60 -> goto comm_feature_and_hardware ' send ID: more detailed information
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
53 received 0x6D -> goto comm_send_headers_short m send all headers in compact format
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
54 received 0x61 -> goto comm_send_headers_full a send all headers is full format
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
55 received 0x66 -> goto comm_send_dive f send header and profile for one dive
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
56 received 0x62 -> goto comm_set_time b set the real time clock
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
57 received 0x63 -> goto comm_set_custom_text c write a new custom text
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
58 received 0x72 -> goto comm_read_option r read an option value
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
59 received 0x77 -> goto comm_write_option w write an option value (into RAM)
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
60 received 0x78 -> goto comm_option_reset_all x reset all option values to their factory default
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
61 received 0xFF -> send 0xFF and quit comm mode
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
62
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
63 the following commands are only evaluated if comm_service_mode is enabled:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
64
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
65 received 0x23 -> goto comm_reset_battery_gauge # reset the battery gauge registers
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
66 received 0x22 -> goto comm_erase_complete_logbook " reset all logbook pointers and the logbook
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
67 received 0x20 -> goto comm_read_range ' ' read a memory range from the external FLASH
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
68 received 0x40 -> goto comm_erase_4kb @ erase one 4 kB block - Warning: no confirmation or built-in safety here...
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
69 received 0x42 -> goto comm_erase_range4kb B erase a range of 4 kB blocks - Warning: no confirmation or built-in safety here...
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
70 received 0x30 -> goto comm_write_range_stream 0 write a stream of bytes starting at ext_flash_address:3 until timeout
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
71 received 0x31 -> goto comm_write_range_block 1 write a block of 256 bytes starting at ext_flash_address:3 (only available with FW >= 3.08)
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
72 received 0x50 -> goto comm_firmware_update P initiate firmware update
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
73 received 0xC1 -> goto comm_cold_start start low-level bootloader
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
74
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
75
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
76
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
77 comm_set_time: ## set the real time clock ##
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
78
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
79 send 0x62
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
80 try to receive 6 bytes in sequence: hour, minute, second, month, day, year, timeout 400 ms
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
81 timeout -> goto comm_command_loop
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
82 else -> set RTC, goto comm_command_loop
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
83
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
84
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
85 comm_show_text: ## write a 15 char text to the OSTC display ##
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
86
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
87 send 0x6E
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
88 try to receive 16 characters, timeout 400 ms
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
89 print whatever has been received to the display
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
90 goto comm_command_loop
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
91
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
92
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
93 comm_identify: ## reply serial, firmware and custom text ##
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
94
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
95 send 0x69
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
96 send 1 byte serial number, low byte
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
97 send 1 byte serial number, high byte
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
98 send 1 byte firmware version, major
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
99 send 1 byte firmware version, minor
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
100 send 60 byte custom text
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
101 goto comm_command_loop
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
102
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
103
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
104 comm_hardware_descriptor: ## reply short hardware descriptor ##
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
105
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
106 send 0x6A
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
107 send 1 byte hardware descriptor
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
108 goto comm_command_loop
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
109
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
110
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
111 comm_feature_and_hardware: ## reply detailed hardware descriptor ##
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
112
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
113 send 0x60
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
114 send 0x00
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
115 send 1 byte hardware descriptor
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
116 send 0x00
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
117 send 0x00
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
118 send 0x00
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
119 goto comm_command_loop
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
120
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
121
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
122 comm_send_headers_short: ## send short version of dive headers ##
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
123
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
124 send 0x6D
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
125 send 256 x 16 bytes (extract from the headers)
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
126 goto comm_command_loop
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
127
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
128
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
129 comm_send_headers_full: ## send complete dive headers ##
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
130
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
131 send 0x61
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
132 send 256 x 256 bytes
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
133 goto comm_command_loop
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
134
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
135
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
136 comm_send_dive: ## send one full dive ##
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
137
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
138 send 0x66
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
139 try to receive 1 byte (dive index), timeout 400 ms
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
140 timeout -> goto comm_command_loop
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
141 no profile data available -> goto comm_command_loop
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
142 else -> send 256 byte dive header (begins with 0xFAFA)
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
143 send ??? byte dive profile (ends with 0xFDFD)
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
144 goto comm_command_loop
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
145
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
146
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
147 comm_option_reset_all: ## reset all options to factory default ##
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
148
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
149 send 0x78
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
150 reset all option values to default
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
151 goto comm_command_loop
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
152
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
153
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
154 comm_set_custom_text: ## set custom text ##
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
155
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
156 send 0x63
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
157 try to receive 60 byte, timeout 400 ms
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
158 clear complete old custom text
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
159 store the 0...60 bytes that have been received as new custom text
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
160 goto comm_command_loop
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
161
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
162
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
163 comm_reset_battery_gauge: ## reset battery gauge ##
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
164
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
165 (no acknowledge send)
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
166 reset battery registers and battery gauge chip
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
167 goto comm_command_loop
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
168
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
169
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
170
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
171 comm_erase_complete_logbook: ## erase complete Logbook ##
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
172
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
173 (no acknowledge send)
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
174 erase complete logbook
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
175 goto comm_command_loop
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
176
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
177
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
178 comm_cold_start: ## start bootloader (cold start) ##
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
179
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
180 (no acknowledge send)
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
181 backup crucial data from RAM to EEPROM
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
182 jump into the bootloader/cold start
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
183
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
184
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
185 comm_firmware_update: ## initiate firmware update ##
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
186
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
187 send 0x50
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
188 try to receive 5 byte checksum, timeout 400 ms
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
189 timeout -> send 0xFF, goto comm_command_loop
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
190 checksum faulty -> send 0xFF, goto comm_command_loop
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
191 else -> send 0x4C
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
192 backup crucial data from RAM to EEPROM
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
193 jump into bootloader/FW update
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
194
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
195
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
196 comm_erase_range4kb: ## erase a memory range ##
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
197
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
198 send 0x42
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
199 try to receive 3 byte start address, timeout 400 ms
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
200 try to receive 1 byte block count, timeout 400 ms
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
201 any timeout -> goto comm_command_loop
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
202 else -> erase FLASH from start address, range block_count x 4 kByte
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
203 goto comm_command_loop
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
204
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
205
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
206 comm_erase_4kb: ## erase one 4 kB block ##
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
207
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
208 (no acknowledge send)
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
209 try to receive 3 byte start address, timeout 400 ms
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
210 timeout -> goto comm_command_loop
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
211 else -> erase FLASH from start address, range 4 kByte
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
212 goto comm_command_loop
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
213
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
214
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
215 comm_write_range_stream: ## write a stream of bytes to the FLASH ##
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
216
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
217 send 0x30
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
218 try to receive 3 byte start address, timeout 400 ms
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
219 timeout -> goto comm_command_loop
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
220 else -> loop {try to receive 1 byte, write byte to FLASH } until timeout
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
221 |
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
222 | Attention: Do not send the bytes too fast as the OSTC needs
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
223 | some time for each byte to write it to the FLASH.
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
224 |
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
225 | Bytes will be received and written to FLASH until a timeout occurs,
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
226 | i.e. to end the writing stop sending and await the timeout to trigger.
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
227 |
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
228 timeout -> goto comm_command_loop
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
229
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
230
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
231 comm_write_range_block: ## write a block of 256 bytes to the FLASH ##
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
232 (only available with FW >= 3.08)
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
233 send 0x31
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
234 try to receive 3 byte start address, timeout 400 ms
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
235 timeout -> goto comm_command_loop
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
236 low byte of start address <> 0 -> goto comm_command_loop
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
237 else -> try to receive 256 byte, timeout 400 ms
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
238 timeout -> goto comm_command_loop
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
239 else -> write the 256 byte to FLASH
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
240 goto comm_command_loop
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
241
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
242
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
243 comm_read_range: ## read a range from FLASH ##
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
244
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
245 send 0x20
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
246 try to receive 3 byte start address, timeout 400 ms
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
247 try to receive 3 byte length, timeout 400 ms
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
248 any timeout -> goto comm_command_loop
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
249 else -> loop {read 1 byte from FLASH, send 1 byte } until #length bytes done
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
250 goto comm_command_loop
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
251
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
252
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
253 comm_read_option: ## read an option value ##
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
254
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
255 send 0x72
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
256 try to receive 1 byte option index, timeout 400 ms
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
257 timeout -> goto comm_command_loop
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
258 index = 0x10 - 0x19 -> send 4 bytes in sequence O2%, He%, type, change depth
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
259 goto comm_command_loop
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
260 index = 0x1A - 0x1E -> send 2 bytes in sequence setpoint cbar, change depth
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
261 goto comm_command_loop
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
262 index = 0x1F - 0xXX -> send 1 byte option value (0xXX last index in use, depends on FW version)
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
263 goto comm_command_loop
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
264 else -> goto comm_command_loop
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
265
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
266
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
267 comm_write_option: ## write an option value ##
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
268
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
269 send 0x77
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
270 try to receive 1 byte option value, timeout 400 ms
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
271 timeout -> goto comm_command_loop
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
272 |
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
273 | Attention: do not send the option values too fast after the option index,
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
274 | as the OSTC does not know how many bytes will follow after the
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
275 | index before it has actually evaluated the index!
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
276 | This is a flaw in the protocol design...
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
277 |
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
278 index = 0x10 - 0x19 -> try to receive 4 byte in sequence O2%, He%, type, change depth
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
279 timeout -> goto comm_command_loop
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
280 else -> update option
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
281 goto comm_command_loop
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
282 index = 0x1A - 0x1E -> try to receive 2 bytes in sequence setpoint cbar, change depth
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
283 timeout -> goto comm_command_loop
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
284 else -> update option
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
285 goto comm_command_loop
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
286 index = 0x1F - 0xXX -> try to receive 1 byte option value (0xXX last index in use, depends on FW version)
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
287 timeout -> goto comm_command_loop
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
288 else -> update option
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
289 goto comm_command_loop
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents:
diff changeset
290 else -> goto comm_command_loop