MMWAVE xAP
Lightswitch – Specification
Revision 1.021
Introduction
The xAP lightswitch is designed as a low cost input controller to many other devices – these may be relays, dimmers, heating controls, etc.
The device will handle up to 8 inputs/switches. Each is pulled up by a 10K resistor to Vdd(+5V). Therefore a switch is connected to Vss (0V/Gnd). Suitable precautions may be needed for RFI suppression on leads from the board to the switch and it is not recommended that these are greater than 30cm.
The 'on the wire' protocol conforms to the xAP specification. No attempt has been made to tokenize the streams. Given the wide availability of PIC18F series devices with reasonable memory and 20MHz clocks there seems little need. The line speed is 38.4Kbps. This allows the transmission of a reasonable number of messages per second.
4 wire RS-485 is the physical medium.
Functions
Each input may function in one of three modes:
On/Off – Inverted status of the input (Port High == Off, Port Low == On)
Momentary (Output is of type Toggle)
Ramp (Output is a level dependent on length of time switch is pressed)
On/Off mode
There will be an output message whenever the status of the input changes. The input is debounced over a 50mS period. Therefore fast changing input signals are not supported.
Momentary
There will be an output message of the type 'Toggle' whenever the status of the input changes. The input is debounced over a 50mS period prior to changing the output status.
Ramp
This is specifically designed as the human interface for dimming lights. The output status consists of two values – a level and an on/off status.
From a state of output off, pressing the switch for >50mS and <500mS will result in the output status changing to on and the level remaining unchanged.
From a state of output on, pressing the switch for >50mS and <500mS will result in the output status changing to off and the level remaining unchanged.
From a state of output off or on, pressing the switch for >500mS will result in the output status changing to on and the level incrementing by a value of 5 every 50mS. When the level value reaches 255 it will decrement by 5 every 50mS. The output status and level will be output every 50mS and at the change of input (switch release).
(In this case pressing the switch equates to input level low).
There is no attempt to match the output levels to square law, although a future version may incorporate this.
Interfaces
The interface is 4 wire RS485 with one pair dedicated to transmit and one to receive. Line speed is 38,400 bps (with about a 1.5% error), 7 bit, odd parity, one stop bit.
All devices will parallel on each bus and the master (PC) end will be responsible for the filtering and re-transmission of messages to comply with the broadcast requirements on xAP.
Protocol
The transmit and receive protocol will conform to the xAP specification 1.2 for serial devices, including the wrapper (STX/ETX CRC).
The application layer will conform to the xAP BSC specification 1.3, with extensions listed below.
Power Up and Reset behaviour
At power up/reset the device will reflect the output status stored in the EEPROM section of the processor unless the device is un-initialised.
At initial (first) power up all the outputs will be off and the levels will be zero. All inputs will assume on/off type. The device will wait in this state until a configuration message is received and all inputs are ignored. The 'interested' UID table will consist of a single entry of FFFFFFFF. The device itself will use the UID FF5Axxnn. xx will be 00 at initialisation. nn will reflect the input number in the range 01 to 08 but will be FF for the unconfigured device. (FF5A is the UID prefix chosen for Vendor ID MMWAVE).
Heartbeat messages will be sent with the unconfigured UID – FF5A00FF - every 60s follow initial power on.
Message Definitions
The messages below do not show the serial wrapper.
Output
For an on/off output the message will be:
xap-header
{
v=12
hop=1
uid=FF5A6107
class=xAPBSC.event
source= MMWAVE.Lightswitch.Generic61:07
}
input.state
{
State=ON
}
For momentary/toggle:
xap-header
{
v=12
hop=1
uid=FF5A6107
class=xAPBSC.event
source= MMWAVE.Lightswitch.Generic61:07
}
input.state
{
State=Toggle
}
For a ramp type input the message will be:
xap-header
{
v=12
hop=1
uid=FF5A6102
class=xAPBSC.event
source= MMWAVE.Lightswitch.Generic61:02
}
input.state
{
State=ON
Level=125/255
}
The node numbers (02 above) are in the range 01 to 08.
Heartbeat
The heartbeat period will be 60s. This message will be sent if unconfigured:
xap-hbeat
{
v=12
hop=1
uid=FF5A00FF
class=xap-hbeat.alive
source=MMWAVE.Lightswitch.Generic00
interval=60
}
and when configured:
or if the friendly name has also been configured:
xap-hbeat
{
v=12
hop=1
uid=FF5A6100
class=xap-hbeat.alive
source=MMWAVE.Lightswitch.DiningRoom
interval=60
}
Configuration –
'Interested' UID's
The device supports a list of 8 UID's which it will use for source filtering.
The message is of the form:
xap-header
{
v=12
hop=1
uid=FFFFFFFF
class=device.config
source= MMWAVE.Configurator.Node0
target = >:>
}
UID.sourceconfig
{
UID0=FF5AA500
…
UID7=FF5AA700
}
At least UID0 must be sent and the remaining pairs are optional.
Configuration –
Device UID
xap-header
{
v=12
hop=1
uid=FFFFFFFF
class=device.config
source= MMWAVE.Configurator.Node0
target = >:>
}
UID.deviceconfig
{
UID=FFA56100
}
Note that in this case this message precedes the setup of the filtering UID's. It is legal for this message to be after the UID.sourceconfig message, in which case FFFFFFFF is not legal as the sourceID.
If only the device UID is configured the friendly name will be Genericxx where xx is the third octet of the UID (61 above).
Since the target is >:> (all) there can only be one unconfigured device on the network at this time. At commissioning the installer must ensure the devices are powered up and then programmed in sequence. A terminal header with shorting link will enable each device to be installed in the daisy chain and then powered up in the sequence easiest for installation.
Configuration –
Device friendly name
xap-header
{
v=12
hop=1
uid=FFA50100
class=device.config
source= MMWAVE.Controller.Node0
target = MMWAVE.Lightswitch.Generic61
}
name.deviceconfig
{
name=DiningRoom
}
Following this the node name will change from Genericxx (where xx is the device number from the third octet of the UID) to DiningRoom. This is a case sensitive name. Therefore messages from the device would be from address: MMWAVE.Lightswitch.DiningRoom:nn (where nn represents the switch/input number).
The maximum length of the name is 32 characters. Names longer than 32 characters will be discarded.
It is not possible to change the device name from Lightswitch.
Configuration –
Device Switch Input Type
xap-header
{
v=12
hop=1
uid=FFA50100
class=mmwave.config
source= MMWAVE.Controller.Node0
target = >:>
}
input.config
{
1!00
2!0F
3!F0
}
The name/value 1 represents those input which will be on/off. The name/value 2 represents those that are momentary(toggle), in this case nodes 1 to 4. Then name/value 3 represents those inputs that are ramp, in this case nodes 6 to 8.
The precedence is 1, 2, 3. As an example if all are sent as FF then all the inputs are on/off.
Input
The device does not respond to any xAP messages except the configuration messages and they will be discarded.
It is intended that a future revision will extend the input capabilities and is the primary reason for the inclusion of the number of source UID's to be filtered on.
Status LED
A status LED will reflect the state of the system.
Off – device not powered.
Flashing with a period of 0.5s – device unconfigured (UID FF5A00FF)
On – device powered on but no input traffic
On (flickering) – device on with serial output traffic.
Implementation Detail
The device shall be a PIC18F2525. The clock shall be a 20MHz Crystal.
The 8 inputs will be on RA0 to RA5, RB0, RB1 as a Molex header. Pins RB6 and RB7 will be on a separate header with 0V and !MCLR/Vpp for ICSP.
RB2 and RB3 are reserved (2x2) as LED mimics/status (future) and will be presented as xAP outputs. RB5 is the status LED.
RC0 to RC4 and RB4 will be on an expansion header with 0V and +5V (Future LCD/other).
RC5 is the RS-485 tx enable.
RC6 and RC7 are the tx/rx serial data pins to the 75176 RS485 interface IC.
Line speed is 38,400 7 bit, odd parity. 1 stop bit.
The RS485 will be connected via two RJ-45 connectors, daisy chained.
The pinouts are as follows:
Pin 1 – RX +
Pin 2 – RX -
Pin 3 – TX +
Pin 4 – positive DC supply, 12V min, 24V max. 0.5V max ripple@50Hz
Pin 5 – paralleled with Pin 4
Pin 6 – TX -
Pin 7 – Ground
Pin 8 – Ground
Cat3 and Cat5e are acceptable cables. The above power is the POE standard for Symbol and Intel and modified 802.3af (24V and using spare pairs).
The regulator on board must be capable of handling the dissipation with a +24v supply. It is expected that consumption will be < 60mA. Therefore typical dissipation will be c. 1W.
The 5V rail to the device will have a two pin header with shorting link to allow the device to be un-powered but remain on the daisy chain.
In EEPROM the following will be stored:
Filtered source UID's – 32 bytes
Own UID – 4 bytes
Switch Type – 3 bytes
Friendly name – 16 bytes
Output Status – 8 bytes
For on/off and momentary device types the value 0xFF internally represents 'on'.
The main loop will be responsible for handling the message parsing using a limited message buffer.
The message handling will utilise a state machine.
The high priority interrupt is for the USART – vector 0x0008
The low priority interrupt is for the 10mS timer (Timer 1) – vector 0x0018
Revision History
1.021
Renumbered o/p pins
1.02
Revised momentary to be toggle.
Changed to node FF for unconfigured.
Added targets.
Reduced requested UID range.
Changed target Microchip PIC
Changed switch range from 00 to 07 -> 01 to 08
1.01
Public release
© Copyright 2005 Lehane Kellett. Lehane@mm-wave.com