Smart Switch Specifications

From OpenMotics
Jump to navigation Jump to search

Introduction

Renson and Openmotics have designed a Smart Switch that will be connected on the CAN bus of Openmotics. This document describes the specs so firmware development can be started.

In this document, the CLI instructions have been added to make testing of the firmware easier.

Modification will have to be made on Brain Master level, latest release notes can be found here: AIO Release Notes

Basic specifications of the firmware

These are the basic functionalities of the Smart switch

  • Peripherals
    • Touchpanel:
      • Non blocking reading of touch panel coordinates
    • leds:
      • Non blocking led functionality
      • Set led color/brightness
      • Led blinking
      • Led fading in/out
    • Sensors
      • Non blocking I2C functionality
      • Reading sensor values (Temp, humidity, CO2, VOC, radar, lux & sound)
      • The Master is using a format called System Value. Sensor values should be recalculated to System Value and the raw values should be calculated as well. The Master can request the System Value or the raw value.
      • Sensor filtering for non acceptable values
      • Sensor resetting when sensor failing
    • CAN bus
      • Non blocking reading/writing of the CAN bus
      • possibility to resent message when Master is not responding
      • CAN bus failure detection and resetting (see also Health checker)
    • UART
      • Used for debug purposes only
  • Initialise on the CAN bus
    • ID: every Smart switch will get a CAN ID of 3 bytes
      • When an input on the smart switch is triggered and module isn't initialised yet:
        • The CAN ID is generated and negotiated with the Master
        • The input is added (and an input nr is received from the Master)
        • The sensor is added (and a sensor nr is received from the Master)
    • Inputs: every input will get an input nr (byte)
      • This input nr will be given by the Master
      • Max 6 inputs + 1 input for motion detection
      • The Smart Switch can be configured as 2, 4 or 6 input model. The leds and touch zone will act accordingly.
    • Sensor: every smart switch will get a sensor number (byte)
      • This sensor number will be given by the Master
      • If a smart switch has multiple sensors (for example temperature, humidity, CO2 etc), they all will get the same number, the CAN instruction will be different to request the different values.
      • Every smart switch will also has a sensor type: the sensor type will indicate which sensors (temperature, humidity, CO2 etc) are available for this Smart Switch
  • Normal use:
    • When an input is pressed (or released), a message is sent to the Master. The Master will respond when the message is received. A retry can be sent.
    • When a motion is detected, a message is sent to the Master. The Master will respond when the message is received. A retry can be sent.
    • The Master will request the sensor values from time to time
    • The Master will tell the Smart switch the led state:
      • The leds can be switched ON/OFF
      • The leds can blink slow, medium or fast
      • The leds can change color and brightness (RGB: 0-255)
    • Check the health of following items and take appropriate actions if needed:
      • CAN bus: Check CAN bus health, ping Master etc
      • Sensors: Check sensor availability, check if sensors have acceptable values etc.

Master CLI instructions

This section provides you with the list of useful CLI instruction to be used while testing the firmware. The full list can be found on CLI Reference Guide AIO.

To get started with the CLI, please read this page: AIO Tips & tricks during installation and troubleshooting

Useful instructions during development:

  • Error list
el
  • output status on
oso
  • switch output on
on
  • switch output off
off
  • ping all the CAN connected device
can ping list
  • See what's being programmed for the CAN connected devices
can eeprom list
  • Link an input to an output
input link write
  • Overview of all inputs
input list
  • Overview of all outputs
output list
  • Verify which input has been pressed/released
input debug on
  • Find an input
input indicate
  • Find a sensor
sensor indicate

Hardware settings

CAN Settings

CAN message format

Direction Nr Of Bytes SID Byte0 Byte1 Byte2 Byte3 Byte4 Byte5 Byte6 Byte6
M->S or S->M
1-8
See below
Instruction0
Instruction1
Data
Data
Data
Data
Data
Data
  • Direction:
    • S->M: Communication from Slave (Smart Switch) to Master (Brain)
    • M->S: Communication from Master (Brain) to Slave (Smart Switch)
  • Instruction0:
    • Instruction0==0 -> Communication M->S
    • Instruction0>0 -> Communication S->M
  • Instruction1: Instruction nr
  • Nr of bytes: Nr of bytes the CAN message will contain:
    • If nr of bytes for example == 6 then only Byte0-5 will be used
    • The last byte always contains the checksum so if nr of bytes == 6 then the checksum will be in byte5
    • The Checksum is calculated as the 8 bits sum of the previous bytes so for example, when nr of bytes == 6, checksum=(UINT8)(byte0+byte1+byte2+byte3+byte4)
  • SID: See below

