Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The OCSDK stack provides APIs for testing the radio - they are typically used for top-level assembly testing , and radio certification testing.  

The 03-radioTest Sample Application

The 03-radioTest application largely emulates the testing functions built into the stock mote firmware.  See the SmartMesh IP Mote CLI Guide for the meaning of the various arguments. Unlike the stock firmware, the sample does not require putting the mote into an explicit radiotest mode (via radiotest on) before issuing test commands.

The application provides 3 CLI functions (available by typing help) for radio testing:

  • initPer - sets the initial period, in ns.  By default, it is set to DN_PWM_8P9MS (8.9 ms). Cannot be called when the PWM is open.
  • initDuty - sets the initial duty cycle, expressed as the asserted portion of the period in ns.  
  • openPWM - opens the DN_PWM_DEV_ID device (PWM0,  LTC5800 pin 49). The device must be opened before enabling/disabling the PWM. 
  • enablePWM - enables the PWM signal output on PWM0.
  • disablePWM - disables the PWM signal output on PWM0
  • setDuty - sets the current duty cycle, expressed as the asserted portion of the period in ns. 
  • closePWM - closes the pwm device and disable output. The PWM must be closed before changing the period.
  • testTx - start a transmit test (analogous to mote CLI command radiotest tx)
  • testRx - start a receive test (analogous to mote CLI command radiotest rx)  
  • stat - print out the results of a completed receive test (analogous to mote CLI command radiotest stat)

It also provides a reset command for easily resetting the part.

Each CLI command prints a confirmation:

No Formatnoformat
radioTest app, ver 1.2.0.1
SmartMesh IP stack, ver 1.4.1.8


> testtx
Usage: testtx <testType> <chanMask> <power> <stationId> <repeatCnt> ...
... <numSubtests> {<pkLen> <delay> ...}

> testtx 0 0x0001 8 255 100 1 100 1000
Test started...
>Tx completed

> testrx
Usage: testrx <chanMask> <time (s)> <stationId>
Channel mask is in hex, e.g. 0x0001 selects channel 0 (IEEE ch 11)

>testrx 0x0001 100 255
Starting rx on channel 0
Rx completed

> stat
Radio Test Statistics:
  OkCnt   : 99
  FailCnt : 1

> mshow rstat
  OkCnt   : 99
  FailCnt : 1
  AveRSSI : -55
  AveLQI  : 0

Info

In addition to the stat command, the stack supports the mshow rstat command which prints RSSI and LQI in addition to the packet OK/Fail counts.

Implementation Details

The 03-radioTest sample application uses the Helper Modules to initialize the CLI Module and for interaction with the local interface. It passes JOIN_NO in the fJoin flag when initializing the local module in the loc_task_init() to prevent the local module from attempting to join, as the radio can only be tested when the mote is in either the idle or radioTest state.  It has a single dummy task that  does nothing but wait.  The CLI command handlers parse the command arguments and call helper functions to run the receive and transmit tests. It contains a function to check if the mote is idle - all radiotest functions will return an error if called while the mote is in an incorrect state, so errors can be handled inline if desired.