The microcontroller firmware for the AVR is written in C using the Arduino IDE.
The current release is v3.4
On the top RHS of every HAH web UI page, you will see 'Build: vvv.v/x.x'
vvv.v is the HAH firmware build. x.x is the AVR code version.
You can force the xap-livebox program to communicate at a specific version if auto detection of the AVR firmware version is failing using the following setting in your /etc/xap-livebox.ini file.
[hardware] major=3 minor=4
The AVR firmware runs a simple text command line interface as its protocol. Connecting directly to its firmware, we can interact directly with the unit. This made writing and debugging the unit easier as all communication is text based and via the Livebox serial port.
We communicate at 115200 baud as this is the default speed for the Livebox serial interface. This also affects the XTAL we need to choose for the hardware. 7.3728Mhz gives us the most accuracy at this baud rate.
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.
The ATmega8 does not have a visible command line even thou access is possible this way too.
# killall xap-livebox # microcom -s 115200 /dev/ttyS0 +++ <--- depending on the state of the AVR you might need to jump it past the BOOT wait stage debug <--- enter this note it will not be echo'd >help $Revision: 271 $ Available Commands: <relay> = 1-4 DEBUG VERSION HELP REPORT [1WIRE|PPE|INPUT] 1WIRE [RESET|DISABLE] STATUS [1WIRE|RELAY|INPUT] REBOOT ON <relay> OFF <relay> LCD <message> I2C SCAN I2C R Maa - addr Baavv - addr/value Paapv - addr/port/value URF hex >
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
Display the current state of the INPUTS and any devices on the I2C or 1-Wire bus - Debugging command.
>input 60 0 1wire 282E2DCB010000A9 18.8 >
During normal operation these values will be emitted when a change occurs. They are polled by the AVR, using an interrupt, every second.
1wire DEVICE-ID VALUE
To the input value, PORTD of the AVR, the following bit mask
00111100 is applied as only ports 2,3,4,5 are being used to give us our 4x input channels. There is a small debounce applied by the AVR code when reading the inputs. If your environment is 'noisy' you might want to add a small, external, pullup resistor to the input.
input 60,0 (in binary 111100,000000 - VALUE,Change Mask )
As the change mask is 0 no bit has been modified from the previous POLL. The inputs float high with a path to GND(0) when “CLOSED”.
The I2C bus will report the following when a delta is detected between the current and previous value or the report command is issued and an I2C device has been configured.
i2c-ppe ADDR PREVIOUS-VALUE CURRENT-VALUE
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.
Reset the microcontroller. This will be executed when the Livebox is asked to reboot so both sub-systems stay synchronized.
on / off
Toggle a relay on/off.
>on 1 >off 1
For the M8 firmware this was also overloaded to control RF devices. This was replaced in the 328 firmware with universalrf
> on 5
The 1st RF sequence saved into EEPROM would be addressable as 5, the 2nd as 6 etc..
Send a message to the LCD screen
>lcd hello world