CAN Speed

  • The standard CAN settings are the following:
Speed Tq SJW Prop Seg Phase Seg1 Phase Seg2
125kbps
0,5us
1
8
3
4
  • The speed however can be adapted by the Master by changing following value in the Eeprom of the Smart Switch:
    • The eeprom of the Smart switch have 5 eeprom locations reserved for CAN speed settings (see eeprom table byte 21-25).
    • At startup, these settings are checked to see if the eeprom value must be used or the alternative settings from eeprom.
    • After valid CRC check, these alternative BRGCON values will be loaded
    • If CRC is invalid (or all bytes have 0xFF), the standard 125kbps BRGCON values are loaded.
    • Standard 125kbps BRGCON settings (decimal values) with the above CAN settings:
      • BRGCON1=9;
      • BRGCON2=151;
      • BRGCON3=3;
      • CRC8=185;
    • For the broadcast message used to change the CAN bus speed, see later in this document

SID

Every CAN message has a SID identifier. 4 different SID's are used:

  • SID=0: This SID will only be used in bootloader mode of the Smart Switch. When the Smart Switch is in normal mode, those message will be ignored by the Smart Switch. All messages with SID 0 will be tunnelled towards the UART API without any interpretation of the DSPIC. Messages with SID 0 are used to transfer pallets.
  • SID=1: This SID will only be used in bootloader mode of the Smart Switch. When the Smart Switch is in normal mode, those message will be ignored by the Smart Switch. All messages with SID 0 will be tunnelled towards the UART API without any interpretation of the DSPIC. Messages with SID 1 are used to communicate with the bootloader.
  • SID=5: This SID is used to prepare the Smart Switch for bootloading. All messages with SID=5 will be sent to the Smart Switch and their response will be tunnelled over the DSPIC (=Master controller) directly to the UART API (see API Reference Guide AIO). In other words, when using SID=5 in communication towards a Smart Switch (using API instruction FM), the response of the Smart Switch will be sent directly to the UART API (FM) of the Master without any interpretation nor any actions of the DSPIC.
  • SID=6: All normal communication uses this SID so all messages generated by the Master will be using this SID. These messages will be interpreted by the Master and will not be tunnelled to the UART API.

UART Settings

The UART is used for debug purposes and works at a speed of

  • 115kbps
  • 8 databits
  • 1 stopbit
  • no parity
  • no flow control

Eeprom settings

The Smart Switch is equipped with an onboard eeprom. This eeprom is used to store the Smart Switch settings. Below you can find the eeprom table (Page0 of the external eeprom) with some explanation:

Eeprom address Description
0
CAN input Nr that is linked to Internal Input Nr 0
1
CAN input Nr that is linked to Internal Input Nr 1
2
CAN input Nr that is linked to Internal Input Nr 2
3
CAN input Nr that is linked to Internal Input Nr 3
4
CAN input Nr that is linked to Internal Input Nr 4
5
CAN input Nr that is linked to Internal Input Nr 5
6
CAN input Nr that is linked to Internal Input Nr 6 (Motion sensor)
7
CAN input Nr that is linked to Internal Input Nr 7 (TBD)
8
CAN Sensor Nr that is linked to Internal Sensor Nr 0
9
CAN Sensor Nr that is linked to Internal Sensor Nr 1 (TBD)
11
Indicate if the ID is newly generated ("N") or it's an existing ID ("E") -> ID_NE
12
ID0 of this Micro CAN module
13
ID1 of this Micro CAN module
14
ID2 of this Micro CAN module
20
Status of leds and buzzer:.BIT0->Buzzer ON(1)/OFF(0) for all functions, .BIT1->Buzzer ON(1)/OFF(0) for non-linked switches, .BIT2->TriColor leds ON(1)/OFF(0)
21
CAN settings: If =255 -> std built-in CAN settings are used (125kbps), If =1 -> Custom CAN settings are used (see byte 22, 23 and 24) and CRC has been verified
22
CAN setting: This byte represents Microcontroller (dsPIC33EP128GP504) register BRGCON1. If Byte21=1, this value will be copied in the specified register at startup.
23
CAN setting: This byte represents Microcontroller (dsPIC33EP128GP504) register BRGCON2. If Byte21=1, this value will be copied in the specified register at startup.
24
CAN setting: This byte represents Microcontroller (dsPIC33EP128GP504) register BRGCON3. If Byte21=1, this value will be copied in the specified register at startup.
25
CAN setting: This byte represents the CRC8 of Byte22-24. If the calculated CRC8 value of Byte22-24 is not equal to Byte25, the values of Byte22-24 are ignored (255 is written in Byte21) and the standard value (125kbps) is taken.

