Docs

You are here:
Configuring the radio module

Having a working RCM connection (see Initializing and running the connection) allows us now to communicate with a RCM radio module and set it up for network operation. At this stage we usually need to configure the basic properties of the module that allow it to communicate across the RCM network. We will discuss them now.

Device unique identifier (UID).

The RCM protocol is based on IEEE 802.15.4 PHY and MAC layers, that define the addressing used to deliver messages across the network. Both of these standards relay on a concept of a 64-bit globally unique identifier (also called EUI-64) that unambiguously identifies a node. The RCM radio module hardware may have the EUI-64 built-in, however if it doesn't or if we want to enforce a different one, we can use the rcm::Connection::setUID method to set it up. The complementary rcm::Connection::getUID call can read the currently set UID from the device.

Network identifier (PANID), network role and network address.

Each RCM network is identified by unique 64-bit identifier called Personal Area Network ID (PAN ID). A node that wants to join a network can choose the network identifier it want's to connect to. Each RCM device can be given one of three roles: coordinator, router or end device. The coordinator is the node that starts and maintains the network. Routers are nodes that can route (relay) packets, while end devices can only communicate with coordinators or routers and do not have the routing capability. In addition to role, every node in the network is given a short 16-bit network address. This address can be set manually or picked up randomly by the RCM communication stack.

The rcm::Connection::configureNode method shall be used to deliver information about PAN ID, role and addressing mode to the RCM radio module. The following complementary set of methods can be used to read back these settings:

Security settings.

In order to enable message encryption, the rcm::Connection::enableNetworkSecurity method should be called, that also sets up a 128-bit network key that is used to cipher the messages. All nodes that wish to communicate within a secured network must provide the same network key. Security settings affect the maximum number of bytes that can fit into a single RCM message packet. In order to determine how many bytes can fit into a single RCM packet with the current settings, the rcm::Connection::getMaxPayloadSize method can be used.

Output power.

In order to control the output power of the RCM radio module, the rcm::Connection::setOutputPower and rcm::Connection::getOutputPower functions can be used.

PHY options.

The radio module features two PHY (physical layer) modes according to IEEE 802.15.4 specification:

  • 20kbps BPSK-DSSS PHY
  • 100kbps O-QPSK-DSSS PHY

In order to change the mode, the rcm::Connection::setPHY method can be used. The rcm::Connection::getPHY and rcm::Connection::getChannelMask methods can be used to get the currently set values.

Antenna selection.

The rcm::Connection::setAntenna method can be used to control which antenna output will be used. This setting is valid for radio modules supporting more than one antenna output. For single-antenna modules this setting does not influence device operation.

An example.

The following example illustrates the concepts that we have learned so far:

#include "rcmpp.h"
int rcm_config_example(const char* portName)
{
int result = 0;
try {
// construct the connection object
rcm::Connection rcm(portName);
// set PHY to 100kbps O-QPSK-DSSS with channel 0 mask
rcm.setPHY(RCM_PHY_100KBPS, 1);
// set antenna
rcm.setAntenna(RCM_ANT1_DIVERSITY);
// set output power to -10dBm
rcm.setOutputPower(10);
// set UID
rcm.setUID(0x0123456789abcdef);
// configure networking
rcm.configureNode(RCM_DEVICE_TYPE_COORDINATOR, 0x1122334455667788, RCM_ADDRESSING_SCHEME_STATIC, 0);
} catch(rcm::exception &e) {
result = 100;
}
catch(std::exception &e) {
result = 101;
}
catch (...) {
result = 102;
}
return result;
}
Go to Top