NOTE: You have to erase the nand flash memory if you want to reflash your HABA-KNX-EXPLORER with SAM-BA. First you need to connect a usb cable on the type-B usb connector located on the front panel of your HABA-KNX-EXPLORER and your host.Then you need to open a terminal on your host (115200,n,8,1) by using the serial port corresponding to the usb device connection (/dev/ttyACM0).Eventually you have to erase the first block of the nand flash memory by issuing the following command: erase /dev/nand.at91bootstrap from the barebox command line.

Issue sam-ba from the command line to start SAM-BA.

Note: Depending on your linux distro you should have to issue the following command in order to create a symlink to
/dev/ttyACM0: ln -s /dev/ttyACM0 /dev/ttyUSB0

From the window below choose the haba_knx_explorer board and click on the Connect button.

Once sam-ba is loaded you should see the following window

Click on the Script File menu and click on Execute

Choose the haba-knx-explorer.tcl script in the calao directory.

When the haba-knx-explorer.tcl starts, SAM-BA will ask you to browse your home directory in order to find the at91 bootstrap loader binary.

Browse your home directory in order to load the nandflash_haba_knx_explorer.bin file.

Note: By default the haba-knx-explorer.tcl script will load the binaries from ~/buildroot/output/images/

- Nand Flash Mapping Table

NAND Offset

Size

Reserved for

0x00000

128KB

at91bootstrap loader (nandflash_haba_knx_explorer.bin)

0x20000

256KB

bootloader (barebox.bin)

0xA0000

128KB

Device tree blob

0xC0000

4MB

Linux kernel image (default:zImage)

0x4C0000

120MB

UBI rootfs (default:rootfs.ubifs)

After a while your board is re-flash

Note: You can edit the haba-knx-explorer.tcl script from the Script File menu in order to modify your default binaries directory.

How to use barebox

Introduction

Barebox (formerly known as u-boot-v2) is a bootloader that inherits the best of U-Boot and the Linux kernel: The size and look-and-feel of u-boot, with driver model and lots of design concepts from the kernel.

Start with barebox

Once your HABA-KNX-EXPLORER is re-flashed, you can plug in an ethernet cable on the RJ-45 connector and reset your board as shown below:

Then start a terminal program on your host (minicom for instance), setup your serial link with the following parameters: 115200,n,8,1.

In your terminal window you should see something similar to the information displayed below:

If you don't stop the auto countdown, you can notice barebox tries to boot from the network.

Issue a ctrl-c from your terminal to stop the network boot stage as it is not probably well configured.

How to install a UBI rootfs from barebox

Prepare the Flash before UBI rootfs install

The /dev/nand0.root partition can be attached to ubi using

ubiattach /dev/nand0.rootfs

NOTE: Before attaching the rootfs partition to ubi please erase it with erase /dev/nand0.rootfs

Create a volume on the UBI device

ubimkvol /dev/ubi0 root 0

Load a file from a tftp server

Setup a tftp server on your host and copy the UBI rootfs from ~/buildroot/output/images/ to your tftp directory.

Setup your network from barebox:

If you have a dhcp server available on your network you can see the network parameters by issuing the following command:

devinfo eth0

If you want to modify for example the serverip you have to issue the following command:

eth0.serverip=192.168.1.10

As your network setup is ok, you can load a file from barebox with the command below:

tftp zImage zImage

Issue ls and you should see your file in the / directory

Flash the UBI rootfs from barebox

The UBI volume can then be flashed with the command below:

tftp rootfs.ubifs /dev/ubi0.root

Save your network settings

From the barebox command line you can save your network settings by editing the config file in /env directory:

edit env/config

env/config <ctrl-d>: Save and quit <ctrl-c>: quit
#!/bin/sh
# use 'dhcp' to do dhcp in barebox and in kernel
# use 'none' if you want to skip kernel ip autoconfiguration
ip=dhcp-barebox
dhcp_vendor_id=barebox-haba-knx-explorer
# or set your networking parameters here
#eth0.ipaddr=a.b.c.d
#eth0.netmask=a.b.c.d
#eth0.gateway=a.b.c.d
#eth0.serverip=a.b.c.d
# can be either 'nfs', 'tftp', 'nor' or 'nand'
kernel_loc=nand
# can be either 'net', 'nor', 'nand' or 'initrd'
rootfs_loc=nand
# can be either 'nfs', 'tftp', 'nor', 'nand' or empty
oftree_loc=none

env/config <ctrl-d>: Save and quit <ctrl-c>: quit
#!/bin/sh
# use 'dhcp' to do dhcp in barebox and in kernel
# use 'none' if you want to skip kernel ip autoconfiguration
# ip=dhcp-barebox
dhcp_vendor_id=barebox-haba-knx-explorer
# or set your networking parameters here
#eth0.ipaddr=a.b.c.d
#eth0.netmask=a.b.c.d
#eth0.gateway=a.b.c.d
#eth0.serverip=a.b.c.d
# can be either 'nfs', 'tftp', 'nor' or 'nand'
kernel_loc=nfs
# can be either 'net', 'nor', 'nand' or 'initrd'
rootfs_loc=net
# can be either 'nfs', 'tftp', 'nor', 'nand' or empty
oftree_loc=none
# can be either 'jffs2' or 'ubifs'
rootfs_type=ubifs

