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
Function code:
	
		
			| Code  | 
			Decription     | 
			Examples              | 
		
		
			|  0       | 
			 NMT              | 
			                         | 
		
		
			|  1       | 
			 Alarms           | 
			                         | 
		
		
			|  8       | 
			 System commands  | 
			 Set Date, illumination  | 
		
		
			|  15      | 
			 Sensor values    | 
			 Temperature             | 
		
	
	
		
			| Size  | 
			Decription  | 
			Examples                                                        | 
		
		
			|  1       | 
			 Sub-Id;       | 
			 Futher index; Sub-Sensor or more specifi kind of thing to be set  | 
		
		
			|  1       | 
			 Command       | 
			 Plain Sensor value; Set illumination                              | 
		
		
			|  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                                                             | 
		
	
	
Values¶
	
	- Date: year 2B, month 1B, day 1B
 
		- Time: hour 1B, minute 1B, second 1B, subsecond 1B
 
	
	
Device behaviour¶
	All devices should shut down after 5 hours when no master-heartbeat is received.
	
IDs, ranges and commands¶
	
CAN IDs¶
	
	- 11-Bit-Identifier, (CAN 2.0A); 2048; 0x800
 
		- 29-Bit-Identifier, (CAN 2.0B); 0x20000000
 
	
	
		
			| Range       | 
			Decription            | 
			Examples               | 
		
		
			|  0x010-0x0FF   | 
			 Alarms                  | 
			 Devices have an issue    | 
		
		
			|  0x100-0x1FF   | 
			 Control commands        | 
			 Set global actuator      | 
		
		
			|  0x200-0x2FF   | 
			 Sensors/actors fixed    | 
			                          | 
		
		
			|  0x300-0x6FF   | 
			 Sensors/actors dynamic  | 
			                          | 
		
		
			|  0x6FF-0x7FF   | 
			 Low priority boradcast  | 
			 Power on devices         | 
		
	
	
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"
	
		
			| ID          | 
			global actuator     | 
			Decription                                   | 
		
		
			|  0x100         | 
			 System command        | 
			 Perform system command; e.g. reboot, poweroff  | 
		
		
			|  0x101         | 
			 Date/Time             | 
			 Set date/time of all actuator                  | 
		
		
			|  0x102         | 
			 Illumination          | 
			 Set brightness of lamps                        | 
		
		
			|  0x103         | 
			 Powerswitch           | 
			 Power on devices                               | 
		
		
			|  0x104         | 
			 Plant watering pump   | 
			 Automatically watering indoor plants           | 
		
	
	
System commands¶
	
		
			| Sub-ID      | 
			Type               | 
		
		
			|  0x0           | 
			 Shutdown             | 
		
		
			|  0x1           | 
			 Heartbeat            | 
		
	
	
Illumination commands¶
	
		
			| Sub-ID      | 
			Type                     | 
		
		
			|  0x0           | 
			 Set ambient light          | 
		
		
			|  0x1           | 
			 Get ambient light          | 
		
		
			|  0x2           | 
			 Set ambient light, fading  | 
		
		
			|  0x3           | 
			 Get ambient light, fading  | 
		
		
			|  0x4           | 
			 Set plant light            | 
		
		
			|  0x5           | 
			 Get plant light            | 
		
	
	
Powerswitch commands¶
	
		
			| Sub-ID      | 
			Type                          | 
		
		
			|  0x0           | 
			 Set powerline for multimedia    | 
		
		
			|  0x1           | 
			 Get powerline for multimedia    | 
		
	
	
Multipacket-Strings¶
	
		
			| Address  | 
			Type           | 
		
		
			|  0x0        | 
			 Package count    | 
		
		
			|  0x1        | 
			 Package number   | 
		
		
			|  0x2..0x3   | 
			 Data             | 
		
	
	
Actuator introduction¶
	When introduction is requested by system command, each device must send description for each subid.
	
Example¶
	
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        | 
		
	
	
Usecases¶
	
	- simple actors can filter message to "Global actuator" messages, at least "system commands" 
 
		- There are 14 or 28 Filters on STM32Fs
 
	
	
ID Assigning¶
	Some STM32 have an internal 96-bit unique ID.
	
	
		
			| 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                                                             | 
		
	
	
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                                                             | 
		
	
	
Diagnose¶