Software setup Flashing Functional test Fault analysis Introduction PC installation Ben installation Ben setup Test profiles
Before performing production tests, various pieces of software need to be installed on Ben and PC, and configuration settings may have to be adjusted. The following sections describe the installation and configuration process.
For a DUT and reference device role, the ben-wpan tools and the test scripts have to be installed on the PC. For flashing the atusb application firmware, also dfu-util and the firmware binary are required.

The instructions below assume that a complete development environment is already present on the PC, including SDL, SDL_gfx, and GSL. If any prerequisites are not met, compilation will fail, and you'll have to install the corresponding package and try again. To build the ben-wpan tools and install them under /usr/local/ on the local machine, run the following commands:

git clone git://projects.qi-hardware.com/ben-wpan.git
cd ben-wpan/tools
make
make install

A different directory prefix can be chosen by overriding the INSTALL_PREFIX variable, e.g.,

make INSTALL_PREFIX=/usr install

Note that the test scripts expect ${INSTALL_PREFIX}/bin to be in PATH. The test scripts are in the directory prod/ of the ben-wpan project. They currently are designed to be run from this directory. Therefore, all that's necessary is to check out the repository, as shown above. dfu-util is used to transfer the application firmware to atusb boards. To build dfu-util from source, run these commands:

git clone git://git.openezx.org/dfu-util.git
cd dfu-util
./autogen.sh
./configure
make
make install
Note that some Linux distributions already provide a pre-compiled version of dfu-util, which could be used instead of building it from source. The clock frequency test for atusb measures the clock frequency relative to the PC clock. Many PC clocks are highly inaccurate, which would render the result of the measurement meaningless. To improve the quality of the reference clock, it should be disciplined by NTP.

If NTP is not available, it may be necessary to increase the test's tolerance by changing the variable CLOCK_DRIFT_PPM in the script atusb. The binary of the application running on atusb is transferred from the PC. To download a pre-compiled version, use this command:

wget -O atusb.bin \
     http://downloads.qi-hardware.com/people/werner/wpan/bindist/atusb-38a08c0.bin
Instructions for building the binary from sources are here. To simplify accessing the Ben via TCP/IP, its IP address should be registered in the /etc/hosts file on the PC. If the Ben is running OpenWrt, use the following command:
echo 192.168.254.101 ben >>/etc/hosts

If the Ben is running Jlime, the address would be as follows:

echo 192.168.1.202 ben >>/etc/hosts

If using the same PC with Bens running OpenWrt and Jlime, one may choose different host names depending on the distribution, and adapt the commands used in the production and testing process accordingly. For example,

echo 192.168.254.101 ben >>/etc/hosts
echo 192.168.1.202 jlime >>/etc/hosts
If using prod/Makefile to run the production test process, the names of the drivers for DUT and reference device are defined through variables at the beginning of the Makefile. In particular, if the host name or IP address under which the Ben is reached differs from "ben", the value of ATBEN_DUT and ATUSB_REF will have be changed accordingly.

The Makefile also contains the variable SPECTRUM_MARGIN that defines how many dB of tolerance should be allowed below and above the reference signal strength. The default is to allow a margin of 5 dB in either direction.

The scripts atusb and atusb-flash also contain configuration variables. If the names of the files containing the atusb firmware binaries are not boot.hex and atusb.bin, atusb-flash needs to be adapted.

For a DUT and reference device role, the ben-wpan utilities have to be installed on a Ben. For flashing the atusb boot loader, also avrdude and the boot loader binary are needed.

The instructions below apply for OpenWrt and Jlime. For building things from source, a cross-compilation toolchain has to be installed on the PC. To enable password-less remote access from the PC, set up network access to the Ben and run the following command:

