Classes | Public Types | Public Member Functions | Protected Member Functions | List of all members
RH_CC110 Class Reference

Send and receive unaddressed, unreliable, datagrams by Texas Instruments CC110L and compatible transceivers and modules. More...

#include <RH_CC110.h>

Inheritance diagram for RH_CC110:
RHNRFSPIDriver RHGenericDriver


struct  ModemConfig
 Defines register configuration values for a desired modulation. More...

Public Types

enum  ModemConfigChoice {
  GFSK_Rb1_2Fd5_2 = 0, GFSK_Rb2_4Fd5_2, GFSK_Rb4_8Fd25_4, GFSK_Rb10Fd19,
  GFSK_Rb38_4Fd20, GFSK_Rb76_8Fd32, GFSK_Rb100Fd47, GFSK_Rb250Fd127
enum  TransmitPower {
  TransmitPowerM30dBm = 0, TransmitPowerM20dBm, TransmitPowerM15dBm, TransmitPowerM10dBm,
  TransmitPower0dBm, TransmitPower5dBm, TransmitPower7dBm, TransmitPower10dBm
- Public Types inherited from RHGenericDriver
enum  RHMode {
  RHModeInitialising = 0, RHModeSleep, RHModeIdle, RHModeTx,
  RHModeRx, RHModeCad
 Defines different operating modes for the transport hardware. More...

Public Member Functions

