drivers/cc110x: Rewrite of the cc110x driver
The cc110x driver has been re-written from scratch to overcome the limitations
of the old driver. The main motivation of the rewrite was to achieve better
maintainability by a detailed documentation, reduce the complexity and the
overhead of the SPI communication with the device, and to allow to
simultaneously use transceivers with different configuration regarding the used
base band, the channel bandwidth, the modulation rate, and the channel map.
Features of this driver include:
- Support for the CC1100, CC1101, and the CC1100e sub-gigahertz transceivers.
- Detailed documentation of every aspect of this driver.
- An easy to use configuration API that allows setting the transceiver
configuration (modulation rate, channel bandwidth, base frequency) and the
channel map.
- Fast channel hopping by pre-calibration of the channels during device
configuration (so that no calibration is needed during hopping).
- Simplified SPI communication: Only during start-up the MCU has to wait
for the transceiver to be ready (for the power regulators and the crystal
to stabilize). The old driver did this for every SPI transfer, which
resulted in complex communication code. This driver will wait on start up
for the transceiver to power up and then use RIOT's SPI API like every other
driver. (Not only the data sheet states that this is fine, it also proved to
be reliable in practise.)
- Greatly reduced latency: The RTT on the old driver (@150 kbps data rate) was
about 16ms, the new driver (@250 kbps data rate) has as RTT of ~3ms
(depending on SPI clock and on CPU performance) (measured with ping6).
- Increased reliability: The preamble size and the sync word size have been
doubled compared to the old driver (preamble: 8 bytes instead of 4,
sync word: 4 byte instead of 2). The new values are the once recommended by
the data sheet for reliable communication.
- Basic diagnostic during driver initialization to detect common issues as
SPI communication issues and GDO pin configuration/wiring issues.
- TX power configuration with netdev_driver_t::set() API-integration
- Calls to netdev_driver_t::send() block until the transmission has completed
to ease the use of the API (implemented without busy waiting, so that the
MCU can enter lower power states or other threads can be executed).
2018-11-08 17:37:07 +01:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2018 Otto-von-Guericke-Universität Magdeburg
|
|
|
|
*
|
|
|
|
* This file is subject to the terms and conditions of the GNU Lesser
|
|
|
|
* General Public License v2.1. See the file LICENSE in the top level
|
|
|
|
* directory for more details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2019-09-04 13:15:15 +02:00
|
|
|
* @ingroup drivers_cc110x
|
drivers/cc110x: Rewrite of the cc110x driver
The cc110x driver has been re-written from scratch to overcome the limitations
of the old driver. The main motivation of the rewrite was to achieve better
maintainability by a detailed documentation, reduce the complexity and the
overhead of the SPI communication with the device, and to allow to
simultaneously use transceivers with different configuration regarding the used
base band, the channel bandwidth, the modulation rate, and the channel map.
Features of this driver include:
- Support for the CC1100, CC1101, and the CC1100e sub-gigahertz transceivers.
- Detailed documentation of every aspect of this driver.
- An easy to use configuration API that allows setting the transceiver
configuration (modulation rate, channel bandwidth, base frequency) and the
channel map.
- Fast channel hopping by pre-calibration of the channels during device
configuration (so that no calibration is needed during hopping).
- Simplified SPI communication: Only during start-up the MCU has to wait
for the transceiver to be ready (for the power regulators and the crystal
to stabilize). The old driver did this for every SPI transfer, which
resulted in complex communication code. This driver will wait on start up
for the transceiver to power up and then use RIOT's SPI API like every other
driver. (Not only the data sheet states that this is fine, it also proved to
be reliable in practise.)
- Greatly reduced latency: The RTT on the old driver (@150 kbps data rate) was
about 16ms, the new driver (@250 kbps data rate) has as RTT of ~3ms
(depending on SPI clock and on CPU performance) (measured with ping6).
- Increased reliability: The preamble size and the sync word size have been
doubled compared to the old driver (preamble: 8 bytes instead of 4,
sync word: 4 byte instead of 2). The new values are the once recommended by
the data sheet for reliable communication.
- Basic diagnostic during driver initialization to detect common issues as
SPI communication issues and GDO pin configuration/wiring issues.
- TX power configuration with netdev_driver_t::set() API-integration
- Calls to netdev_driver_t::send() block until the transmission has completed
to ease the use of the API (implemented without busy waiting, so that the
MCU can enter lower power states or other threads can be executed).
2018-11-08 17:37:07 +01:00
|
|
|
* @{
|
|
|
|
*
|
|
|
|
* @file
|
2019-09-04 13:15:15 +02:00
|
|
|
* @brief Channel maps that translate "virtual" channels to "physical"
|
|
|
|
* channels.
|
drivers/cc110x: Rewrite of the cc110x driver
The cc110x driver has been re-written from scratch to overcome the limitations
of the old driver. The main motivation of the rewrite was to achieve better
maintainability by a detailed documentation, reduce the complexity and the
overhead of the SPI communication with the device, and to allow to
simultaneously use transceivers with different configuration regarding the used
base band, the channel bandwidth, the modulation rate, and the channel map.
Features of this driver include:
- Support for the CC1100, CC1101, and the CC1100e sub-gigahertz transceivers.
- Detailed documentation of every aspect of this driver.
- An easy to use configuration API that allows setting the transceiver
configuration (modulation rate, channel bandwidth, base frequency) and the
channel map.
- Fast channel hopping by pre-calibration of the channels during device
configuration (so that no calibration is needed during hopping).
- Simplified SPI communication: Only during start-up the MCU has to wait
for the transceiver to be ready (for the power regulators and the crystal
to stabilize). The old driver did this for every SPI transfer, which
resulted in complex communication code. This driver will wait on start up
for the transceiver to power up and then use RIOT's SPI API like every other
driver. (Not only the data sheet states that this is fine, it also proved to
be reliable in practise.)
- Greatly reduced latency: The RTT on the old driver (@150 kbps data rate) was
about 16ms, the new driver (@250 kbps data rate) has as RTT of ~3ms
(depending on SPI clock and on CPU performance) (measured with ping6).
- Increased reliability: The preamble size and the sync word size have been
doubled compared to the old driver (preamble: 8 bytes instead of 4,
sync word: 4 byte instead of 2). The new values are the once recommended by
the data sheet for reliable communication.
- Basic diagnostic during driver initialization to detect common issues as
SPI communication issues and GDO pin configuration/wiring issues.
- TX power configuration with netdev_driver_t::set() API-integration
- Calls to netdev_driver_t::send() block until the transmission has completed
to ease the use of the API (implemented without busy waiting, so that the
MCU can enter lower power states or other threads can be executed).
2018-11-08 17:37:07 +01:00
|
|
|
*
|
2019-09-04 13:15:15 +02:00
|
|
|
* @author Marian Buschsieweke <marian.buschsieweke@ovgu.de>
|
drivers/cc110x: Rewrite of the cc110x driver
The cc110x driver has been re-written from scratch to overcome the limitations
of the old driver. The main motivation of the rewrite was to achieve better
maintainability by a detailed documentation, reduce the complexity and the
overhead of the SPI communication with the device, and to allow to
simultaneously use transceivers with different configuration regarding the used
base band, the channel bandwidth, the modulation rate, and the channel map.
Features of this driver include:
- Support for the CC1100, CC1101, and the CC1100e sub-gigahertz transceivers.
- Detailed documentation of every aspect of this driver.
- An easy to use configuration API that allows setting the transceiver
configuration (modulation rate, channel bandwidth, base frequency) and the
channel map.
- Fast channel hopping by pre-calibration of the channels during device
configuration (so that no calibration is needed during hopping).
- Simplified SPI communication: Only during start-up the MCU has to wait
for the transceiver to be ready (for the power regulators and the crystal
to stabilize). The old driver did this for every SPI transfer, which
resulted in complex communication code. This driver will wait on start up
for the transceiver to power up and then use RIOT's SPI API like every other
driver. (Not only the data sheet states that this is fine, it also proved to
be reliable in practise.)
- Greatly reduced latency: The RTT on the old driver (@150 kbps data rate) was
about 16ms, the new driver (@250 kbps data rate) has as RTT of ~3ms
(depending on SPI clock and on CPU performance) (measured with ping6).
- Increased reliability: The preamble size and the sync word size have been
doubled compared to the old driver (preamble: 8 bytes instead of 4,
sync word: 4 byte instead of 2). The new values are the once recommended by
the data sheet for reliable communication.
- Basic diagnostic during driver initialization to detect common issues as
SPI communication issues and GDO pin configuration/wiring issues.
- TX power configuration with netdev_driver_t::set() API-integration
- Calls to netdev_driver_t::send() block until the transmission has completed
to ease the use of the API (implemented without busy waiting, so that the
MCU can enter lower power states or other threads can be executed).
2018-11-08 17:37:07 +01:00
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "cc110x.h"
|
|
|
|
#include "cc110x_internal.h"
|
|
|
|
|
|
|
|
const cc110x_chanmap_t cc110x_chanmap_433mhz_300khz = {
|
|
|
|
.map = {
|
|
|
|
0, /*< base + 0.000MHz = 433.225 MHz (up to 350 kHz wide channel) */
|
|
|
|
7, /*< base + 0.350MHz = 433.575 MHz (up to 350 kHz wide channel) */
|
|
|
|
14, /*< base + 0.700MHz = 433.925 MHz (up to 350 kHz wide channel) */
|
|
|
|
21, /*< base + 1.050MHz = 434.275 MHz (up to 350 kHz wide channel) */
|
|
|
|
28, /*< base + 1.400MHz = 434.625 MHz (only up to *330* kHz wide) */
|
|
|
|
255, /*< License free range (433.05 MHz - 434.79 MHz) exhausted :-( */
|
|
|
|
255, /*< License free range (433.05 MHz - 434.79 MHz) exhausted :-( */
|
|
|
|
255, /*< License free range (433.05 MHz - 434.79 MHz) exhausted :-( */
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
const cc110x_chanmap_t cc110x_chanmap_433mhz_50khz = {
|
|
|
|
.map = {
|
|
|
|
0, /*< base + 0.000MHz = 433.100 MHz (LDP433 Channel 2) */
|
|
|
|
4, /*< base + 0.200MHz = 433.300 MHz (LDP433 Channel 10)*/
|
|
|
|
8, /*< base + 0.400MHz = 433.500 MHz (LDP433 Channel 18) */
|
|
|
|
12, /*< base + 0.600MHz = 433.700 MHz (LDP433 Channel 26) */
|
|
|
|
16, /*< base + 0.800MHz = 433.900 MHz (LDP433 Channel 34) */
|
|
|
|
20, /*< base + 1.000MHz = 434.100 MHz (LDP433 Channel 42) */
|
|
|
|
24, /*< base + 1.200MHz = 434.300 MHz (LDP433 Channel 50) */
|
|
|
|
28, /*< base + 1.400MHz = 434.500 MHz (LDP433 Channel 58) */
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
const cc110x_chanmap_t cc110x_chanmap_433mhz_50khz_alt = {
|
|
|
|
.map = {
|
|
|
|
2, /*< base + 0.100MHz = 433.200 MHz (LDP433 Channel 6) */
|
|
|
|
6, /*< base + 0.300MHz = 433.400 MHz (LDP433 Channel 14)*/
|
|
|
|
10, /*< base + 0.500MHz = 433.600 MHz (LDP433 Channel 22) */
|
|
|
|
14, /*< base + 0.700MHz = 433.800 MHz (LDP433 Channel 30) */
|
|
|
|
18, /*< base + 0.900MHz = 434.000 MHz (LDP433 Channel 38) */
|
|
|
|
22, /*< base + 1.100MHz = 434.200 MHz (LDP433 Channel 46) */
|
|
|
|
26, /*< base + 1.300MHz = 434.400 MHz (LDP433 Channel 54) */
|
|
|
|
30, /*< base + 1.500MHz = 434.600 MHz (LDP433 Channel 62) */
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
const cc110x_chanmap_t cc110x_chanmap_868mhz_lora = {
|
|
|
|
.map = {
|
|
|
|
0, /*< base + 0.000MHz = 865.20 MHz = LoRa868 Channel 10 */
|
|
|
|
6, /*< base + 0.300MHz = 865.50 MHz = LoRa868 Channel 11 */
|
|
|
|
12, /*< base + 0.600MHz = 865.80 MHz = LoRa868 Channel 12 */
|
|
|
|
18, /*< base + 0.900MHz = 866.10 MHz = LoRa868 Channel 13 */
|
|
|
|
24, /*< base + 1.200MHz = 866.40 MHz = LoRa868 Channel 14 */
|
|
|
|
30, /*< base + 1.500MHz = 866.70 MHz = LoRa868 Channel 15 */
|
|
|
|
36, /*< base + 1.800MHz = 867.00 MHz = LoRa868 Channel 16 */
|
|
|
|
56, /*< base + 2.800MHz = 868.00 MHz = LoRa868 Channel 17 */
|
|
|
|
}
|
|
|
|
};
|