Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision | ||
livebox:hah_microcontroller [2011/12/18 23:31] – [Command Interface] brett | livebox:hah_microcontroller [2012/04/16 23:08] – [on / off] brett | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Microcontroller firmware ====== | ====== Microcontroller firmware ====== | ||
- | The microcontroller firmware for the AVR is written in C using the [[http:// | + | The microcontroller firmware for the AVR is written in C using the [[http:// |
+ | |||
+ | ^^ Chip ^^ Firmware | ||
+ | || ATmega8 || 1.0 || [[http:// | ||
+ | || ATmega328P || 2.x || [[http:// | ||
+ | || ATmega328P || 3.x || C || | ||
+ | |||
+ | **The current release is v3.4** | ||
===== Command Interface ===== | ===== Command Interface ===== | ||
Line 8: | Line 15: | ||
We communicate at 115200 baud as this is the default speed for the Livebox serial interface. | We communicate at 115200 baud as this is the default speed for the Livebox serial interface. | ||
- | The HAH firmware normally runs a process named xap-livebox to connect to the HAH PCB. If you want to connect manually for debug, be sire to kill off the xap-livebox process first. | + | The HAH firmware normally runs a process named xap-livebox to connect to the HAH PCB. If you want to connect manually for debug, be sure to kill off the xap-livebox process first. |
+ | |||
+ | <note important> | ||
< | < | ||
+ | # killall xap-livebox | ||
# microcom -s 115200 /dev/ttyS0 | # microcom -s 115200 /dev/ttyS0 | ||
+++ < | +++ < | ||
Line 35: | Line 45: | ||
</ | </ | ||
- | Channels | + | ==== Status ==== |
+ | |||
+ | Useful for debugging and figuring out what is going on. | ||
+ | |||
+ | < | ||
+ | >status 1wire | ||
+ | Found 1 1wire sensors | ||
+ | ID: 0 ROM: 282E2DCB010000A9 Model: DS18B20 | ||
+ | setResolution 12 bits, getResolution 12 bits | ||
+ | >status input | ||
+ | Input 1: 1 | ||
+ | Input 2: 1 | ||
+ | Input 3: 1 | ||
+ | Input 4: 1 | ||
+ | >status relay | ||
+ | Relay 1: 8 | ||
+ | Relay 2: 9 | ||
+ | Relay 3: 10 | ||
+ | Relay 4: 11 | ||
+ | </ | ||
==== report ==== | ==== report ==== | ||
Line 41: | Line 70: | ||
Display the current state of the INPUTS and any devices on the I2C or 1-Wire bus - __Debugging command__. | Display the current state of the INPUTS and any devices on the I2C or 1-Wire bus - __Debugging command__. | ||
< | < | ||
- | >report | + | >input 60 0 |
- | input 60,0 | + | 1wire 282E2DCB010000A9 18.8 |
- | 1wire 1 20 | + | |
> | > | ||
</ | </ | ||
Line 67: | Line 95: | ||
- | ==== 1wirereset | + | ==== 1wire reset ==== |
The 1-Wire bus is only scanned once during micro-controller startup, if additional devices are added to the unit whilst HOT the bus must be reset to pick these up. We don't recommend hot plugging. Note that the 1-Wire devices always enumerate in the same order. However, if you add a new device, you might find that it takes the slot currently allocated to an existing device. Do check your configuration after adding a new device. | The 1-Wire bus is only scanned once during micro-controller startup, if additional devices are added to the unit whilst HOT the bus must be reset to pick these up. We don't recommend hot plugging. Note that the 1-Wire devices always enumerate in the same order. However, if you add a new device, you might find that it takes the slot currently allocated to an existing device. Do check your configuration after adding a new device. | ||
Line 76: | Line 104: | ||
==== on / off ==== | ==== on / off ==== | ||
- | Toggle a relay or RF relay from the on to the off state. | + | Toggle a relay on/off. |
< | < | ||
>on 1 | >on 1 | ||
Line 82: | Line 110: | ||
</ | </ | ||
+ | For the M8 firmware this was also overloaded to control RF devices. | ||
+ | < | ||
+ | > on 5 | ||
+ | </ | ||
+ | The 1st RF sequence saved into EEPROM would be addressable as 5, the 2nd as 6 etc.. | ||
==== lcd ==== | ==== lcd ==== | ||
Line 91: | Line 124: | ||
- | ==== RF ==== | ||
- | |||
- | This command specifies the format of the RF pulse streams that are used to turn RF devices on and off. | ||
- | |||
- | * rf < | ||
- | * rf ccpbbbbbbbbbbbb - cc HEX Channel, p On/Off indicator, bbb.. RF control | ||
- | |||
- | The on/off indicators mark if this RF sequence turns on or off an external RF device. | ||
- | |||
- | Example: The default for Channel 9 (RF05) OFF. Don't forget the 1st four channels are for the internal relays, so RF-1 maps to Channel 5. | ||
- | < | ||
- | rf 0504D2AAAAAAA80 | ||
- | </ | ||
- | |||
- | === Technical details === | ||
- | |||
- | The RF command consists of 6 bytes/48 bits. Of those only 42 bits are used for generating the RF command signal for the Lidl RF sockets. | ||
- | |||
- | Looking at one of the RF sequences contained in the / | ||
- | < | ||
- | rf1.off=4D2AAAAAAA80 | ||
- | </ | ||
- | |||
- | This decodes into the following, we have separated off the last 6 bits as these aren't used. | ||
- | < | ||
- | 10011010010101010101010101010101010101010 000000 | ||
- | </ | ||
- | |||
- | The transmissions always begin by sending a HIGH pulse and alternates as we read each bit. The length of the pulse is determined by the "value of the bit" + 1, reading the pulse command from left to right. | ||
- | |||
- | The break between all pulses is 680uS. | ||
- | * 1st bit is 1 so we send two high pulses separated by a 680uS wait. | ||
- | * 2nd bit is 0 so we send one low pulse followed by a 680uS wait. | ||
- | * 3rd bit is 0 so we send one high pulse followed by 680uS wait. | ||
- | * 4th bit is 1 so we send two low pulses separated by a 680uS wait. | ||
- | * this sequence carries on. | ||
- | |||
- | When an RF signal is transmitted the entire Command is transmitted 8 times with an 80ms break between transmissions. | ||
- | |||
- | During transmission, | ||
- | The BBSB and HomeEasy sockets use a different protocol. Currently we supply an AVR device that is dedicated to either the Lidl OR the BBSB/ | ||
- | \\ | ||
- | \\ | ||
- | You can use this application to generate the HE/BBSB .ini file entries {{: | ||