annotate src/Docu/comm-docu.txt @ 648:aeca5717d9eb

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