ssh ben 'cat >>/etc/dropbear/authorized_keys' <~/.ssh/id_rsa.pub
To build and install the ben-wpan tools on the Ben, first set up networking between the PC and the Ben. If you have not yet checked out the project's repository, run these commands:
git clone git://projects.qi-hardware.com/ben-wpan.git
cd ben-wpan/tools
If you have already checked out the repository, cd to ben-wpan/tools/ and run
make clean
Next, if on OpenWrt, compile the tools with
make TARGET=ben_openwrt
If on Jlime, use
make TARGET=ben_jlime
Finally, upload the tools to the Ben and install them under /usr/bin/ with
make HOST=ben upload
Where ben is the host name or IP address assigned to the Ben. The atusb boot loader is flashed using avrdude. A pre-compiled static binary (suitable for OpenWrt and Jlime) can be installed by running the following two commands on the Ben:
wget http://downloads.qi-hardware.com/people/werner/wpan/bindist/avrdude-5.10-de72af351f661b538add81cbc9965278a2f8c40c.tar.gz
tar -xz -C / -f avrdude-5.10-de72af351f661b538add81cbc9965278a2f8c40c.tar.gz
Instructions for building avrdude from sources are here. The binary of the boot loader running on atusb is transferred from the Ben. To download a pre-compiled version, use this command:
wget -O boot.hex \
   http://downloads.qi-hardware.com/people/werner/wpan/bindist/boot-de72af351f661b538add81cbc9965278a2f8c40c.hex
Instructions for building the binary from sources are here.
The configuration settings described in this section are lost on each reset or reboot and need to be entered again. Alternatively, a setup script running at boot time can be written. Once the Ben has booted and started USB networking, the interface on the PC side is configured as follows:
ifconfig usb0 192.168.254.100 up

These are the settings for OpenWrt, assuming the network device is called "usb0". If using Jlime, the command would be as follows:

ifconfig usb0 192.168.1.200 up
Before running any of the ben-wpan utilities, other users of the 8:10 card slot have to be disabled. In a Ben running the regular OpenWrt or Jlime distribution, the only such user that is automatically started is the MMC kernel driver. The following command disables it:
echo jz4740-mmc.0 >/sys/bus/platform/drivers/jz4740-mmc/unbind

If a WPAN-enabled kernel has been installed, the AT86RF230 driver takes the place of the MMC driver. To disable it, run

echo spi2.0 >/sys/bus/spi/drivers/at86rf230/unbind
Note that the above command only has the desired effect if used before running any of the user-space tools. If the kernel driver and the user-space tools have already clashed over access to the board, the driver will not unbind and a reboot is needed. On the Ben, launch the proxy daemon. We pass the option -b to background it:
atrf-proxy -b
Some of the functional tests measure characteristics that are strongly influenced by the test setup. It is therefore not possible to provide universally applicable reference values, but they have to be measured in the actual test environment. Insert a known to be good atben board and run the following command directly on the Ben to record the reference value for the clock count with an accuracy of roughly +/−20 ppm:
atrf-xtal 1000 >ben.xtal

This takes about 5 seconds.

Note that the result depends on the tolerance of the crystal in the Ben and is also affected by temperature. Good accuracy can therefore only be obtained if this measurement is performed individually on each Ben, and if a stable temperature is maintained. The signal strength of a DUT is assessed by comparing it with measurements previously obtained in the same setup, with a known to be good device taking the role of the DUT. It is therefore necessary to establish a reference profile each time the test environment changes, e.g., when changing location or when using a different reference device.

The physical arrangement of the devices should have the characteristics described in the test section. The orientation of the devices should be chosen such that the overall signal strength is near its maximum, that the spectrum is relatively "flat", and that small changes in the orientation only produce small variations in the measured signal strength.

To generate the profiles for atben and atusb, simply run

make spectrum
Then place the devices appropriately and press D to use the displayed spectrum as the reference. Multiple spectra can be merged into the reference, e.g., if unavoidable environmental variations cause significant changes. Spectra included in the reference are shown in blue.

After a obtaining the reference spectrum, press Q to exit. The Makefile will then record the signal strength limits for an atben DUT in the file ben.profile and proceed with the reverse measurement, i.e., with atusb acting as the DUT.