TDT-Protocol on CAN » Historie » Revision 44
Revision 43 (Maximilian Seesslen, 19.01.2023 20:55) → Revision 44/104 (Maximilian Seesslen, 20.01.2023 11:21)
h1. Intro
With the TDT-Protocol sensors can just send their values on the BUS without complex object catalogue.
An monitor-software is able to display values without knowing anything about the sensors or their configuration.
The CANId of sensors is actually their configurable ID or an global command.
CAN 2.0A: 0..0x7FF
CANOpen: 4 Bit Function code, 7 Bit Node-ID
Node-Id: 0..0x7F
Function-Code Mask: 0x780
h2. Function code
code:
|_. Code |_. Decription |_. Examples |
| 0x0 0 | NMT | |
| 0x1 1 | Alarms | |
| 0x6 8 | Write object System commands | Set Date, illumination |
| 0x7 | Read object 10 | Get product codes Send blob | Send temprec data |
| 0x8 | Send object 15 | Send temperature Sensor values | Temperature |
|_. Size |_. Decription |_. Examples |
| 0x9 1 | data blob Object | Plain Sensor value; Set illumination |
| 0xC 1 | Sub-Id/Node | Futher index; Sub-Sensor or more specifi kind of thing to be set |
| 1 | Data type | log Int, Float, Time, Date, Percent, Promil, Multipacket-String |
| 1 | Unit | Hz, °C, Time, Date, PWM, CAN-ID, Name, Description, Room |
| 4 | Value | 32Bit |
h2. Values
* Date: year 2B, month 1B, day 1B
* Time: hour 1B, minute 1B, second 1B, subsecond 1B
h2. Device behaviour
All devices should shut down after 5 hours when no master-heartbeat is received.
h1. IDs, ranges and commands
h2. CAN IDs
* 11-Bit-Identifier, (CAN 2.0A); 2048; 0x0 ... 0x7F0; 0x0 ... 0x7F with function code
* 29-Bit-Identifier, (CAN 2.0B); 0x20000000
|_. Range |_. Decription |_. Examples |
| 0x01-0x0F | Network Manager | PC |
| 0x10-0x2F | Active controller | CANDis |
| 0x30-0x4F | Actor | CANSwitch |
| 0x50-0x6F | Sending sensors | Sensemux |
| 0x70-0x7F | Passive Sensors | CANRec |
h2. Bbject structutre Global actuator
Global means that all actuators of an type is addressed and not one concrete partipiant.
An specific partipiant can be specified when sending the target CAN-Id in the value.
In this way the message is still high priority other than the "Remote Transmission Request"
|_. Size Command |_. global actuator |_. Decription |_. Examples |
| 2 0x01 | Object System command | Plain Sensor value; Set illumination Perform system command; e.g. reboot, poweroff |
| 1 0x02 | Data type Date/Time | Int, Float, Time, Date, Percent, Promil, Multipacket-String Set date/time of all actuator |
| 1 0x03 | Unit Illumination | Hz, °C, Time, Date, PWM, CAN-ID, Name, Description, Room Set brightness of lamps |
| 4 0x04 | Value Powerswitch | Power on devices |
| 0x05 | 32Bit Plant watering pump | Automatically watering indoor plants |
h2. Objects System commands
|_. Code Sub-ID |_. Description Type |
| none 0x0 | Shutdown |
| ambientLight 0x1 | Heartbeat |
h2. Illumination commands
|_. Sub-ID |_. Type | plantLight | |
| multimediaSwitch 0x0 | |
| mainSwitch Set ambient light | |
| date 0x1 | Get ambient light |
| time 0x2 | Set ambient light, fading |
| dummy 0x3 | Get ambient light, fading |
| plantSensor 0x4 | Set plant light |
| plantSensor0 0x5 | Get plant light |
h2. Powerswitch commands
|_. Sub-ID |_. Type | plantSensor1 | |
| plantSensor2 0x0 | Set powerline for multimedia |
| plantSensor3 0x1 | |
| plantSensor4 | |
| firmwareVersion | |
| firmwareDate | |
| hardwareRevision Get powerline for multimedia | |
| hardwareDate | |
| temperatureIntern | |
| temperatureIntern1 | |
| temperatureIntern2 | |
| temperatureIntern3 | |
| temperatureIntern4 | |
| temperatureExtern | |
| temperatureExtern1 | |
| temperatureExtern2 | |
| temperatureExtern3 | |
| temperatureExtern4 | |
| humidity | |
| voc | |
h2. Units
* Date: year 2B, month 1B, day 1B
* Time: hour 1B, minute 1B, second 1B, subsecond 1B
h1. Multipacket-Strings
|_. Address |_. Type |
| 0x0 | Package count |
| 0x1 | Package number |
| 0x2..0x3 | Data |
h1. Actuator introduction
When introduction is requested by system command, each device must send description for each subid.
h1. Example
h2. Turn on the lights
|_.Data |_.Size |_.Description |
|0x100 | 29 Bits | CAN-Id: Global command |
|0x0 | 1 Byte | Message-Type: Global command |
|0x0 | 1 Byte | Sub-Id: Set ambient light |
|0x1 | 1 Byte | Data-Type: Integer |
|0x1 | 1 Byte | PWM: PWM permilli |
|1000 | 4 Byte | Value: Full Brightness |
h1. Usecases
* simple actors can filter message to "Global actuator" messages, at least "system commands"
* There are 14 or 28 Filters on STM32Fs
h1. ID Assigning
Some STM32 have an internal 96-bit unique ID.
h1. V2
|_. Size |_. Decription |_. Examples |
| 1 | Packet type | Standard TDT packet |
| 1 | Sub-Id; | Futher index; Sub-Sensor or more specifi kind of thing to be set |
| 1 | Data type | Int, Float, Time, Date, Percent, Promil, Multipacket-String |
| 1 | Unit | Hz, °C, Time, Date, PWM, CAN-ID, Name, Description, Room |
| 4 | Value | 32Bit |
h2. Multimessage package
There should be the posssibillity to write the complete SPI-Flash even if it takes forever.
Not every slave needs to be able to send super big blocks. But every slave should be able to
send e.g. descriptions.
* Is order of messages an issue? Multiple Mailboxes.
|_. Size |_. Decription |_. Examples |
| 1 | Packet type | Multimessage package |
| 1 | count | Number of packages |
| 1 | number | 0: value=data length in bytes |
| 4 | Value | 32Bit |
|_. Size |_. Decription |_. Examples |
| 1 | Packet type | Multimessage package 2 |
| 1 | id | Mailbox |
| 1 | number | 0: value=data length in bytes |
| | | 1: value=number of messages |
| | | 2..x: data |
| 4 | Value | 32Bit |
h2. Diagnose
With the TDT-Protocol sensors can just send their values on the BUS without complex object catalogue.
An monitor-software is able to display values without knowing anything about the sensors or their configuration.
The CANId of sensors is actually their configurable ID or an global command.
CAN 2.0A: 0..0x7FF
CANOpen: 4 Bit Function code, 7 Bit Node-ID
Node-Id: 0..0x7F
Function-Code Mask: 0x780
h2. Function code
code:
|_. Code |_. Decription |_. Examples |
| 0x0 0 | NMT | |
| 0x1 1 | Alarms | |
| 0x6 8 | Write object System commands | Set Date, illumination |
| 0x7 | Read object 10 | Get product codes Send blob | Send temprec data |
| 0x8 | Send object 15 | Send temperature Sensor values | Temperature |
|_. Size |_. Decription |_. Examples |
| 0x9 1 | data blob Object | Plain Sensor value; Set illumination |
| 0xC 1 | Sub-Id/Node | Futher index; Sub-Sensor or more specifi kind of thing to be set |
| 1 | Data type | log Int, Float, Time, Date, Percent, Promil, Multipacket-String |
| 1 | Unit | Hz, °C, Time, Date, PWM, CAN-ID, Name, Description, Room |
| 4 | Value | 32Bit |
h2. Values
* Date: year 2B, month 1B, day 1B
* Time: hour 1B, minute 1B, second 1B, subsecond 1B
h2. Device behaviour
All devices should shut down after 5 hours when no master-heartbeat is received.
h1. IDs, ranges and commands
h2. CAN IDs
* 11-Bit-Identifier, (CAN 2.0A); 2048; 0x0 ... 0x7F0; 0x0 ... 0x7F with function code
* 29-Bit-Identifier, (CAN 2.0B); 0x20000000
|_. Range |_. Decription |_. Examples |
| 0x01-0x0F | Network Manager | PC |
| 0x10-0x2F | Active controller | CANDis |
| 0x30-0x4F | Actor | CANSwitch |
| 0x50-0x6F | Sending sensors | Sensemux |
| 0x70-0x7F | Passive Sensors | CANRec |
h2. Bbject structutre Global actuator
Global means that all actuators of an type is addressed and not one concrete partipiant.
An specific partipiant can be specified when sending the target CAN-Id in the value.
In this way the message is still high priority other than the "Remote Transmission Request"
|_. Size Command |_. global actuator |_. Decription |_. Examples |
| 2 0x01 | Object System command | Plain Sensor value; Set illumination Perform system command; e.g. reboot, poweroff |
| 1 0x02 | Data type Date/Time | Int, Float, Time, Date, Percent, Promil, Multipacket-String Set date/time of all actuator |
| 1 0x03 | Unit Illumination | Hz, °C, Time, Date, PWM, CAN-ID, Name, Description, Room Set brightness of lamps |
| 4 0x04 | Value Powerswitch | Power on devices |
| 0x05 | 32Bit Plant watering pump | Automatically watering indoor plants |
h2. Objects System commands
|_. Code Sub-ID |_. Description Type |
| none 0x0 | Shutdown |
| ambientLight 0x1 | Heartbeat |
h2. Illumination commands
|_. Sub-ID |_. Type | plantLight | |
| multimediaSwitch 0x0 | |
| mainSwitch Set ambient light | |
| date 0x1 | Get ambient light |
| time 0x2 | Set ambient light, fading |
| dummy 0x3 | Get ambient light, fading |
| plantSensor 0x4 | Set plant light |
| plantSensor0 0x5 | Get plant light |
h2. Powerswitch commands
|_. Sub-ID |_. Type | plantSensor1 | |
| plantSensor2 0x0 | Set powerline for multimedia |
| plantSensor3 0x1 | |
| plantSensor4 | |
| firmwareVersion | |
| firmwareDate | |
| hardwareRevision Get powerline for multimedia | |
| hardwareDate | |
| temperatureIntern | |
| temperatureIntern1 | |
| temperatureIntern2 | |
| temperatureIntern3 | |
| temperatureIntern4 | |
| temperatureExtern | |
| temperatureExtern1 | |
| temperatureExtern2 | |
| temperatureExtern3 | |
| temperatureExtern4 | |
| humidity | |
| voc | |
h2. Units
* Date: year 2B, month 1B, day 1B
* Time: hour 1B, minute 1B, second 1B, subsecond 1B
h1. Multipacket-Strings
|_. Address |_. Type |
| 0x0 | Package count |
| 0x1 | Package number |
| 0x2..0x3 | Data |
h1. Actuator introduction
When introduction is requested by system command, each device must send description for each subid.
h1. Example
h2. Turn on the lights
|_.Data |_.Size |_.Description |
|0x100 | 29 Bits | CAN-Id: Global command |
|0x0 | 1 Byte | Message-Type: Global command |
|0x0 | 1 Byte | Sub-Id: Set ambient light |
|0x1 | 1 Byte | Data-Type: Integer |
|0x1 | 1 Byte | PWM: PWM permilli |
|1000 | 4 Byte | Value: Full Brightness |
h1. Usecases
* simple actors can filter message to "Global actuator" messages, at least "system commands"
* There are 14 or 28 Filters on STM32Fs
h1. ID Assigning
Some STM32 have an internal 96-bit unique ID.
h1. V2
|_. Size |_. Decription |_. Examples |
| 1 | Packet type | Standard TDT packet |
| 1 | Sub-Id; | Futher index; Sub-Sensor or more specifi kind of thing to be set |
| 1 | Data type | Int, Float, Time, Date, Percent, Promil, Multipacket-String |
| 1 | Unit | Hz, °C, Time, Date, PWM, CAN-ID, Name, Description, Room |
| 4 | Value | 32Bit |
h2. Multimessage package
There should be the posssibillity to write the complete SPI-Flash even if it takes forever.
Not every slave needs to be able to send super big blocks. But every slave should be able to
send e.g. descriptions.
* Is order of messages an issue? Multiple Mailboxes.
|_. Size |_. Decription |_. Examples |
| 1 | Packet type | Multimessage package |
| 1 | count | Number of packages |
| 1 | number | 0: value=data length in bytes |
| 4 | Value | 32Bit |
|_. Size |_. Decription |_. Examples |
| 1 | Packet type | Multimessage package 2 |
| 1 | id | Mailbox |
| 1 | number | 0: value=data length in bytes |
| | | 1: value=number of messages |
| | | 2..x: data |
| 4 | Value | 32Bit |
h2. Diagnose