 RH_CC110 (uint8_t slaveSelectPin=SS, uint8_t interruptPin=2, bool is27MHz=false, RHGenericSPI &spi=hardware_spi)
virtual bool init ()
bool printRegisters ()
virtual bool waitPacketSent ()
virtual bool available ()
virtual bool recv (uint8_t *buf, uint8_t *len)
virtual bool send (const uint8_t *data, uint8_t len)
virtual uint8_t maxMessageLength ()
void setModeIdle ()
void setModeRx ()
void setModeTx ()
virtual bool sleep ()
bool setTxPower (TransmitPower power)
void setIs27MHz (bool is27MHz=true)
bool setFrequency (float centre)
void setModemRegisters (const ModemConfig *config)
bool setModemConfig (ModemConfigChoice index)
void setSyncWords (const uint8_t *syncWords, uint8_t len)
- Public Member Functions inherited from RHNRFSPIDriver
 RHNRFSPIDriver (uint8_t slaveSelectPin=SS, RHGenericSPI &spi=hardware_spi)
bool init ()
uint8_t spiCommand (uint8_t command)
uint8_t spiRead (uint8_t reg)
uint8_t spiWrite (uint8_t reg, uint8_t val)
uint8_t spiBurstRead (uint8_t reg, uint8_t *dest, uint8_t len)
uint8_t spiBurstWrite (uint8_t reg, const uint8_t *src, uint8_t len)
void setSlaveSelectPin (uint8_t slaveSelectPin)
- Public Member Functions inherited from RHGenericDriver
 RHGenericDriver ()
virtual void waitAvailable ()
virtual bool waitPacketSent (uint16_t timeout)
virtual bool waitAvailableTimeout (uint16_t timeout)
virtual bool waitCAD ()
void setCADTimeout (unsigned long cad_timeout)
virtual bool isChannelActive ()
virtual void setThisAddress (uint8_t thisAddress)
virtual void setHeaderTo (uint8_t to)
virtual void setHeaderFrom (uint8_t from)
virtual void setHeaderId (uint8_t id)
virtual void setHeaderFlags (uint8_t set, uint8_t clear=RH_FLAGS_APPLICATION_SPECIFIC)
virtual void setPromiscuous (bool promiscuous)
virtual uint8_t headerTo ()
virtual uint8_t headerFrom ()
virtual uint8_t headerId ()
virtual uint8_t headerFlags ()
int16_t lastRssi ()
RHMode mode ()
void setMode (RHMode mode)
 Sets the operating mode of the transport.
virtual uint16_t rxBad ()
virtual uint16_t rxGood ()
virtual uint16_t txGood ()

Protected Member Functions

void handleInterrupt ()
uint8_t spiReadRegister (uint8_t reg)
uint8_t spiBurstReadRegister (uint8_t reg)
uint8_t spiWriteRegister (uint8_t reg, uint8_t val)
uint8_t spiBurstWriteRegister (uint8_t reg, const uint8_t *src, uint8_t len)
void validateRxBuf ()
void clearRxBuf ()
 Clear our local receive buffer.
uint8_t statusRead ()
void setPaTable (uint8_t *patable, uint8_t patablesize)

Additional Inherited Members

- Static Public Member Functions inherited from RHGenericDriver
static void printBuffer (const char *prompt, const uint8_t *buf, uint8_t len)
- Protected Attributes inherited from RHNRFSPIDriver
 Reference to the RHGenericSPI instance to use to trasnfer data with teh SPI device.
uint8_t _slaveSelectPin
 The pin number of the Slave Select pin that is used to select the desired device.
- Protected Attributes inherited from RHGenericDriver
volatile RHMode _mode
 The current transport operating mode.
uint8_t _thisAddress
 This node id.
bool _promiscuous
 Whether the transport is in promiscuous mode.
volatile uint8_t _rxHeaderTo
 TO header in the last received mesasge.
volatile uint8_t _rxHeaderFrom
 FROM header in the last received mesasge.
volatile uint8_t _rxHeaderId
 ID header in the last received mesasge.
volatile uint8_t _rxHeaderFlags
 FLAGS header in the last received mesasge.
uint8_t _txHeaderTo
 TO header to send in all messages.
uint8_t _txHeaderFrom
 FROM header to send in all messages.
uint8_t _txHeaderId
 ID header to send in all messages.
uint8_t _txHeaderFlags
 FLAGS header to send in all messages.
volatile int16_t _lastRssi
 The value of the last received RSSI value, in some transport specific units.
volatile uint16_t _rxBad
 Count of the number of bad messages (eg bad checksum etc) received.
volatile uint16_t _rxGood
 Count of the number of successfully transmitted messaged.
volatile uint16_t _txGood
 Count of the number of bad messages (correct checksum etc) received.
volatile bool _cad
 Channel activity detected.
unsigned int _cad_timeout
 Channel activity timeout in ms.

Detailed Description

Send and receive unaddressed, unreliable, datagrams by Texas Instruments CC110L and compatible transceivers and modules.

The TI CC110L is a low cost tranceiver chip capable of 300 to 928MHz and with a wide range of modulation types and speeds. The chip is typically provided on a module that also includes the antenna and coupling hardware and is therefore capable of a more restricted frequency range.

Supported modules include:

This base class provides basic functions for sending and receiving unaddressed, unreliable datagrams of arbitrary length to 59 octets per packet at a selected data rate and modulation type. Use one of the Manager classes to get addressing and acknowledgement reliability, routing, meshes etc.

Naturally, for any 2 radios to communicate that must be configured to use the same frequency and data rate, and with identical network addresses.

Several CC110L modules can be connected to an Arduino, permitting the construction of translators and frequency changers, etc.

Several GFSK modulation schemes are provided and may be selected by calling setModemConfig(). No FSK or OOK modulation schemes are provided though the implementor may configure the mnodem characteristics directly by calling setModemRegisters().

Implementation based on: and

Crystal Frequency

Modules based on the CC110L may contain a crystal oscillator with one of 2 possible frequencies: 26MHz or 27MHz. A number of radio configuration parameters (including carrier frequency and data rates) depend on the crystal oscillator frequency. The chip has no knowledge of the frequency, so it is up to the implementer to tell the driver the oscillator frequency by passing in the appropriate value of is27MHz to the constructor (default 26MHz) or by calling setIs27MHz() before calling init(). Failure to correctly set this flag will cause incorrect frequency and modulation characteristics to be used.

Caution: it is not easy to determine what the actual crystal frequency is on some modules. For example, the documentation for the Anaren BoosterPack indictes a 26MHz crystal, but measurements on the devices delivered here indicate a 27MHz crystal is actually installed. TI recommend 27MHz for

Packet Format
Connecting CC110L to Arduino

Warning: the CC110L is a 3.3V part, and exposing it to 5V on any pin will damage it. Ensure you are using a 3.3V MCU or use level shifters. We tested with Teensy 3.1.

The electrical connection between a CC110L module and the Arduino or other processor require 3.3V, the 3 x SPI pins (SCK, SDI, SDO), a Chip Select pin and an Interrupt pin. Examples below assume the Anaren BoosterPack. Caution: the pin numbering on the Anaren BoosterPack is a bit counter-intuitive: the direction of number on J1 is the reverse of J2. Check the pin numbers stenciled on the front of the board to be sure.

Teensy 3.1 CC110L pin name Anaren BoosterPack pin
3.3V---------VDD (3.3V in) J1-1
SS pin D10----------CSn (chip select in) J2-8
SCK pin D13----------SCLK (SPI clock in) J1-7
MOSI pin D11----------MOSI (SPI data in) J2-5
MISO pin D12----------MISO (SPI data out) J2-4
D2-----------GDO0 (Interrupt output) J2-9
GND----------GND (ground in) J2-10

and use the default RH_CC110 constructor. You can use other pins by passing the appropriate arguments to the RH_CC110 constructor, depending on what your MCU supports.

For the Particle Photon:

Photon CC110L pin name Anaren BoosterPack pin
3.3V---------VDD (3.3V in) J1-1
SS pin A2-----------CSn (chip select in) J2-8
SCK pin A3-----------SCLK (SPI clock in) J1-7
MOSI pin A5-----------MOSI (SPI data in) J2-5
MISO pin A4-----------MISO (SPI data out) J2-4
D2-----------GDO0 (Interrupt output) J2-9
GND----------GND (ground in) J2-10

and use the default RH_CC110 constructor. You can use other pins by passing the appropriate arguments to the RH_CC110 constructor, depending on what your MCU supports.

Example programs

Several example programs are provided.

Radio operating strategy and defaults

The radio is enabled at all times and switched between RX, TX and IDLE modes. When RX is enabled (by calling available() or setModeRx()) the radio will stay in RX mode until a valid CRC correct message addressed to thiis node is received, when it will transition to IDLE. When TX is enabled (by calling send()) it will stay in TX mode until the message has ben sent and waitPacketSent() is called when it wil transition to IDLE (this radio has no 'packet sent' interrupt that could be used, so polling with waitPacketSent() is required

The modulation schemes supported include the GFSK schemes provided by default in the TI SmartRF Suite. This software allows you to get the correct register values for diferent modulation schemes. All the modulation schemes prvided in the driver are based on the recommended register values given by SmartRF. Other schemes such a 2-FSK, 4-FSK and OOK are suported by the chip, but canned configurations are not provided with this driver. The implementer may choose to create their own modem configurations and pass them to setModemRegisters().

Member Enumeration Documentation

◆ ModemConfigChoice

Choices for setModemConfig() for a selected subset of common modulation types, and data rates. If you need another configuration, use the register calculator. and call setModemRegisters() with your desired settings. These are indexes into MODEM_CONFIG_TABLE. We strongly recommend you use these symbolic definitions and not their integer equivalents: its possible that new values will be introduced in later versions (though we will try to avoid it). All configs use SYNC_MODE = RH_CC110_SYNC_MODE_16_16 (2 byte sync)


GFSK, Data Rate: 1.2kBaud, Dev: 5.2kHz, RX BW 58kHz, optimised for sensitivity.


GFSK, Data Rate: 2.4kBaud, Dev: 5.2kHz, RX BW 58kHz, optimised for sensitivity.


GFSK, Data Rate: 4.8kBaud, Dev: 25.4kHz, RX BW 100kHz, optimised for sensitivity.


GFSK, Data Rate: 10kBaud, Dev: 19kHz, RX BW 100kHz, optimised for sensitivity.


GFSK, Data Rate: 38.4kBaud, Dev: 20kHz, RX BW 100kHz, optimised for sensitivity.


GFSK, Data Rate: 76.8kBaud, Dev: 32kHz, RX BW 232kHz, optimised for sensitivity.


GFSK, Data Rate: 100kBaud, Dev: 47kHz, RX BW 325kHz, optimised for sensitivity.


GFSK, Data Rate: 250kBaud, Dev: 127kHz, RX BW 540kHz, optimised for sensitivity.

◆ TransmitPower

These power outputs are based on the suggested optimum values for multilayer inductors in the 915MHz frequency band. Per table 5-15. Caution: these enum values are indexes into PaPowerValues. Do not change one without changing the other. Use the symbolic names, not the integer values

















Constructor & Destructor Documentation

◆ RH_CC110()

RH_CC110::RH_CC110 ( uint8_t  slaveSelectPin = SS,
uint8_t  interruptPin = 2,
bool  is27MHz = false,
RHGenericSPI spi = hardware_spi 

Constructor. You can have multiple instances, but each instance must have its own interrupt and slave select pin. After constructing, you must call init() to initialise the interface and the radio module. A maximum of 3 instances can co-exist on one processor, provided there are sufficient distinct interrupt lines, one for each instance.

[in]slaveSelectPinthe Arduino pin number of the output to use to select the CC110L before accessing it. Defaults to the normal SS pin for your Arduino (D10 for Diecimila, Uno etc, D53 for Mega, D10 for Maple)
[in]interruptPinThe interrupt Pin number that is connected to the CC110L GDO0 interrupt line. Defaults to pin 2. Caution: You must specify an interrupt capable pin. On many Arduino boards, there are limitations as to which pins may be used as interrupts. On Leonardo pins 0, 1, 2 or 3. On Mega2560 pins 2, 3, 18, 19, 20, 21. On Due and Teensy, any digital pin. On other Arduinos pins 2 or 3. See for more details. On Chipkit Uno32, pins 38, 2, 7, 8, 35. On other boards, any digital pin may be used.
[in]is27MHzSet to true if your CC110 is equipped with a 27MHz crystal oscillator. Defaults to false.
[in]spiPointer to the SPI interface object to use. Defaults to the standard Arduino hardware SPI interface

Member Function Documentation

◆ available()

bool RH_CC110::available ( )

Tests whether a new message is available from the Driver. On most drivers, this will also put the Driver into RHModeRx mode until a message is actually received by the transport, when it will be returned to RHModeIdle and available() will return true. This can be called multiple times in a timeout loop

true if a new, complete, error-free uncollected message is available to be retreived by recv()

Implements RHGenericDriver.

References RHGenericDriver::_mode, RHGenericDriver::RHModeTx, and setModeRx().

Referenced by recv().

◆ handleInterrupt()

void RH_CC110::handleInterrupt ( )

This is a low level function to handle the interrupts for one instance of RH_RF95. Called automatically by isr*() Should not need to be called by user code.

References RHGenericDriver::_lastRssi, RHGenericDriver::_mode, clearRxBuf(), handleInterrupt(), RHGenericDriver::RHModeRx, setModeIdle(), RHNRFSPIDriver::spiBurstRead(), spiBurstReadRegister(), RHNRFSPIDriver::spiCommand(), spiReadRegister(), and validateRxBuf().

Referenced by handleInterrupt().

◆ init()

bool RH_CC110::init ( )

Initialise the Driver transport hardware and software. Make sure the Driver is properly configured before calling init(). In particular, ensure you have called setIs27MHz(true) if your module has a 27MHz crystal oscillator. After init(), the following default characteristics are set: TxPower: TransmitPower5dBm Frequency: 915.0 Modulation: GFSK_Rb1_2Fd5_2 (GFSK, Data Rate: 1.2kBaud, Dev: 5.2kHz, RX BW 58kHz, optimised for sensitivity) Sync Words: 0xd3, 0x91

true if initialisation succeeded.

Reimplemented from RHGenericDriver.

References GFSK_Rb1_2Fd5_2, RHNRFSPIDriver::init(), setFrequency(), setModemConfig(), setSyncWords(), setTxPower(), RHNRFSPIDriver::spiCommand(), spiWriteRegister(), and TransmitPower5dBm.

◆ maxMessageLength()

uint8_t RH_CC110::maxMessageLength ( )

Returns the maximum message length available in this Driver.

The maximum legal message length

Implements RHGenericDriver.

◆ printRegisters()

bool RH_CC110::printRegisters ( )

Prints the value of all chip registers to the Serial device if RH_HAVE_SERIAL is defined for the current platform For debugging purposes only.

true on success

References spiBurstReadRegister(), and spiReadRegister().

◆ recv()

bool RH_CC110::recv ( uint8_t *  buf,
uint8_t *  len 

Turns the receiver on if it not already on (after wiaint gor any currenly transmitting message to complete). If there is a valid message available, copy it to buf and return true else return false. If a message is copied, *len is set to the length (Caution, 0 length messages are permitted). You should be sure to call this function frequently enough to not miss any messages It is recommended that you call it in your main loop.

[in]bufLocation to copy the received message
[in,out]lenPointer to available space in buf. Set to the actual number of octets copied.
true if a valid message was copied to buf. The message cannot be retreived again.

Implements RHGenericDriver.

References available(), and clearRxBuf().

◆ send()

bool RH_CC110::send ( const uint8_t *  data,
uint8_t  len 

Waits until any previous transmit packet is finished being transmitted with waitPacketSent(). Then loads a message into the transmitter and starts the transmitter. Note that a message length of 0 is permitted.

[in]dataArray of data to be sent
[in]lenNumber of bytes of data to send
true if the message length was valid and it was correctly queued for transmit

Implements RHGenericDriver.

References RHGenericDriver::_txHeaderFlags, RHGenericDriver::_txHeaderFrom, RHGenericDriver::_txHeaderId, RHGenericDriver::_txHeaderTo, setModeIdle(), setModeTx(), spiBurstWriteRegister(), spiWriteRegister(), RHGenericDriver::waitCAD(), and waitPacketSent().

◆ setFrequency()

bool RH_CC110::setFrequency ( float  centre)

Sets the transmitter and receiver centre frequency. Caution: permissable frequency bands will depend on you country and area: consult local authorities.

[in]centreFrequency in MHz. 300.0 to 928.0
true if the selected frquency centre is within range

References spiWriteRegister().

Referenced by init().

◆ setIs27MHz()

void RH_CC110::setIs27MHz ( bool  is27MHz = true)

Indicates the presence of 27MHz crystal oscillator. You must indicate to the driver if your CC110L is equipped with a 27MHz crystal oscillator (26MHz is the default in the constructor). This should be called before calling init() if you have a 27MHz crystal. It can be called after calling init() but you must reset the frequency (with setFrequency()) and modulation (with setModemConfig()) afterwards.

[in]is27MHzPass true if the CC110L has a 27MHz crystal (default is true).

◆ setModeIdle()

void RH_CC110::setModeIdle ( )

If current mode is Sleep, Rx or Tx changes it to Idle. If the transmitter or receiver is running, disables them.

References RHGenericDriver::_mode, RHGenericDriver::RHModeIdle, and RHNRFSPIDriver::spiCommand().

Referenced by handleInterrupt(), and send().

◆ setModemConfig()

bool RH_CC110::setModemConfig ( ModemConfigChoice  index)

Select one of the predefined modem configurations. If you need a modem configuration not provided here, use setModemRegisters() with your own ModemConfig.

[in]indexThe configuration choice.
true if index is a valid choice.

References setModemRegisters().

Referenced by init().

◆ setModemRegisters()

void RH_CC110::setModemRegisters ( const ModemConfig config)

◆ setModeRx()

void RH_CC110::setModeRx ( )

If current mode is Tx or Idle, changes it to Rx. Starts the receiver. The radio will stay in Rx mode until a CRC correct message addressed to this node is received, or the ode is changed to Tx, Idle or Sleep.

References RHGenericDriver::_mode, RHGenericDriver::RHModeRx, and RHNRFSPIDriver::spiCommand().

Referenced by available().

◆ setModeTx()

void RH_CC110::setModeTx ( )

If current mode is Rx or Idle, changes it to Tx. Starts the transmitter sending the current message.

References RHGenericDriver::_mode, RHGenericDriver::RHModeTx, and RHNRFSPIDriver::spiCommand().

Referenced by send().

◆ setPaTable()

void RH_CC110::setPaTable ( uint8_t *  patable,
uint8_t  patablesize 

Sets the PaTable registers directly. Ensure you use suitable PATABLE values per Tbale 5-15 or 5-16 You may need to do this to implement an OOK modulation scheme.

References spiBurstWriteRegister().

Referenced by setTxPower().

◆ setSyncWords()

void RH_CC110::setSyncWords ( const uint8_t *  syncWords,
uint8_t  len 

Sets the sync words for transmit and receive in registers RH_CC110_REG_04_SYNC1 and RH_CC110_REG_05_SYNC0. Caution: SyncWords should be set to the same value on all nodes in your network. Nodes with different SyncWords set will never receive each others messages, so different SyncWords can be used to isolate different networks from each other. Default is { 0xd3, 0x91 }.

[in]syncWordsArray of sync words, 2 octets long
[in]lenNumber of sync words to set. MUST be 2.

References spiWriteRegister().

Referenced by init().

◆ setTxPower()

bool RH_CC110::setTxPower ( TransmitPower  power)

Set the Power Amplifier power setting. The PaTable settings are based on are based on the suggested optimum values for multilayer inductors in the 915MHz frequency band. Per table 5-15. If these values are not suitable, use setPaTable() directly. Caution: be a good neighbour and use the lowest power setting compatible with your application. Caution: Permissable power settings for your area may depend on frequency and modulation characteristics: consult local authorities. param[in] power One of TransmitPower enum values

References setPaTable().

Referenced by init().

◆ sleep()

bool RH_CC110::sleep ( )

Sets the radio into low-power sleep mode. If successful, the transport will stay in sleep mode until woken by changing mode to idle, transmit or receive (eg by calling send(), recv(), available() etc) Caution: there is a time penalty as the radio takes a finite time to wake from sleep mode. Caution: waking up from sleep loses values from registers 0x29 through 0x2e

true if sleep mode was successfully entered.

Reimplemented from RHGenericDriver.

References RHGenericDriver::_mode, RHGenericDriver::RHModeSleep, and RHNRFSPIDriver::spiCommand().

◆ spiBurstReadRegister()

uint8_t RH_CC110::spiBurstReadRegister ( uint8_t  reg)

Reads a single register in burst mode. On the CC110L, some registers yield different data when read in burst mode as opposed to single byte mode.

[in]regRegister number, one of RH_CC110_REG (burst mode readable)
The value of the register after a burst read

References RHNRFSPIDriver::spiRead().

Referenced by handleInterrupt(), and printRegisters().

◆ spiBurstWriteRegister()

uint8_t RH_CC110::spiBurstWriteRegister ( uint8_t  reg,
const uint8_t *  src,
uint8_t  len 

Write a number of bytes to a burst capable register

[in]regRegister number of the first register, one of RH_CC110L_REG_*
[in]srcArray of new register values to write. Must be at least len bytes
[in]lenNumber of bytes to write
the chip status byte per table 5.2

References RHNRFSPIDriver::spiBurstWrite().

Referenced by send(), and setPaTable().

◆ spiReadRegister()

uint8_t RH_CC110::spiReadRegister ( uint8_t  reg)

Reads a single register from the CC110L

[in]regRegister number, one of RH_CC110_REG
The value of the register

References RHNRFSPIDriver::spiRead().

Referenced by handleInterrupt(), and printRegisters().

◆ spiWriteRegister()

uint8_t RH_CC110::spiWriteRegister ( uint8_t  reg,
uint8_t  val 

Writes to a single single register on the CC110L

[in]regRegister number, one of RH_CC110L_REG_*
[in]valThe value to write
returns the chip status byte per table 5.2

References RHNRFSPIDriver::spiWrite().

Referenced by init(), send(), setFrequency(), setModemRegisters(), and setSyncWords().

◆ statusRead()

uint8_t RH_CC110::statusRead ( )

Reads and returns the status byte by issuing the SNOP strobe

The value of the status byte per Table 5-2

References RHNRFSPIDriver::spiCommand().

Referenced by waitPacketSent().

◆ validateRxBuf()

void RH_CC110::validateRxBuf ( )

◆ waitPacketSent()

bool RH_CC110::waitPacketSent ( )

Blocks until the current message (if any) has been transmitted

true on success, false if the chip is not in transmit mode or other transmit failure

Reimplemented from RHGenericDriver.

References RHGenericDriver::_mode, RHGenericDriver::RHModeIdle, RHGenericDriver::RHModeTx, and statusRead().

Referenced by send().

The documentation for this class was generated from the following files: