Projekt

Allgemein

Profil

TDT-Protocol on CAN » Historie » Version 84

Maximilian Seesslen, 11.07.2023 13:46

1 12 Maximilian Seesslen
h1. Intro
2 1 Maximilian Seesslen
3 17 Maximilian Seesslen
With the TDT-Protocol sensors can just send their values on the BUS without complex object catalogue.
4
An monitor-software is able to display values without knowing anything about the sensors or their configuration.
5 46 Maximilian Seesslen
The CANId cinsists of an function code and the node id. Like CANOpen the function code is 4 Bits and the Node-ID is 7 Bit.
6
In CAN2.0A there can only be 128 Nodes.
7 1 Maximilian Seesslen
8 35 Maximilian Seesslen
CAN 2.0A: 0..0x7FF
9
CANOpen: 4 Bit Function code, 7 Bit Node-ID
10
Node-Id: 0..0x7F
11 1 Maximilian Seesslen
Function-Code Mask: 0x780
12 46 Maximilian Seesslen
There are 14 or 28 Filters on STM32Fs
13
Some STM32 have an internal 96-bit unique ID.
14 1 Maximilian Seesslen
15 74 Maximilian Seesslen
|_. Bits |_. Area   |_. Decription        |_. Examples             |
16 73 Maximilian Seesslen
| 4      |/2.CAN-Id | Function code       | Send object            |
17 74 Maximilian Seesslen
| 7      |            NodeId              | Sensemux WZ            |
18
| 16 	 |/4.Data   | Object 	          | Set illumination       |
19
| 8 	 |            Unit 	          | promilPwm              |
20
| 8 	 |            Flags 	          | Confirmation required  | 
21
| 32 	 |            Value 	          | 350‰                   |
22 71 Maximilian Seesslen
23 44 Maximilian Seesslen
h2. Function code
24 83 Maximilian Seesslen
Function code can be 0..15 / 0x00..0x0F
25 44 Maximilian Seesslen
26 1 Maximilian Seesslen
|_. Code |_. Decription    |_. Examples             |
27 51 Maximilian Seesslen
| 0x0    | NMT-Write       |                        |
28 1 Maximilian Seesslen
| 0x1    | NMT-Send        |                        |
29 79 Maximilian Seesslen
| 0x2    | NMT-Introduce   | Device sends UID only  |
30 82 Maximilian Seesslen
| 0x3    | NMT-setId       | Set NodeId on Device   |
31
| 0x4    | Alarms          |                        |
32
| 0x5    | Write object    | Set Date, illumination |
33
| 0x6    | Read object     | Get product codes      |
34
| 0x7    | Send object     | Send temperature       |
35
| 0x8    | Resend object   | Replay recorded data   |
36
| 0x9    | data blob       |                        |
37 58 Maximilian Seesslen
38 1 Maximilian Seesslen
39
h1. IDs, ranges and commands
40
41 46 Maximilian Seesslen
h2. Node IDs
42 1 Maximilian Seesslen
43 44 Maximilian Seesslen
* 11-Bit-Identifier, (CAN 2.0A); 2048; 0x0 ... 0x7F0; 0x0 ... 0x7F with function code
44 1 Maximilian Seesslen
* 29-Bit-Identifier, (CAN 2.0B); 0x20000000
45
46
|_. Range      |_. Decription           |_. Examples              |
47
| 0x01-0x0F    | Network Manager        | PC                      |
48
| 0x10-0x2F    | Active controller      | CANDis                  |
49
| 0x30-0x4F    | Actor                  | CANSwitch               |
50 47 Maximilian Seesslen
| 0x50-0x6F    | Sending sensors        | Sensemux, CANIO         |
51 1 Maximilian Seesslen
| 0x70-0x7F    | Passive Sensors        | CANRec                  |
52
53 75 Maximilian Seesslen
h2. CAN data structutre
54 1 Maximilian Seesslen
55 68 Maximilian Seesslen
|_. Size |_. Decription |_. Examples                                                                                |
56
| 2      | Object       | Plain Sensor value; Set illumination                                                      |
57
| 1      | Unit         | hz, Float, Time, Date, Percent, promilPwm, centiCelsius, canId, room, Multipacket-String  |
58 75 Maximilian Seesslen
| 1      | Flags        | Confirmation required                                                                     |
59 68 Maximilian Seesslen
| 4      | Value        | 32Bit                                                                                     |
60
61 36 Maximilian Seesslen
62 44 Maximilian Seesslen
h2. Objects
63 36 Maximilian Seesslen
64 59 Maximilian Seesslen
|_. Code                  |_. Description             |
65
| none                    |                           |
66
| ambientLight            |                           |
67
| plantLight              |                           |
68
| multimediaSwitch        |                           |
69
| mainSwitch              |                           |
70
| date                    |                           |
71
| time                    |                           |
72
| dummy                   |                           |
73
| plantSensor             |                           |
74
| plantSensor [0-7]       |                           |
75
| firmwareVersion         |                           |
76
| firmwareDate            |                           |
77
| hardwareRevision        |                           |
78
| hardwareDate            |                           |
79
| temperatureIntern [0-7] |                           |
80 64 Maximilian Seesslen
| temperatureExtern [0-7] |                           |
81 59 Maximilian Seesslen
| humidity                |                           |
82
| VOC                     |                           |
83 60 Maximilian Seesslen
| Replay                  |                           |
84 63 Maximilian Seesslen
| Data-Dump (SD-Card)     |                           |
85 1 Maximilian Seesslen
86 44 Maximilian Seesslen
h2. Units
87 17 Maximilian Seesslen
88 44 Maximilian Seesslen
* Date: year 2B, month 1B, day 1B
89 1 Maximilian Seesslen
* Time: hour 1B, minute 1B, second 1B, subsecond 1B
90 17 Maximilian Seesslen
91 46 Maximilian Seesslen
h2. Example: Turn on the lights
92 1 Maximilian Seesslen
93 46 Maximilian Seesslen
|_.Data   |_.Size   |_.Description                              |
94
|0x300    | 29 Bits | Function code: Write Object; All objects. |
95
|0x0      | 2 Byte  | Message-Type: Global command              |
96 76 Maximilian Seesslen
|0x1      | 1 Byte  | Data-Type: PWM Permill                    |
97
|0x1      | 1 Byte  | Flags: None                               |
98 46 Maximilian Seesslen
|1000     | 4 Byte  | Value: Full Brightness                    |
99 76 Maximilian Seesslen
100 46 Maximilian Seesslen
101 1 Maximilian Seesslen
h1. Multipacket-Strings
102
103 46 Maximilian Seesslen
There should be the posssibillity to write the complete SPI-Flash even if it takes forever.
104
Not every slave needs to be able to send super big blocks. But every slave should be able to
105
send e.g. descriptions.
106 61 Maximilian Seesslen
There can not be multiple transfers at the same time from one node because there is no identification.
107 15 Maximilian Seesslen
108 46 Maximilian Seesslen
|_. Size    |_. Type                                           |
109
| 0x4       | Package number (0: Data contains package count)  |
110
| 0x4       | Data                                             |
111 61 Maximilian Seesslen
112
h2. Header
113
114
|_. Size    |_. Type           |
115
| 0x4       | Total size       |
116
| 0x4       | Type (1=SDCard)  |
117 62 Maximilian Seesslen
| 0x4       | Target node ID   |
118 1 Maximilian Seesslen
| 0x4       | CRC32 of data    |
119 62 Maximilian Seesslen
120 61 Maximilian Seesslen
121
h2. Example: CANRec
122
123
PC requests an complete dump from single Node. Node will just stream it out.
124
125 84 Maximilian Seesslen
[[NMT]]
126 54 Maximilian Seesslen
h1. NMT
127 48 Maximilian Seesslen
128
h2. Actuator introduction
129
130 80 Maximilian Seesslen
When introduction is requested by system command, each device must send Its UID (function code "NMT introduce") and an description.
131 48 Maximilian Seesslen
132
|_. Size |_. Decription |_. Examples                                                       |
133
| 2      | Object       | Object                                                           |
134
| 6      | MAC/Unique ID| 48Bit                                                            |
135
136 52 Maximilian Seesslen
h3. Objects
137 53 Maximilian Seesslen
138 57 Maximilian Seesslen
|_. Size |_. Decription          |
139
|1       | Request intoruction   |
140
|2       | MAC low               |
141
|3       | MAC high              |
142
|4       | Protocol versions     |
143
|5       | Firmware version      |
144
|6       | Product Code          |
145
|7       | Node-Id               |
146
147 55 Maximilian Seesslen
148
h3. Protocol versions
149
150
|_. Size |_. Decription            |
151
|1       | TDT Major               |
152 56 Maximilian Seesslen
|1       | TDT Minor               |
153
|1       | NMT Major               |
154
|1       | NMT Minor               |
155 1 Maximilian Seesslen
|1       | Blob Major              |
156
|1       | Blob Minor              |
157 78 Maximilian Seesslen
158
h2. Usecase: Setting Node-ID
159
160
Two nodes may have the same Node-ID. When scanning the network, the nodes will overwrite the counterparts information.
161 81 Maximilian Seesslen
The "NMT-Introduce"-function code is used by the nodes to send theyr complete UID. NMT can then send 
162
The new NodeID can not be part of the CAN-ID because the device may be filtering it out. (The whole NMT )
163 78 Maximilian Seesslen
164 55 Maximilian Seesslen
165 25 Maximilian Seesslen
h1. V2
166
167
|_. Size |_. Decription |_. Examples                                                       |
168
| 1      | Packet type  | Standard TDT packet                                              |
169
| 1      | Sub-Id;      | Futher index; Sub-Sensor or more specifi kind of thing to be set |
170
| 1      | Data type    | Int, Float, Time, Date, Percent, Promil, Multipacket-String      |
171 31 Maximilian Seesslen
| 1      | Unit         | Hz, °C, Time, Date, PWM, CAN-ID, Name, Description, Room         |
172 1 Maximilian Seesslen
| 4      | Value        | 32Bit                                                            |
173 65 Maximilian Seesslen
174
h1. V3
175
176
|_. Size |_. Decription |_. Examples                                                               |
177
| 2      | Object       |                                                                          |
178
| 1      | Sub-Id;      | Flags, Subid                                                             |
179
| 1      | Unit/Type    | Hz_int, °C_centi, Time, Date, PWM_milli, CAN-ID, Name, Description, Room |
180
| 4      | Value        | 32Bit                                                                    |
181
182
h2. Flags
183 1 Maximilian Seesslen
184 67 Maximilian Seesslen
4 Bit multi message count
185
4 Bit multi message pos
186
187
Length in Bytes given via CAN?
188
Strings with max. 64 characters.
189
190 1 Maximilian Seesslen
h2. Multimessage package
191
192 67 Maximilian Seesslen
There should be the possibillity to write the complete SPI-Flash even if it takes forever.
193 1 Maximilian Seesslen
Not every slave needs to be able to send super big blocks. But every slave should be able to
194
send e.g. descriptions.
195 69 Maximilian Seesslen
196
h2. Alarms/Alerts
197
198
Devices should indicate issues; e.g.:
199
200
* Battery low
201
* I2C problems
202 70 Maximilian Seesslen
203
h2. Object structutre
204
205
|_. Size |_. Decription |_. Examples                                                                                |
206
| 2      | Object       | I2C, VBat,                                                                                |
207
| 1      | Unit         | hz, Float, Time, Date, Percent, promilPwm, centiCelsius, canId, room, Multipacket-String  |
208
| 1      | Issue        | Whats wrong, Undervolts, Communication error                                              |
209
| 4      | Value        | 32Bit                                                                                     |