Adding a Non-initialized Smart switch on a CAN Network

  • Before a switch is fully initialised, it needs to program with following information:
    • 3 bytes ID
    • Switch number (of the input being pressed)
    • Sensor number
  • The initialisation process is the following:
1. An input must be pressed to start the init process.
  • When a Smart Switch is new (see Eeprom byte 11 "N") and it has no programmed ID yet (ID's in eeprom have 0xFF value), it will generate a random ID (3 bytes) now but this ID will not yet be programmed in eeprom, it's a first attempt to generate a unique number and this still needs to be verified by the Master.
  • When a smart Switch is new (see Eeprom byte 11 "N") and it has a factory programmed ID, this ID will be used.
  • First, the smart Switch will ping the Master with a random ping message to check availability. Following message will be sent to the Master:
Direction Nr Of Bytes SID Byte0 Byte1 Byte2 Byte3 Byte4 Byte5 Byte6 Byte6 Description
S->M
7
6
1
95
Id2
Id1
Id0
Ping Message
Checksum
-
send ping message to the Master
M->S
7
6
0
95
Id2
Id1
Id0
Ping Message
Checksum
-
Ping response of the Master
  • When the Master is not responding, a retry is launched, when no response, the initialisation process is stopped
2. Verify Smart Switch ID
  • The new ID is send to the Master with the below message:
Direction Nr Of Bytes SID Byte0 Byte1 Byte2 Byte3 Byte4 Byte5 Byte6 Byte6 Description
S->M
7
6
200
200
Id2
Id1
Id0
ID_NE
Type
Checksum
send ID to the Master (ID_NE='N'->New Smart switch, ID_NE='E'->Existing Smart Switch, Module Type='u' -> uCAN or Type='s' -> Smart Switch )
M->S
7
6
0
200
Id2
Id1
Id0
Master Response
Type
Checksum
ID Master response: Master Response='O'-> Master OK with ID and ID can be used, 'E'-> Error, ID not OK, please re-generate ID, Module Type='u' -> uCAN or Type='s' -> Smart Switch
  • If no response is received from the Master, a retry is send, when no response again, the process is aborted.
  • If 'E' is received as response, a new ID must be generated and Step 2 must be repeated.
  • If 'O' is received:
    • Program 'E' in byte 11 of the eeprom
    • Program ID2 in byte 12 of the eeprom
    • Program ID1 in byte 13 of the eeprom
    • Program ID0 in byte 14 of the eeprom
  • Note: The Master firmware (and uCAN) needs a modification to understand the module type (not yet done).
3. Add the input that has been pressed
  • Now, the Smart Switch will request the "CAN input nr" for the input being pressed. Every input of a Smart Switch must be linked to a unique CAN input number. This CAN input number is a consecutive number that the Master is attributing to every new input on the CAN bus.
  • The new Internal Input is send to the Master with the below message:
Direction Nr Of Bytes SID Byte0 Byte1 Byte2 Byte3 Byte4 Byte5 Byte6 Byte6 Description
S->M
7
6
120
120
Id2
Id1
Id0
Internal Input Nr (0-7)
Checksum
-
send Smart Switch Internal Input Nr and request CAN Input Nr
M->S
8
6
0
120
Id2
Id1
Id0
Internal Input Nr (0-7)
CAN Input Nr
CheckSum
Receive CAN Input Nr for a specific Internal Input Nr (0-7)
  • Once the response is received, the received CAN input number is programmed in eeprom depending on the Internal Input Nr being pressed (see eeprom location 0-7)
4. Add the sensor(s)
  • When sensors are detected, the below message will be used to request a CAN Sensor Nr.
  • Up to 2 sensors can be added (we might consider an external sensor to be connected on the Smart Switch). All the internal sensors (temperature, humidity, CO2 etc) will be seen as 1 sensor, all the external connected sensor also.
  • Now, the Smart Switch will request the "CAN sensor nr". Every sensor of a Smart Switch must be linked to a unique CAN sensor number. This CAN sensor number is a consecutive number that the Master is attributing to every new sensor on the CAN bus.
  • The new Internal Sensor is send to the Master with the below message:
Direction Nr Of Bytes SID Byte0 Byte1 Byte2 Byte3 Byte4 Byte5 Byte6 Byte6 Description
S->M
7
6
121
121
Id2
Id1
Id0
Internal Sensor Nr (0-1)
Checksum
-
send Smart Switch Internal Sensor Nr and request CAN Sensor Nr
M->S
8
6
0
121
Id2
Id1
Id0
Internal Sensor Nr (0-1)
CAN Sensor Nr
CheckSum
Receive CAN Sensor Nr for a specific Internal Sensor Nr (0-1)
  • Once the response is received, the received CAN Sensor number is programmed in eeprom depending on the Internal Sensor Nr being send (see eeprom location 8-9)
  • When an additional sensor (for example external to the Smart Switch) is detected, step 4 is repeated.

Adding a New Input on an initialized Smart Switch

  • When the initialisation is done and additional (new) inputs are being pressed, we must executed the below instructions to add those new inputs.
  • The Smart Switch will request the "CAN input nr" for the input being pressed. Every input of a Smart Switch must be linked to a unique CAN input number. This CAN input number is a consecutive number that the Master is attributing to every new input on the CAN bus.
  • The new Internal Input is send to the Master with the below message:
Direction Nr Of Bytes SID Byte0 Byte1 Byte2 Byte3 Byte4 Byte5 Byte6 Byte6 Description
S->M
7
6
120
120
Id2
Id1
Id0
Internal Input Nr (0-7)
Checksum
-
send Smart Switch Internal Input Nr and request CAN Input Nr
M->S
8
6
0
120
Id2
Id1
Id0
Internal Input Nr (0-7)
CAN Input Nr
CheckSum
Receive CAN Input Nr for a specific Internal Input Nr (0-7)
  • Once the response is received, the received CAN input number is programmed in eeprom depending on the Internal Input Nr being pressed (see eeprom location 0-7)

Behaviour of an Initialized Smart switch on a CAN Network

Slave Request: Press/Release of an input

  • When an input is pressed, the below message will be send to the Master:
Direction Nr Of Bytes SID Byte0 Byte1 Byte2 Byte3 Byte4 Byte5 Byte6 Byte6 Description
S->M
5
6
1
1
CAN Input Nr
0
Checksum
-
-
-
send to Master that CAN input nr is in press state
M->S
7
6
0
1
CAN Input Nr
0
Linked Output.MSB
Linked Output.LSB
Checksum
-
Receive Press/release answer
  • The answer contains the Output nr that is Linked to the CAN inputs nr. When the buzzer is enabled for the CAN init mode and an input is pressed for a non-initialised output (value of linked Output=0xFFFF), the buzzer will be switched ON until the input is released. This enables installers to test that the switch is working (message is send on the CAN bus and the Master answered).
  • When an input is released, the below message will be send to the Master:
Direction Nr Of Bytes SID Byte0 Byte1 Byte2 Byte3 Byte4 Byte5 Byte6 Byte6 Description
S->M
5
6
1
1
CAN Input Nr
1
Checksum
-
-
-
send to Master that CAN input nr is in release state
M->S
7
6
0
1
CAN Input Nr
1
Linked Output.MSB
Linked Output.LSB
Checksum
-
Receive Press/release answer

Master Request: Set Leds and Buzzer

The Master can set the led state (ON/OFF/Brightness level/blinking etc) as well as the buzzer state.

Set Led

Direction Nr Of Bytes SID Byte0 Byte1 Byte2 Byte3 Byte4 Byte5 Byte6 Byte6 Description
M->S
8
6
0
8
CAN input Nr
Led Brightness Red
Led Brightness Green
Led Brightness Blue
Led Function
Checksum
Set Led Nr
S->M
8
6
8
8
CAN input Nr
Led Brightness Red
Led Brightness Green
Led Brightness Blue
Led Function
Checksum
Response of CAN slave with led state

Notes:

  • Every CAN input has a RGB led linked so using the CAN input nr will switch ON/OFF the corresponding led.
  • Led Function:
    • Led Function=0: Normal ON/OFF
    • Led Function=1: Fast blinking
    • Led Function=2: Medium blinking
    • Led Function=3: Slow blinking
    • Led Function=4: Fade-in fade-out
  • This instruction is not yet programmed in the Master.

Set Buzzer

Direction Nr Of Bytes SID Byte0 Byte1 Byte2 Byte3 Byte4 Byte5 Byte6 Byte6 Description
M->S
7
6
0
97
Id2
Id1
Id0
ON/OFF
Checksum
-
Switch Buzzer ON(=1) or OFF(=0)
S->M
7
6
97
97
Id2
Id1
Id0
ON/OFF
Checksum
-
Response of Buzzer state

Master Request: Sensor values

The Master can request messages in System Value or in Raw value. Both type of messages can be found below.

Request Sensor Values in System Value

Direction Nr Of Bytes SID Byte0 Byte1 Byte2 Byte3 Byte4 Byte5 Byte6 Byte6 Description
M->S
4
6
0
2
CAN Sensor Nr
Checksum
-
-
-
-
Request the Sensor System Values of CAN Sensor Nr
S->M
8
6
2
2
CAN Sensor Nr
Temperature in System Value
Humidity in System Value
Brightness in System Value
Temperature2 in System Value
Checksum
Response of CAN slave with Sensor System Values

Note:

  • Since the brightness resolution of Brightness is too low, the Master is not using the system value of the brightness.
  • Temperature2 is only used when a second Temperature sensor is connected. If not connected, use value 255 (not connected)

Request Sensor Values in Raw Value

Request Temperature

Direction Nr Of Bytes SID Byte0 Byte1 Byte2 Byte3 Byte4 Byte5 Byte6 Byte6 Description
M->S
4
6
0
10
CAN Sensor Nr
Checksum
-
-
-
-
Request raw temperature of CAN Sensor Nr
S->M
7
6
10
10
CAN Sensor Nr
Temperature.MSB
Temperature.LSB
Sensor Type
Checksum
-
Response of CAN slave with raw temperature

Request Humidity

Direction Nr Of Bytes SID Byte0 Byte1 Byte2 Byte3 Byte4 Byte5 Byte6 Byte6 Description
M->S
4
6
0
11
CAN Sensor Nr
Checksum
-
-
-
-
Request raw humidity of CAN Sensor Nr
S->M
7
6
11
11
CAN Sensor Nr
Humidity.MSB
Humidity.LSB
Sensor Type
Checksum
-
Response of CAN slave with raw humidity

Request Brightness

Direction Nr Of Bytes SID Byte0 Byte1 Byte2 Byte3 Byte4 Byte5 Byte6 Byte6 Description
M->S
4
6
0
12
CAN Sensor Nr
Checksum
-
-
-
-
Request raw brightness of CAN Sensor Nr
S->M
7
6
12
12
CAN Sensor Nr
Brightness.MSB
Brigthness.LSB
Sensor Type
Checksum
-
Response of CAN slave with raw brightness
  • Sensor Type:
    • BIT0=1: DS1820 on first output found
    • BIT1=1: DS1820 on second output found
    • BIT2=1: I2C Honeywell sensor found
    • BIT3=1: TSL2561 or equivalent found
    • BIT4=1: CCS811 or equivalent found
    • BIT5=1: T67XX found

Master Request: Smart Switch Configuration

The below message allows to request the full configuration (1 message request, 17 messages in return):

Direction Nr Of Bytes SID Byte0 Byte1 Byte2 Byte3 Byte4 Byte5 Byte6 Byte6 Description
M->S
6
6
0
199
Id2
Id1
Id0
Checksum
-
-
Request the full configuration
S->M
8
6
1
199
Id2
Id1
Id0
CAN Input nr for Internal Input 0
CAN Input nr for Internal Input 1
Checksum
Smart Switch Configuration response
S->M
8
6
2
199
Id2
Id1
Id0
CAN Input nr for Internal Input 2
CAN Input nr for Internal Input 3
Checksum
Smart Switch Configuration response
S->M
8
6
3
199
Id2
Id1
Id0
CAN Input nr for Internal Input 4
CAN Input nr for Internal Input 5
Checksum
Smart Switch Configuration response
S->M
8
6
4
199
Id2
Id1
Id0
CAN Sensor nr for Internal Sensor 0
CAN Sensor nr for Internal Sensor 1
Checksum
Smart Switch Configuration response
S->M
8
6
5
199
Id2
Id1
Id0
Sensor Type (see notes)
Firmware version (Major)
Checksum
Smart Switch Configuration response
S->M
8
6
6
199
Id2
Id1
Id0
Firmware version (Minor)
Firmware version (Built)
Checksum
Smart Switch Configuration response
S->M
8
6
7
199
Id2
Id1
Id0
Bootloader Mode
ID_NE
Checksum
Smart Switch Configuration response
S->M
8
6
8
199
Id2
Id1
Id0
Led Min
Led Max
Checksum
Smart Switch Configuration response
S->M
8
6
9
199
Id2
Id1
Id0
AD Value Internal Input 2
AD Value Internal Input 2
Checksum
Smart Switch Configuration response
S->M
8
6
10
199
Id2
Id1
Id0
AD Value (MSB) Internal Input 3
AD Value (LSB) Internal Input 3
Checksum
Smart Switch Configuration response
S->M
8
6
11
199
Id2
Id1
Id0
AD Value (MSB) Internal Input 4
AD Value (LSB) Internal Input 4
Checksum
Smart Switch Configuration response
S->M
8
6
12
199
Id2
Id1
Id0
AD Value (MSB) Internal Input 5
AD Value (LSB) Internal Input 5
Checksum
Smart Switch Configuration response
S->M
8
6
13
199
Id2
Id1
Id0
AD Value (MSB) DC IN
AD Value (LSB) DC IN
Checksum
Smart Switch Configuration response
S->M
8
6
14
199
Id2
Id1
Id0
CAN config Eeprom byte 21
CAN config Eeprom byte 22
Checksum
Smart Switch Configuration response
S->M
8
6
15
199
Id2
Id1
Id0
CAN config Eeprom byte 23
CAN config Eeprom byte 24
Checksum
Smart Switch Configuration response
S->M
8
6
16
199
Id2
Id1
Id0
CAN config Eeprom byte 25
Led_Buzzer status
Checksum
Smart Switch Configuration response
S->M
8
6
17
199
Id2
Id1
Id0
CAN Input nr for Internal Input 6
CAN Input nr for Internal Input 7
Checksum
Smart Switch Configuration response
  • When the below CLI instruction is executed, the full config is requested:
can ping list
  • Notes:
    • Sensor Type:
      • BIT0=1: DS1820 on first output found
      • BIT1=1: DS1820 on second output found
      • BIT2=1: I2C Honeywell sensor found
      • BIT3=1: TSL2561 or equivalent found
      • BIT4=1: CCS811 or equivalent found
      • BIT5=1: T67XX found
    • Bootloader Mode:
    • Led Min/Max: This is the Min/Max value (0-255) of the maximum brightness the built-in leds can have
    • AD value Internal Input 2-5: The uCAN has an AD connected to Input 2-5, since the Smart switch has a touch panel, these values can be put to 0 but these messages must be send.
    • AD value DC IN: This is the AD value of the Input voltage of the Smart Switch
    • Led_buzzer status:

Master Request: Program Smart Switch Configuration

The Master has the possibility to change Eeprom settings and configuration. Below, you can find the different instructions:

Set Slave ID_NE

Direction Nr Of Bytes SID Byte0 Byte1 Byte2 Byte3 Byte4 Byte5 Byte6 Byte6 Description
M->S
7
6
0
122
Id2
Id1
Id0
ID_NE
Checksum
-
Program ID_NE and become active immediately
S->M
7
6
122
122
Id2
Id1
Id0
ID_NE
Checksum
-
Response on programming

Set Min/Max Led Brightness of all CAN slaves

Direction Nr Of Bytes SID Byte0 Byte1 Byte2 Byte3 Byte4 Byte5 Byte6 Byte6 Description
M->S
5
6
0
250
Led Brightness Min
Led Brightness Max
Checksum
-
-
-
Broadcast message to set Min/Max brightness of all the leds of all CAN slaves

Set Min/Max Led Brightness of 1 Slave

Direction Nr Of Bytes SID Byte0 Byte1 Byte2 Byte3 Byte4 Byte5 Byte6 Byte6 Description
M->S
7
6
0
246
Id2
Id1
Id0
Led Brightness Min
Checksum
-
Set Minimum Led brightness for slave with ID2..0
S->M
7
6
246
246
Id2
Id1
Id0
Led Brightness Min
Checksum
-
Response of the slave
Direction Nr Of Bytes SID Byte0 Byte1 Byte2 Byte3 Byte4 Byte5 Byte6 Byte6 Description
M->S
7
6
0
247
Id2
Id1
Id0
Led Brightness Max
Checksum
-
Set Maximum Led brightness for slave with ID2..0
S->M
7
6
247
247
Id2
Id1
Id0
Led Brightness Max
Checksum
-
Response of the slave

Master Request: Ping

Direction Nr Of Bytes SID Byte0 Byte1 Byte2 Byte3 Byte4 Byte5 Byte6 Byte6 Description
M->S
7
6
0
96
Id2
Id1
Id0
ping message
Checksum
-
Master pings the Slave
S->M
7
6
1
96
Id2
Id1
Id0
ping message
Checksum
-
Slave response on ping message

Note: The "ping message" can be freely chosen and should be repeated by the slave so the Master can check if the right response is received.

Slave Request: Ping

Direction Nr Of Bytes SID Byte0 Byte1 Byte2 Byte3 Byte4 Byte5 Byte6 Byte6 Description
S->M
7
6
1
95
Id2
Id1
Id0
ping message
Checksum
-
Slave pings the Master
M->S
7
6
0
95
Id2
Id1
Id0
ping message
Checksum
-
Master response on ping message

Note: The "ping message" can be freely chosen and should be repeated by the Master so the Slave can check if the right response is received.

Master Request: Input/Sensor indicate

During configuration when a Smart Switch (an input or sensor) needs to be found in the building, it's important to have an indicate function. This indicate function will allow the user to find the specific smart switch and the corresponding input or sensor.

Input indicate

When an input indicate is launched, the following will happen:

  • The Master will sent the indicate message for a given CAN Input Nr
  • The Slave will respond
  • The Slave will switch ON the led of this CAN input nr (color to be discussed)
  • The Slave will start beeping
  • A timer is set to 60 seconds, after 60 seconds the Slave will go to it's previous state (leds go back to the state they were before the indicate)
  • When an indicate (sensor or input) message is received which is not for this slave, all leds are switched off for 60 seconds and will then go back to the initial state
  • When an CAN input (or sensor) indicate is active on a slave and another indicate (sensor or input) message for another CAN input is received, the indicate function on the initial CAN slave will be stopped as well as the beeping, timer is set again to 60 seconds to keep the leds off until the indicate actions are done.
Direction Nr Of Bytes SID Byte0 Byte1 Byte2 Byte3 Byte4 Byte5 Byte6 Byte6 Description
M->S
6
6
0
5
CAN Input Nr
Led Brightness
Led Function
Checksum
-
-
Indicate CAN input nr
S->M
6
6
5
5
CAN Input Nr
Led Brightness
Led Function
Checksum
-
-
Response Indicate

Notes:

  • Led Function:
    • Led Function=0: Normal ON/OFF
    • Led Function=1: Fast blinking
    • Led Function=2: Medium blinking
    • Led Function=3: Slow blinking
    • Led Function=4: Fade-in fade-out

Sensor indicate

When a sensor indicate is launched, the following will happen:

  • The Master will sent the indicate message for a given CAN Sensor Nr
  • The Slave will respond
  • The Slave will switch ON all the leds of this CAN sensor nr (color to be discussed)
  • The Slave will start beeping
  • A timer is set to 60 seconds, after 60 seconds the Slave will go to it's previous state (leds go back to the state they were before the indicate)
  • When an indicate message is received which is not for this slave, all leds are switched off for 60 seconds and will then go back to the initial state
  • When an CAN sensor (or input) indicate is active on a slave and another indicate (sensor or input) message for another CAN input is received, the indicate function on the initial CAN slave will be stopped as well as the beeping, timer is set again to 60 seconds to keep the leds off until the indicate actions are done.
Direction Nr Of Bytes SID Byte0 Byte1 Byte2 Byte3 Byte4 Byte5 Byte6 Byte6 Description
M->S
6
6
0
4
CAN Sensor Nr
Led Brightness
Led Function
Checksum
-
-
Indicate CAN input nr
S->M
6
6
4
4
CAN Sensor Nr
Led Brightness
Led Function
Checksum
-
-
Response Indicate

Notes:

  • Led Function for all leds on the slave module:
    • Led Function=0: Normal ON/OFF
    • Led Function=1: Fast blinking
    • Led Function=2: Medium blinking
    • Led Function=3: Slow blinking
    • Led Function=4: Fade-in fade-out

Master Request: Change CAN Bus speed

  • The CAN bus speed change is broadcast message. After the broadcast message has being sent, the Smart Switch Config must be used to verify if the New CAN settings have been properly programmed.
  • The new CAN bus speed settings will only take place after a reset of the Smart Switch. When a reset is performed, first the processor will check if valid eeprom values are found for the CAN speed. The validity of those values are checked by verifying the CRC of the programmed values. If the programmed values are 0xFF or the CRC8 is wrong, the standard 125kbps values must be used (see section CAN speed parameters)
  • Changing BRGCON values in eeprom (see byte 21-25) is done by using the below CAN bus broadcast message
    • BRGCON1-3: CAN bus settings as specified in the datasheets
    • CRC8: CRC8 calculation of BRGCON1-3
Direction Nr Of Bytes SID Byte0 Byte1 Byte2 Byte3 Byte4 Byte5 Byte6 Byte6 Description
M->S
7
6
0
53
BRGCON1
BRGCON2
BRGCON3
CRC8
Checksum
-
This broadcast message will distribute the BRGCON values for all the Smart Switches connected

Master Request: Reset Slave

The Master has the possibility to request a reset of a slave:

Direction Nr Of Bytes SID Byte0 Byte1 Byte2 Byte3 Byte4 Byte5 Byte6 Byte6 Description
M->S
6
6
0
94
Id2
Id1
Id0
Checksum
-
-
Request Reset Slave
S->M
7
6
94
94
Id2
Id1
Id0
App Mode
Checksum
-
Reset Response after resetting

Notes:

  • App Mode:
    • App Mode=0: Processor in bootloader
    • App Mode=1: Processor in Application
  • When a Smart Switch does a reset, the 94 94 response is automatically sent, also when for example the watchdog timer would reset the processor.

Master Request: Reset All Slaves

The Master has the possibility to request the reset of all slaves:

Direction Nr Of Bytes SID Byte0 Byte1 Byte2 Byte3 Byte4 Byte5 Byte6 Byte6 Description
M->S
3
6
0
92
Checksum
-
-
-
-
-
Request Reset of all Slaves
S->M
7
6
94
94
Id2
Id1
Id0
App Mode
Checksum
-
Reset Response after resetting of all slaves

Notes:

  • All slaves will perform a reset and will respond after the reset
  • App Mode:
    • App Mode=0: Processor in bootloader
    • App Mode=1: Processor in Application

Bootloading of a Smart Switch

This item needs to be investigated more in detail: Are we going to use a standard CAN boot loader or should we use an own developed version? After internal discussion, this section will be described more in detail.

Factory Reset of a Smart Switch

A factory reset of the Smart Switch should be possible by pressing a combination of switches during a period of time resulting in a visual and sound feedback that the factory reset is succeeded. To be discussed.

Health Checking

  • Release blocked state machines
  • CAN Bus
    • When no communication is detected on the CAN bus for more than 120 seconds when non standard CAN bus settings are used (alternative speed for example), the standard CAN settings are loaded in eeprom and the Smart switch is restarted.
    • When no communication is detected on the CAN bus for more than 60 seconds when standard CAN bus settings are used:
      • The Smart Switch will ping the Master and ask for response
      • If after 2 retries, no answer is coming back, the Smart Switch is restarted
  • Enable Watchdog timer

Factory Testing

Will be further described after internal discussion.