IEEE 802.15.4 subsystem
Sign in or create your account | Project List | Help
IEEE 802.15.4 subsystem Git Source Tree
Root/
| Source at commit cec05a0f5ea2fb4ff5637d418c7f5dae196abda8 created 6 years 9 months ago. By Werner Almesberger, atusb/atusb.pro: we don't use power.lib anymore | |
|---|---|
| 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
| 2 | <HTML> |
| 3 | <TITLE>Production and testing: Software setup</TITLE> |
| 4 | <BODY bgcolor="#ffffff" link="#000000" vlink="#404040"> |
| 5 | |
| 6 | <INCLUDE file="style.inc"> |
| 7 | |
| 8 | <PAGE_BAR title="Production and testing"> |
| 9 | <PAGE_CURR href="setup.html">Software setup</PAGE_CURR> |
| 10 | <PAGE_ITEM href="flash.html">Flashing</PAGE_ITEM> |
| 11 | <PAGE_ITEM href="test.html">Functional test</PAGE_ITEM> |
| 12 | <PAGE_ITEM href="analysis.html">Fault analysis</PAGE_ITEM> |
| 13 | </PAGE_BAR> |
| 14 | |
| 15 | <SECTION_BAR> |
| 16 | <SECTION_ITEM href="#intro">Introduction</SECTION_ITEM> |
| 17 | <SECTION_ITEM href="#pcsw">PC installation</SECTION_ITEM> |
| 18 | <SECTION_ITEM href="#bensw">Ben installation</SECTION_ITEM> |
| 19 | <SECTION_ITEM href="#bensys">Ben setup</SECTION_ITEM> |
| 20 | <SECTION_ITEM href="#profiles">Test profiles</SECTION_ITEM> |
| 21 | </SECTION_BAR> |
| 22 | |
| 23 | |
| 24 | <!-- ====================================================================== --> |
| 25 | |
| 26 | |
| 27 | <SECTION ref="intro" title="Introduction"> |
| 28 | |
| 29 | Before performing production tests, various pieces of software |
| 30 | need to be installed on Ben and PC, and configuration settings may |
| 31 | have to be adjusted. The following sections describe the installation |
| 32 | and configuration process. |
| 33 | |
| 34 | |
| 35 | <!-- ====================================================================== --> |
| 36 | |
| 37 | |
| 38 | <SECTION ref="pcsw" title="PC software installation"> |
| 39 | |
| 40 | For a DUT and reference device role, the ben-wpan tools |
| 41 | and the test scripts have to be installed on the PC. For flashing the |
| 42 | <B>atusb</B> application |
| 43 | firmware, also dfu-util and the firmware binary are required. |
| 44 | <P> |
| 45 | The instructions below assume that a complete development environment |
| 46 | is already present on the PC, including SDL, SDL_gfx, and GSL. |
| 47 | If any prerequisites are not met, |
| 48 | compilation will fail, and you'll have to install the corresponding |
| 49 | package and try again. |
| 50 | |
| 51 | |
| 52 | <!-- ---------------------------------------------------------------------- --> |
| 53 | |
| 54 | |
| 55 | <SUBSECTION title="Install ben-wpan tools"> |
| 56 | |
| 57 | To build the ben-wpan tools and install them under |
| 58 | <SAMP>/usr/local/</SAMP> on the local machine, |
| 59 | run the following commands: |
| 60 | <PRE> |
| 61 | git clone git://projects.qi-hardware.com/ben-wpan.git |
| 62 | cd ben-wpan/tools |
| 63 | make |
| 64 | make install |
| 65 | </PRE> |
| 66 | <P> |
| 67 | A different directory prefix can be chosen by overriding the |
| 68 | <SAMP>INSTALL_PREFIX</SAMP> variable, e.g., |
| 69 | <PRE> |
| 70 | make INSTALL_PREFIX=/usr install |
| 71 | </PRE> |
| 72 | <P> |
| 73 | Note that the test scripts expect <SAMP>${INSTALL_PREFIX}/bin</SAMP> |
| 74 | to be in <SAMP>PATH</SAMP>. |
| 75 | |
| 76 | |
| 77 | <!-- ---------------------------------------------------------------------- --> |
| 78 | |
| 79 | |
| 80 | <SUBSECTION title="Install test scripts"> |
| 81 | |
| 82 | The test scripts are in the directory <SAMP>prod/</SAMP> of the |
| 83 | ben-wpan project. They currently are designed to be run from |
| 84 | this directory. Therefore, all that's necessary is to check out the |
| 85 | repository, as shown above. |
| 86 | |
| 87 | |
| 88 | <!-- ---------------------------------------------------------------------- --> |
| 89 | |
| 90 | |
| 91 | <SUBSECTION title="Install dfu-util"> |
| 92 | |
| 93 | dfu-util is used to transfer the application firmware to |
| 94 | <B>atusb</B> boards. To build dfu-util from source, run these |
| 95 | commands: |
| 96 | |
| 97 | <PRE> |
| 98 | git clone git://git.openezx.org/dfu-util.git |
| 99 | cd dfu-util |
| 100 | ./autogen.sh |
| 101 | ./configure |
| 102 | make |
| 103 | make install |
| 104 | </PRE> |
| 105 | |
| 106 | Note that some Linux distributions already provide a pre-compiled |
| 107 | version of dfu-util, which could be used instead of building |
| 108 | it from source. |
| 109 | |
| 110 | |
| 111 | <!-- ---------------------------------------------------------------------- --> |
| 112 | |
| 113 | |
| 114 | <SUBSECTION title="Install and run NTP"> |
| 115 | |
| 116 | The clock frequency test for <B>atusb</B> measures the clock frequency |
| 117 | relative to the PC clock. Many PC clocks are highly inaccurate, which |
| 118 | would render the result of the measurement meaningless. To improve the |
| 119 | quality of the reference clock, it should be disciplined by NTP. |
| 120 | <P> |
| 121 | If NTP is not available, it may be necessary to increase the test's |
| 122 | tolerance by changing the variable <SAMP>CLOCK_DRIFT_PPM</SAMP> in |
| 123 | the script <SAMP>atusb</SAMP>. |
| 124 | |
| 125 | |
| 126 | <!-- ---------------------------------------------------------------------- --> |
| 127 | |
| 128 | |
| 129 | <SUBSECTION title="Install firmware binary"> |
| 130 | |
| 131 | The binary of the application running on <B>atusb</B> is transferred from |
| 132 | the PC. To download a pre-compiled version, use this command: |
| 133 | |
| 134 | <PRE> |
| 135 | wget -O atusb.bin \ |
| 136 | http://downloads.qi-hardware.com/people/werner/wpan/bindist/atusb-ce16a16.bin |
| 137 | </PRE> |
| 138 | |
| 139 | Instructions for building the binary from sources are |
| 140 | <A href="http://projects.qi-hardware.com/index.php/p/ben-wpan/source/tree/master/atusb/fw/README">here</A>. |
| 141 | |
| 142 | |
| 143 | <!-- ---------------------------------------------------------------------- --> |
| 144 | |
| 145 | |
| 146 | <SUBSECTION title="Register Ben host name"> |
| 147 | |
| 148 | To simplify accessing the Ben via TCP/IP, its IP address should be |
| 149 | registered in the <SAMP>/etc/hosts</SAMP> file on the PC. If the Ben is |
| 150 | running OpenWrt, use the following command: |
| 151 | <PRE> |
| 152 | echo 192.168.254.101 ben >>/etc/hosts |
| 153 | </PRE> |
| 154 | <P> |
| 155 | If the Ben is running Jlime, the address would be as follows: |
| 156 | <PRE> |
| 157 | echo 192.168.1.202 ben >>/etc/hosts |
| 158 | </PRE> |
| 159 | <P> |
| 160 | If using the same PC with Bens running OpenWrt and Jlime, one may choose |
| 161 | different host names depending on the distribution, and adapt the commands |
| 162 | used in the production and testing process accordingly. For example, |
| 163 | <PRE> |
| 164 | echo 192.168.254.101 ben >>/etc/hosts |
| 165 | echo 192.168.1.202 jlime >>/etc/hosts |
| 166 | </PRE> |
| 167 | |
| 168 | |
| 169 | <!-- ---------------------------------------------------------------------- --> |
| 170 | |
| 171 | |
| 172 | <SUBSECTION title="Customize test scripts"> |
| 173 | |
| 174 | If using <SAMP>prod/Makefile</SAMP> to run the production test process, |
| 175 | the names of the drivers for DUT and reference device are defined |
| 176 | through variables at the beginning of the Makefile. In particular, |
| 177 | if the host name or IP address under which the Ben is reached differs from |
| 178 | "ben", the value of <SAMP>ATBEN_DUT</SAMP> and <SAMP>ATUSB_REF</SAMP> |
| 179 | will have be changed accordingly. |
| 180 | <P> |
| 181 | The Makefile also contains the variable <SAMP>SPECTRUM_MARGIN</SAMP> that |
| 182 | defines how many dB of tolerance should be allowed below and above the |
| 183 | reference signal strength. The default is to allow a margin of 5 dB in |
| 184 | either direction. |
| 185 | <P> |
| 186 | The scripts <SAMP>atusb</SAMP> and <SAMP>atusb-flash</SAMP> also contain |
| 187 | configuration variables. If the names of the files containing the |
| 188 | <B>atusb</B> firmware binaries are not <SAMP>boot.hex</SAMP> and |
| 189 | <SAMP>atusb.bin</SAMP>, <SAMP>atusb-flash</SAMP> needs to be adapted. |
| 190 | |
| 191 | |
| 192 | <!-- ====================================================================== --> |
| 193 | |
| 194 | |
| 195 | <SECTION ref="bensw" title="Ben software installation"> |
| 196 | |
| 197 | For a DUT and reference device role, the ben-wpan utilities |
| 198 | have to be installed on a Ben. For flashing the <B>atusb</B> boot |
| 199 | loader, also avrdude and the boot loader binary are needed. |
| 200 | <P> |
| 201 | The instructions below apply for OpenWrt and Jlime. For building |
| 202 | things from source, a cross-compilation toolchain has to be installed |
| 203 | on the PC. |
| 204 | |
| 205 | |
| 206 | <!-- ---------------------------------------------------------------------- --> |
| 207 | |
| 208 | |
| 209 | <SUBSECTION title="Password-less remote access"> |
| 210 | |
| 211 | To enable password-less remote access from the PC, set up network |
| 212 | access to the Ben and run the following command: |
| 213 | <PRE> |
| 214 | ssh ben 'cat >>/etc/dropbear/authorized_keys' <~/.ssh/id_rsa.pub |
| 215 | </PRE> |
| 216 | |
| 217 | |
| 218 | <!-- ---------------------------------------------------------------------- --> |
| 219 | |
| 220 | |
| 221 | <SUBSECTION title="Install ben-wpan tools"> |
| 222 | |
| 223 | To build and install the ben-wpan tools on the Ben, first set |
| 224 | up networking between the PC and the Ben. If you have not yet checked |
| 225 | out the project's repository, run these commands: |
| 226 | |
| 227 | <PRE> |
| 228 | git clone git://projects.qi-hardware.com/ben-wpan.git |
| 229 | cd ben-wpan/tools |
| 230 | </PRE> |
| 231 | |
| 232 | If you have already checked out the repository, <SAMP>cd</SAMP> to |
| 233 | <SAMP>ben-wpan/tools/</SAMP> and run |
| 234 | |
| 235 | <PRE> |
| 236 | make clean |
| 237 | </PRE> |
| 238 | |
| 239 | Next, if on OpenWrt, compile the tools with |
| 240 | <PRE> |
| 241 | make TARGET=ben_openwrt |
| 242 | </PRE> |
| 243 | |
| 244 | If on Jlime, use |
| 245 | <PRE> |
| 246 | make TARGET=ben_jlime |
| 247 | </PRE> |
| 248 | |
| 249 | Finally, upload the tools to the Ben and install them under |
| 250 | <SAMP>/usr/bin/</SAMP> with |
| 251 | |
| 252 | <PRE> |
| 253 | make HOST=ben upload |
| 254 | </PRE> |
| 255 | |
| 256 | Where <SAMP>ben</SAMP> is the host name or IP address assigned to the Ben. |
| 257 | |
| 258 | |
| 259 | <!-- ---------------------------------------------------------------------- --> |
| 260 | |
| 261 | |
| 262 | <SUBSECTION title="Install avrdude"> |
| 263 | |
| 264 | The <B>atusb</B> boot loader is flashed using avrdude. A pre-compiled |
| 265 | static binary (suitable for OpenWrt and Jlime) can be installed by running |
| 266 | the following two commands on the Ben: |
| 267 | |
| 268 | <PRE> |
| 269 | wget http://downloads.qi-hardware.com/people/werner/wpan/bindist/avrdude-5.10-de72af351f661b538add81cbc9965278a2f8c40c.tar.gz |
| 270 | tar -xz -C / -f avrdude-5.10-de72af351f661b538add81cbc9965278a2f8c40c.tar.gz |
| 271 | </PRE> |
| 272 | |
| 273 | Instructions for building avrdude from sources are |
| 274 | <A href="http://projects.qi-hardware.com/index.php/p/ben-blinkenlights/source/tree/master/avrdude/README |
| 275 | ">here</A>. |
| 276 | |
| 277 | |
| 278 | <!-- ---------------------------------------------------------------------- --> |
| 279 | |
| 280 | |
| 281 | <SUBSECTION title="Install boot-loader binary"> |
| 282 | |
| 283 | The binary of the boot loader running on <B>atusb</B> is transferred from |
| 284 | the Ben. To download a pre-compiled version, use this command: |
| 285 | |
| 286 | <PRE> |
| 287 | wget -O boot.hex \ |
| 288 | http://downloads.qi-hardware.com/people/werner/wpan/bindist/boot-ce16a16.hex |
| 289 | </PRE> |
| 290 | |
| 291 | Instructions for building the binary from sources are |
| 292 | <A href="http://projects.qi-hardware.com/index.php/p/ben-wpan/source/tree/master/atusb/fw/README">here</A>. |
| 293 | |
| 294 | |
| 295 | <!-- ====================================================================== --> |
| 296 | |
| 297 | |
| 298 | <SECTION ref="bensys" title="Ben system setup"> |
| 299 | |
| 300 | The configuration settings described in this section are lost on each |
| 301 | reset or reboot and need to be entered again. Alternatively, |
| 302 | a setup script running at boot time can be written. |
| 303 | |
| 304 | |
| 305 | <!-- ---------------------------------------------------------------------- --> |
| 306 | |
| 307 | |
| 308 | <SUBSECTION title="Enable network access"> |
| 309 | |
| 310 | Once the Ben has booted and started USB networking, the interface |
| 311 | on the PC side is configured as follows: |
| 312 | <PRE> |
| 313 | ifconfig usb0 192.168.254.100 up |
| 314 | </PRE> |
| 315 | <P> |
| 316 | These are the settings for OpenWrt, assuming the network device is |
| 317 | called "usb0". If using Jlime, the command would be as follows: |
| 318 | <PRE> |
| 319 | ifconfig usb0 192.168.1.200 up |
| 320 | </PRE> |
| 321 | |
| 322 | |
| 323 | <!-- ---------------------------------------------------------------------- --> |
| 324 | |
| 325 | |
| 326 | <SUBSECTION title="Silence other 8:10 card users"> |
| 327 | |
| 328 | Before running any of the ben-wpan utilities, other users of the 8:10 |
| 329 | card slot have to be disabled. In a Ben running the regular OpenWrt or |
| 330 | Jlime distribution, the only such user that is automatically started |
| 331 | is the MMC kernel driver. The following command disables it: |
| 332 | <PRE> |
| 333 | echo jz4740-mmc.0 >/sys/bus/platform/drivers/jz4740-mmc/unbind |
| 334 | </PRE> |
| 335 | <P> |
| 336 | If a WPAN-enabled kernel has been installed, the AT86RF230 driver takes |
| 337 | the place of the MMC driver. To disable it, run |
| 338 | <PRE> |
| 339 | echo spi2.0 >/sys/bus/spi/drivers/at86rf230/unbind |
| 340 | </PRE> |
| 341 | Note that the above command only has the desired effect if used |
| 342 | before running any of the user-space tools. If the kernel driver and |
| 343 | the user-space tools have already clashed over access to the board, the |
| 344 | driver will not unbind and a reboot is needed. |
| 345 | |
| 346 | |
| 347 | <!-- ---------------------------------------------------------------------- --> |
| 348 | |
| 349 | |
| 350 | <SUBSECTION title="Start atrf-proxy"> |
| 351 | |
| 352 | On the Ben, launch the proxy daemon. We pass the option -b to background it: |
| 353 | <PRE> |
| 354 | atrf-proxy -b |
| 355 | </PRE> |
| 356 | |
| 357 | |
| 358 | <!-- ====================================================================== --> |
| 359 | |
| 360 | |
| 361 | <SECTION ref="profiles" title="Test profiles"> |
| 362 | |
| 363 | Some of the functional tests measure characteristics that are strongly |
| 364 | influenced by the test setup. It is therefore not possible to provide |
| 365 | universally applicable reference values, but they have to be measured |
| 366 | in the actual test environment. |
| 367 | |
| 368 | |
| 369 | <!-- ---------------------------------------------------------------------- --> |
| 370 | |
| 371 | |
| 372 | <SUBSECTION title="Clock count (atben only)"> |
| 373 | |
| 374 | Insert a known to be good <B>atben</B> board and run the following |
| 375 | command directly on the Ben to record the reference value for the |
| 376 | clock count with an accuracy of roughly +/−20 ppm: |
| 377 | |
| 378 | <PRE> |
| 379 | atrf-xtal 1000 >ben.xtal |
| 380 | </PRE> |
| 381 | <P> |
| 382 | This takes about 5 seconds. |
| 383 | <P> |
| 384 | Note that the result depends on the tolerance of the crystal in the Ben |
| 385 | and is also affected by temperature. Good accuracy can therefore |
| 386 | only be obtained if this measurement is performed individually on each |
| 387 | Ben, and if a stable temperature is maintained. |
| 388 | |
| 389 | |
| 390 | <!-- ---------------------------------------------------------------------- --> |
| 391 | |
| 392 | |
| 393 | <SUBSECTION title="Signal strength"> |
| 394 | |
| 395 | The signal strength of a DUT is assessed by comparing it with |
| 396 | measurements previously obtained in the same setup, with a known to |
| 397 | be good device taking the role of the DUT. It is therefore necessary |
| 398 | to establish a reference profile each time the test environment changes, |
| 399 | e.g., when changing location or when using a different reference device. |
| 400 | <P> |
| 401 | The physical arrangement of the devices should have the characteristics |
| 402 | described in <A href="test.html#atben">the test section</A>. The orientation |
| 403 | of the devices should be chosen such that the overall signal strength is |
| 404 | near its maximum, that the spectrum is relatively "flat", and that small |
| 405 | changes in the orientation only produce small variations in the measured |
| 406 | signal strength. |
| 407 | <P> |
| 408 | To generate the profiles for <B>atben</B> and <B>atusb</B>, simply run |
| 409 | <PRE> |
| 410 | make spectrum |
| 411 | </PRE> |
| 412 | Then place the devices appropriately and press <B>D</B> |
| 413 | to use the displayed spectrum as the reference. Multiple spectra |
| 414 | can be merged into the reference, e.g., if unavoidable environmental |
| 415 | variations cause |
| 416 | significant changes. Spectra included in the reference are shown in blue. |
| 417 | <P> |
| 418 | After a obtaining the reference spectrum, press <B>Q</B> to exit. The |
| 419 | Makefile will then record the signal strength limits for an <B>atben</B> |
| 420 | DUT in the file <SAMP>ben.profile</SAMP> and proceed with the reverse |
| 421 | measurement, i.e., with <B>atusb</B> acting as the DUT. |
| 422 | |
| 423 | |
| 424 | <END author="Werner Almesberger" date="<GEN_DATE>"> |
| 425 | </BODY> |
| 426 | </HTML> |
| 427 | |
