Configuring the Radio

The DNT900 radio module is highly configurable. Configurations can be made in a number of areas, including:

  • RF channel access methods (CSMA, TDMA, polling),
  • network topographies (point-to-point, point-to-multipoint, peer-to-peer, tree-routing),
  • RF power levels (1–1000 mW) and transmission rates (38.4–500 kb/s),
  • sleep modes, and
  • I/O configuration.

It is advisable to thoroughly acquaint yourself with the DNT900 product manual. This will help you to choose the most suitable design for your radio network.

Protocol Mode

As described in the product manual, several banks of registers are used to configure the operation of the radio module. Accessing these registers require a special protocol mode be used, instead of the usual transparent mode. In this mode, specially formatted packets of characters are sent to the radio. Instead of being transmitted, the data in these packets instructs the radio to retrieve or change register values. Sending a special sequence of characters switches the radio from transparent to protocol mode.

It is possible to manually or programmatically construct the necessary command packets for the settings you need to change. For simple, one-time configuration, this may be sufficient. However it becomes tiresome for sustained use and experimentation with the radio. A better solution is available, in the form of driver which allows you to change radio settings in a more approachable manner.

DNT900 Line Discipline

The DNT900 driver is technically a line discipline: a layer of code which sits between the serial driver and the end-user of the serial port. In this case, the line discipline translates data into protocol mode packets on behalf of the user. Radio configuration registers are exposed as attribute files in the sysfs filesystem. As an example of usage of a sysfs attribute, the following command sequence reads then modifies the TxPower register of the radio with MAC address 0x00165E:

#cat /sys/class/dnt900/ttyAMA0/0x00165E/TxPower
0x00
#echo 0x05 > /sys/class/dnt900/ttyAMA0/0x00165E/TxPower

Comprehensive documentation for the DNT900 line discipline is available on GitHub.

It is worthwhile noting that the DNT900 line discipline implements a virtual TTY for each remote radio on the network. This is particularly useful when you are using multiple remotes (in a point-to-multipoint or tree-routing network). It allows you to transmit data to individual radios without resorting to protocol mode commands.

Also noteworthy is the ability to change registers of remote radios, not just the radio attached to the Raspberry Pi you are using. In many cases, this lets you make changes without needing physical access to the remote radio.

Installing the Software

The DNT900 line discipline is provided by the rpi900 package, and this is the recommended way of getting the software. The package also adds a service file to attach the line discipline automatically at startup.

To begin, setup the package repository, if you haven’t yet done so:

$sudo pacman -Syu
$sudo pacman -S --needed base-devel git linux-raspberrypi-headers
$git clone https://github.com/rpi900/packages.git

Next, build and install each of the required packages:

$cd packages/rpirtscts  # for hardware flow-control
$makepkg --clean
$sudo pacman -U rpirtscts-1.0-1-armv6h.pkg.tar.xz
$cd ../rpi900           # for the DNT900 line discipline
$makepkg --clean
$sudo pacman -U rpi900-3.18.7-4-armv6h.pkg.tar.xz

Operation

A configuration file at /etc/rpi900.conf specifies the serial speed used to connect the DNT900 and defaults to 9600 bits/second. (Follow these instructions to change the serial speed.)

From the next reboot, the line discipline will load automatically. For example:

$systemctl status rpi900.service                               # show status of rpi900 service
$ls /sys/devices/virtual/dnt900/ttyAMA0/0x00165F               # list all registers
$udevadm info -a /sys/devices/virtual/dnt900/ttyAMA0/0x00165F  # read all register values

If your radio is linked to other radios, list their TTYs:

$ls -l /dev/ttyDNT*  # show remote radio TTYs
$ls -l /dev/0x*      # show MAC address symlinks

Radio Configuration

With the line discipline set up and the DNT900 registers accessible, this is a good time to properly configure your radio network.

Some basic registers which will require attention include DeviceMode, RF_DateRate, TxPower, FrequencyBand, SerialRate and AccessMode.

Choice of channel access mode is particularly important. For point-to-point or point-to-multipoint networks, TDMA Fixed Slots mode is recommended, with MaxSlots set to the number of remotes. CSMA mode may be a better choice if you have many remotes which aren’t generally competing for bandwidth. Avoid TDMA Dynamic Slots mode when using the DNT900 line discipline.

If you intend to run the radios as a tree routing system (using one or more radios as repeaters/routers), CSMA mode is needed, and the TreeRoutingEn, BaseModeNetID, StaticNetAddr, TreeRoutingSysID registers require attention.

If you are concerned with throughput, spend some time with section 2.11 of the DNT900 manual, where throughput is discussed. Murata also provides a Windows throughput calculator which lets you observe the effect of different values for HopDuration and BaseSlotSize on base and remote throughputs. Optimising these values is worthwhile if you wish to achieve the highest possible bandwidth for your application.