Skip to content

Commit 13c359e

Browse files
committed
Separate protocol doc
1 parent 049017a commit 13c359e

File tree

4 files changed

+381
-375
lines changed

4 files changed

+381
-375
lines changed

docs/en/README.md

Lines changed: 1 addition & 189 deletions
Original file line numberDiff line numberDiff line change
@@ -56,192 +56,4 @@ void loop() {
5656

5757
Protocol CanHacker (lawicel) described in [CanHacker for Windows documentation](http://www.mictronics.de/projects/usb-can-bus/)
5858

59-
Library implements it partially. Suported commands listed below.
60-
61-
### `C[CR]`
62-
63-
This command switches the CAN controller from operational in reset mode. The
64-
controller is no longer involved in bus activities.
65-
66-
Command is only active if controller was set to operational mode with command `O` before.
67-
68-
Return: [CR] or [BEL]
69-
70-
### `L[CR]`
71-
72-
This command will switch the CAN controller in Listen Only mode. No channel open
73-
command (`O`) is required after issuing `L`.
74-
75-
Use the close channel command `C` to return to reset mode.
76-
77-
Return: [CR]
78-
79-
### `Mxxxxxxxx[CR]`
80-
81-
Set acceptance code. This command works only if controller in reset mode.
82-
83-
xxxxxxxx - Acceptance Code in hexadecimal
84-
85-
Default value after power-up is 0x00000000 to receive all frames.
86-
87-
Return: [CR] or [BEL]
88-
89-
### `mxxxxxxxx[CR]`
90-
91-
Set acceptance mask. This command works only if controller is setup with command `S` and in reset mode.
92-
93-
xxxxxxxx - Acceptance Mask in hexadecimal
94-
95-
Default value after power-up is 0xFFFFFFFF to receive all frames.
96-
97-
Return [CR] or [BEL]
98-
99-
### `N[CR]`
100-
101-
Read serial number from device.
102-
103-
Return: Nxxxx[CR]
104-
105-
xxxx - Serial number in alphanumeric characters.
106-
107-
### `O[CR]`
108-
109-
This command switches the CAN controller from reset in operational mode. The controller is then involved in bus activities. It works only if the initiated with `S` command before, or controller was set to reset mode with command `C`.
110-
111-
Return: [CR] or [BEL]
112-
113-
### `riiiL [CR]`
114-
115-
This command transmits a standard remote 11 Bit CAN frame. It works only if
116-
controller is in operational mode after command `O`.
117-
118-
```
119-
iii - Identifier in hexadecimal (000-7FF)
120-
L - Data length code (0-8)
121-
```
122-
123-
Return: [CR] or [BEL]
124-
125-
### `RiiiiiiiiL [CR]`
126-
127-
This command transmits an extended remote 29 Bit CAN frame. It works only if
128-
controller is in operational mode after command `O`.
129-
130-
```
131-
iiiiiiii - Identifier in hexadecimal (00000000-1FFFFFFF)
132-
L - Data length code (0-8)
133-
```
134-
135-
Return: [CR] or [BEL]
136-
137-
### `Sn[CR]`
138-
139-
This command will set the CAN controller to a predefined standard bit rate.
140-
It works only after power up or if controller is in reset mode after command `C`.
141-
142-
The following bit rates are available:
143-
144-
```
145-
S0 - 10Kbps
146-
S1 - 20Kbps
147-
S2 - 50Kbps
148-
S3 - 100Kbps
149-
S4 - 125Kbps
150-
S5 - 250Kbps
151-
S6 - 500Kbps
152-
S7 - 800Kbps
153-
S8 - 1Mbps
154-
```
155-
156-
Return: [CR] or [BEL]
157-
158-
### `tiiiLDDDDDDDDDDDDDDDD[CR]`
159-
160-
This command transmits a standard 11 Bit CAN frame. It works only if controller is in operational mode after command `O`.
161-
162-
```
163-
iii - Identifier in hexadecimal (000-7FF)
164-
L - Data length code (0-8)
165-
DD - Data byte value in hexadecimal (00-FF). Number of given data bytes will be
166-
checked against given data length code.
167-
```
168-
169-
Return: [CR] or [BEL]
170-
171-
### `TiiiiiiiiLDDDDDDDDDDDDDDDD[CR]`
172-
173-
This command transmits an extended 29 Bit CAN frame. It works only if controller is in operational mode after command `O`.
174-
```
175-
iiiiiiii - Identifier in hexadecimal (00000000-1FFFFFFF)
176-
L - Data length code (0-8)
177-
DD - Data byte value in hexadecimal (00-FF). Number of given data bytes will be checked against given data length code.
178-
```
179-
180-
Return: [CR] or [BEL]
181-
182-
### `V[CR]`
183-
184-
Read hardware and firmware version from device.
185-
Return: Vhhff[CR]
186-
187-
```
188-
hh - hardware version
189-
ff - firmware version
190-
```
191-
192-
### `v[CR]`
193-
194-
Read detailed firmware version from device.
195-
Return: vmami[CR]
196-
197-
```
198-
ma - major version number
199-
mi - minor version number
200-
```
201-
202-
### `Zv[CR]`
203-
204-
This command will toggle the time stamp setting for receiving frames. Time stamping is disabled by default.
205-
206-
If time stamping is enabled for received frames, an incoming frame includes 2 more bytes at the end which is a time stamp in milliseconds.
207-
208-
The time stamp starts at 0x0000 and overflows at 0xEA5F which is equal to 59999ms.
209-
210-
Each increment time stamp indicates 1ms within the 60000ms frame.
211-
212-
### Incoming messages
213-
214-
All incoming frames are sent after successful receiving, optional with time stamp.
215-
216-
No polling is needed. They will be sent in the following format:
217-
218-
11 bit ID Frame
219-
```
220-
tiiiLDDDDDDDDDDDDDDDD[ssss][CR]
221-
```
222-
223-
11 bit ID Remote Frame
224-
```
225-
riiiL[ssss][CR]
226-
```
227-
228-
29 bit ID Frame
229-
```
230-
TiiiiiiiiLDDDDDDDDDDDDDDDD[ssss][CR]
231-
```
232-
233-
29 bit ID Remote Frame
234-
```
235-
RiiiiiiiiL[ssss][CR]
236-
```
237-
238-
```
239-
r - Identifier for Remote 11 bit frame
240-
R - Idenifier for Remote 29 bit frame
241-
t - Identifier for 11 bit frame
242-
T - Idenifier for 29 bit frame
243-
i - ID bytes (000-7FF) or (00000000-1FFFFFFF)
244-
L - Data length code (0-8)
245-
DD - Data bytes (00-FF)
246-
ssss - Optinal time stamp (0000-EA5F)
247-
```
59+
Library implements it partially. [Suported commands listed here](protocol.md).

docs/en/protocol.md

Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
Protocol CanHacker (lawicel) described in [CanHacker for Windows documentation](http://www.mictronics.de/projects/usb-can-bus/)
2+
3+
Library implements it partially. Suported commands listed below.
4+
5+
### `C[CR]`
6+
7+
This command switches the CAN controller from operational in reset mode. The
8+
controller is no longer involved in bus activities.
9+
10+
Command is only active if controller was set to operational mode with command `O` before.
11+
12+
Return: [CR] or [BEL]
13+
14+
### `L[CR]`
15+
16+
This command will switch the CAN controller in Listen Only mode. No channel open
17+
command (`O`) is required after issuing `L`.
18+
19+
Use the close channel command `C` to return to reset mode.
20+
21+
Return: [CR]
22+
23+
### `Mxxxxxxxx[CR]`
24+
25+
Set acceptance code. This command works only if controller in reset mode.
26+
27+
xxxxxxxx - Acceptance Code in hexadecimal
28+
29+
Default value after power-up is 0x00000000 to receive all frames.
30+
31+
Return: [CR] or [BEL]
32+
33+
### `mxxxxxxxx[CR]`
34+
35+
Set acceptance mask. This command works only if controller is setup with command `S` and in reset mode.
36+
37+
xxxxxxxx - Acceptance Mask in hexadecimal
38+
39+
Default value after power-up is 0xFFFFFFFF to receive all frames.
40+
41+
Return [CR] or [BEL]
42+
43+
### `N[CR]`
44+
45+
Read serial number from device.
46+
47+
Return: Nxxxx[CR]
48+
49+
xxxx - Serial number in alphanumeric characters.
50+
51+
### `O[CR]`
52+
53+
This command switches the CAN controller from reset in operational mode. The controller is then involved in bus activities. It works only if the initiated with `S` command before, or controller was set to reset mode with command `C`.
54+
55+
Return: [CR] or [BEL]
56+
57+
### `riiiL [CR]`
58+
59+
This command transmits a standard remote 11 Bit CAN frame. It works only if
60+
controller is in operational mode after command `O`.
61+
62+
```
63+
iii - Identifier in hexadecimal (000-7FF)
64+
L - Data length code (0-8)
65+
```
66+
67+
Return: [CR] or [BEL]
68+
69+
### `RiiiiiiiiL [CR]`
70+
71+
This command transmits an extended remote 29 Bit CAN frame. It works only if
72+
controller is in operational mode after command `O`.
73+
74+
```
75+
iiiiiiii - Identifier in hexadecimal (00000000-1FFFFFFF)
76+
L - Data length code (0-8)
77+
```
78+
79+
Return: [CR] or [BEL]
80+
81+
### `Sn[CR]`
82+
83+
This command will set the CAN controller to a predefined standard bit rate.
84+
It works only after power up or if controller is in reset mode after command `C`.
85+
86+
The following bit rates are available:
87+
88+
```
89+
S0 - 10Kbps
90+
S1 - 20Kbps
91+
S2 - 50Kbps
92+
S3 - 100Kbps
93+
S4 - 125Kbps
94+
S5 - 250Kbps
95+
S6 - 500Kbps
96+
S7 - 800Kbps
97+
S8 - 1Mbps
98+
```
99+
100+
Return: [CR] or [BEL]
101+
102+
### `tiiiLDDDDDDDDDDDDDDDD[CR]`
103+
104+
This command transmits a standard 11 Bit CAN frame. It works only if controller is in operational mode after command `O`.
105+
106+
```
107+
iii - Identifier in hexadecimal (000-7FF)
108+
L - Data length code (0-8)
109+
DD - Data byte value in hexadecimal (00-FF). Number of given data bytes will be
110+
checked against given data length code.
111+
```
112+
113+
Return: [CR] or [BEL]
114+
115+
### `TiiiiiiiiLDDDDDDDDDDDDDDDD[CR]`
116+
117+
This command transmits an extended 29 Bit CAN frame. It works only if controller is in operational mode after command `O`.
118+
```
119+
iiiiiiii - Identifier in hexadecimal (00000000-1FFFFFFF)
120+
L - Data length code (0-8)
121+
DD - Data byte value in hexadecimal (00-FF). Number of given data bytes will be checked against given data length code.
122+
```
123+
124+
Return: [CR] or [BEL]
125+
126+
### `V[CR]`
127+
128+
Read hardware and firmware version from device.
129+
Return: Vhhff[CR]
130+
131+
```
132+
hh - hardware version
133+
ff - firmware version
134+
```
135+
136+
### `v[CR]`
137+
138+
Read detailed firmware version from device.
139+
Return: vmami[CR]
140+
141+
```
142+
ma - major version number
143+
mi - minor version number
144+
```
145+
146+
### `Zv[CR]`
147+
148+
This command will toggle the time stamp setting for receiving frames. Time stamping is disabled by default.
149+
150+
If time stamping is enabled for received frames, an incoming frame includes 2 more bytes at the end which is a time stamp in milliseconds.
151+
152+
The time stamp starts at 0x0000 and overflows at 0xEA5F which is equal to 59999ms.
153+
154+
Each increment time stamp indicates 1ms within the 60000ms frame.
155+
156+
### Incoming messages
157+
158+
All incoming frames are sent after successful receiving, optional with time stamp.
159+
160+
No polling is needed. They will be sent in the following format:
161+
162+
11 bit ID Frame
163+
```
164+
tiiiLDDDDDDDDDDDDDDDD[ssss][CR]
165+
```
166+
167+
11 bit ID Remote Frame
168+
```
169+
riiiL[ssss][CR]
170+
```
171+
172+
29 bit ID Frame
173+
```
174+
TiiiiiiiiLDDDDDDDDDDDDDDDD[ssss][CR]
175+
```
176+
177+
29 bit ID Remote Frame
178+
```
179+
RiiiiiiiiL[ssss][CR]
180+
```
181+
182+
```
183+
r - Identifier for Remote 11 bit frame
184+
R - Idenifier for Remote 29 bit frame
185+
t - Identifier for 11 bit frame
186+
T - Idenifier for 29 bit frame
187+
i - ID bytes (000-7FF) or (00000000-1FFFFFFF)
188+
L - Data length code (0-8)
189+
DD - Data bytes (00-FF)
190+
ssss - Optinal time stamp (0000-EA5F)
191+
```

0 commit comments

Comments
 (0)