# use 'dhcp' to do dhcp in barebox and in kernel
# use 'none' if you want to skip kernel ip autoconfiguration
# ip=dhcp-barebox
ip=none
dhcp_vendor_id=barebox-haba-knx-explorer
# or set your networking parameters here
#eth0.ipaddr=a.b.c.d
#eth0.netmask=a.b.c.d
#eth0.gateway=a.b.c.d
#eth0.serverip=a.b.c.d
# can be either 'nfs', 'tftp', 'nor' or 'nand'
kernel_loc=nand
# can be either 'net', 'nor', 'nand' or 'initrd'
rootfs_loc=nand
# can be either 'nfs', 'tftp', 'nor', 'nand' or empty
oftree_loc=nand
# can be either 'jffs2' or 'ubifs'
rootfs_type=ubifs
rootfsimage=root.$rootfs_type
kernelimage=zImage
#kernelimage=uImage
#kernelimage=Image
#kernelimage=Image.lzo

Save your config file by issuing Ctrl-d

Note:If you built a linux kernel with DT, you should specify where your DT blob is located with oftree_loc

Now to save your config issue the following command :

saveenv

Issue reset in order to check your default boot sequence

reset

How to use the dfu

DFU for Device Firmware upgrade can be used to download and upload barebox, linux kernel and the rootfs to the HABA-KNX-EXPLORER connected over USB.

Let's assume that you want to upgrade your kernel image from barebox.

Plug a usb cable on the Type B USB receptacle located on the front panel of your HABA-KNX-EXPLORER controller

Plug the other side in your host machine

Supply your HABA-KNX-EXPLORER controller

During the boot, press the user push button of the HABA-KNX-EXPLORER in order to start the DFU automatically.

Note: If you don't want to remove the case, you can also start the dfu from the barebox command line by issuing the command below:
dfu ${dfu_config} -P ${product_id} -V ${vendor_id}

Replace ip=dhcp by ip= and if you don't have a dhcp server available on your network, you can setup the following variables:

eth0.ipaddr

eth0.serverip

eth0.netmask

eth0.gateway

eth0.ethaddr

#!/bin/sh
# use 'dhcp' to do dhcp in barebox and in kernel
# use 'none' if you want to skip kernel ip autoconfiguration
#ip=dhcp-barebox
#dhcp_vendor_id=barebox-haba-explorer
ip=
nfsroot=/home/user/nfs
# or set your networking parameters here
eth0.ipaddr=192.168.1.100
#eth0.netmask=255.255.255.0
#eth0.gateway=192.168.1.10
eth0.serverip=192.168.1.10
# can be either 'nfs', 'tftp', 'nor' or 'nand'
kernel_loc=tftp
# can be either 'net', 'nor', 'nand' or 'initrd'
rootfs_loc=net
# can be either 'nfs', 'tftp', 'nor', 'nand' or empty
oftree_loc=none
# can be either 'jffs2' or 'ubifs'
rootfs_type=ubifs
rootfsimage=root.$rootfs_type
kernelimage=zImage
#kernelimage=uImage
#kernelimage=Image
#kernelimage=Image.lzo
nand_device=atmel_nand
nand_parts="128k(at91bootstrap),256k(barebox)ro,128k(bareboxenv),128k(bareboxenv2),128k(oftree),4M(kernel),120M(rootfs),-(data)"
rootfs_mtdblock_nand=6
autoboot_timeout=3
bootargs="console=ttyS0,115200"
# set a fancy prompt (if support is compiled in)
PS1="\e[1;32mbarebox@\e[1;31m\h:\w\e[0m\n# "
#

As you can notice above in the config file, the kernel image will be downloaded from the tftp server installed on your host.
If you have flashed a kernel in the nand flash memory you can replace kernel_loc=tftp by kernel_loc=nand to check if everything is ok.

You can now save your file with ctrl-d and saveenv and reset your board.

Note: You will have to setup your nfsroot variable in function of your nfs settings

You will find a lot of interesting information about how to install a tftp server on your preferred linux distro documentation.

How to download a file from the serial port

If you want to download a file through the serial port you can issue the following command on your target:

loadb -f filename -c

From your host you can use for instance C-Kermit and issue the command below in order to send a file to your QIL-A9260:

~$ kermit
?SET SPEED has no effect without prior SET LINE
C-Kermit 8.0.211, 10 Apr 2004, for Linux
Copyright (C) 1985, 2004,
Trustees of Columbia University in the City of New York.
Type ? or HELP for help.
Linux Kermit> send filename

Note: You should configure kermit by editing the kermrc file located in /etc/kermit/

How to take control of the haba-knx-explorer

The user can access the haba-knx-explorer from a host by issuing the following command:

$ssh root@haba_ipaddress

Note: By default no password is required

How to install knxweb2

The user can easily install knxweb2 by executing the knxweb2-install.sh script available in the root/ directory.

First download the knxweb2 package from here and copy this package to the haba-knx rootfs.