Mbed OS Reference
Loading...
Searching...
No Matches
sx126x_ds.h File Reference

SX126x driver implementation. More...

#include "LoRaRadio.h"

Go to the source code of this file.

Data Structures

struct  rx_counter_t
 Represents the Rx internal counters values when GFSK or LoRa packet type is used. More...
 
union  caliberation_params_t
 Represents a calibration configuration. More...
 
union  radio_error_t
 Represents the possible radio system error states. More...
 
union  radio_status_t
 Structure describing the radio status. More...
 
struct  modulation_params_t
 The type describing the modulation parameters for every packet types. More...
 
struct  packet_params
 The type describing the packet parameters for every packet types. More...
 
struct  packet_status_t
 Represents the packet status for every packet type. More...
 

Macros

#define XTAL_FREQ   32000000
 Provides the frequency of the chip running on the radio and the frequency step. More...
 
#define SX1261   0
 List of devices supported by this driver. More...
 
#define MATCHING_FREQ_915   0
 List of matching supported by the sx126x. More...
 
#define AUTO_RX_TX_OFFSET   2
 Compensation delay for SetAutoTx/Rx functions in 15.625 microseconds. More...
 
#define CRC_IBM_SEED   0xFFFF
 LFSR initial value to compute IBM type CRC. More...
 
#define CRC_CCITT_SEED   0x1D0F
 LFSR initial value to compute CCIT type CRC. More...
 
#define CRC_POLYNOMIAL_IBM   0x8005
 Polynomial used to compute IBM CRC. More...
 
#define CRC_POLYNOMIAL_CCITT   0x1021
 Polynomial used to compute CCIT CRC. More...
 
#define REG_LR_CRCSEEDBASEADDR   0x06BC
 The address of the register holding the first byte defining the CRC seed. More...
 
#define REG_LR_CRCPOLYBASEADDR   0x06BE
 The address of the register holding the first byte defining the CRC polynomial. More...
 
#define REG_LR_WHITSEEDBASEADDR_MSB   0x06B8
 The address of the register holding the first byte defining the whitening seed. More...
 
#define REG_LR_PACKETPARAMS   0x0704
 The address of the register holding the packet configuration. More...
 
#define REG_LR_PAYLOADLENGTH   0x0702
 The address of the register holding the payload size. More...
 
#define REG_LR_SYNCWORDBASEADDRESS   0x06C0
 The addresses of the registers holding SyncWords values. More...
 
#define REG_LR_SYNCWORD   0x0740
 The addresses of the register holding LoRa Modem SyncWord value. More...
 
#define LORA_MAC_PRIVATE_SYNCWORD   0x1424
 
#define LORA_MAC_PUBLIC_SYNCWORD   0x3444
 
#define RANDOM_NUMBER_GENERATORBASEADDR   0x0819
 
#define REG_RX_GAIN   0x08AC
 
#define REG_FREQUENCY_ERRORBASEADDR   0x076B
 
#define REG_XTA_TRIM   0x0911
 
#define REG_OCP   0x08E7
 

Typedefs

typedef enum radio_crc_types_e radio_crc_types_t
 Represents the CRC length. More...
 
typedef struct packet_params packet_params_t
 The type describing the packet parameters for every packet types. More...
 

Enumerations

enum  radio_operating_mode_t {
}
 Represents the operating mode the radio is actually running. More...
 
enum  radio_standby_mode_t
 Declares the oscillator in use while in standby mode. More...
 
enum  radio_regulator_mode_t
 Declares the power regulation used to power the device. More...
 
enum  radio_ramp_time_t
 Represents the ramping time for power amplifier. More...
 
enum  lora_cad_symbols_t
 Represents the number of symbols to be used for channel activity detection operation. More...
 
enum  cad_exit_modes_t
 Represents the Channel Activity Detection actions after the CAD operation is finished. More...
 
enum  radio_mod_shaping_t
 Represents the modulation shaping parameter. More...
 
enum  radio_rx_bandwidth_t
 Represents the modulation shaping parameter. More...
 
enum  lora_spread_factors_t
 Represents the possible spreading factor values in LoRa packet types. More...
 
enum  lora_bandwidths_t
 Represents the bandwidth values for LoRa packet type. More...
 
enum  lora_coding_tates_t
 Represents the coding rate values for LoRa packet type. More...
 
enum  radio_preamble_detection_t {
  RADIO_PREAMBLE_DETECTOR_OFF = 0x00 , RADIO_PREAMBLE_DETECTOR_08_BITS = 0x04 , RADIO_PREAMBLE_DETECTOR_16_BITS = 0x05 , RADIO_PREAMBLE_DETECTOR_24_BITS = 0x06 ,
  RADIO_PREAMBLE_DETECTOR_32_BITS = 0x07 , RADIO_PREAMBLE_DETECTOR_OFF = 0x00 , RADIO_PREAMBLE_DETECTOR_08_BITS = 0x04 , RADIO_PREAMBLE_DETECTOR_16_BITS = 0x05 ,
  RADIO_PREAMBLE_DETECTOR_24_BITS = 0x06 , RADIO_PREAMBLE_DETECTOR_32_BITS = 0x07
}
 Represents the preamble length used to detect the packet on Rx side. More...
 
enum  radio_address_filter_t { RADIO_ADDRESSCOMP_FILT_OFF = 0x00 , RADIO_ADDRESSCOMP_FILT_NODE = 0x01 , RADIO_ADDRESSCOMP_FILT_NODE_BROAD = 0x02 , RADIO_ADDRESSCOMP_FILT_OFF = 0x00 , RADIO_ADDRESSCOMP_FILT_NODE = 0x01 , RADIO_ADDRESSCOMP_FILT_NODE_BROAD = 0x02 }
 Represents the possible combinations of SyncWord correlators activated. More...
 
enum  radio_pkt_length_t { RADIO_PACKET_VARIABLE_LENGTH = 0x00 , RADIO_PACKET_FIXED_LENGTH = 0x01 , RADIO_PACKET_VARIABLE_LENGTH = 0x00 , RADIO_PACKET_FIXED_LENGTH = 0x01 }
 Radio packet length mode. More...
 
enum  radio_crc_types_e { RADIO_CRC_OFF = 0x01 , RADIO_CRC_1_BYTES = 0x00 , RADIO_CRC_2_BYTES = 0x02 , RADIO_CRC_1_BYTES_INV = 0x04 , RADIO_CRC_2_BYTES_INV = 0x06 , RADIO_CRC_2_BYTES_IBM = 0xF1 , RADIO_CRC_2_BYTES_CCIT = 0xF2 , RADIO_CRC_OFF = 0x01 , RADIO_CRC_1_BYTES = 0x00 , RADIO_CRC_2_BYTES = 0x02 , RADIO_CRC_1_BYTES_INV = 0x04 , RADIO_CRC_2_BYTES_INV = 0x06 , RADIO_CRC_2_BYTES_IBM = 0xF1 , RADIO_CRC_2_BYTES_CCIT = 0xF2 }
 Represents the CRC length. More...
 
enum  radio_whitening_mode_t
 Radio whitening mode activated or deactivated. More...
 
enum  lora_pkt_length_t { LORA_PACKET_VARIABLE_LENGTH = 0x00 , LORA_PACKET_FIXED_LENGTH = 0x01 , LORA_PACKET_EXPLICIT = LORA_PACKET_VARIABLE_LENGTH , LORA_PACKET_IMPLICIT = LORA_PACKET_FIXED_LENGTH , LORA_PACKET_VARIABLE_LENGTH = 0x00 , LORA_PACKET_FIXED_LENGTH = 0x01 , LORA_PACKET_EXPLICIT = LORA_PACKET_VARIABLE_LENGTH , LORA_PACKET_IMPLICIT = LORA_PACKET_FIXED_LENGTH }
 Holds the lengths mode of a LoRa packet type. More...
 
enum  lora_crc_mode_t { LORA_CRC_ON = 0x01 , LORA_CRC_OFF = 0x00 , LORA_CRC_ON = 0x01 , LORA_CRC_OFF = 0x00 }
 Represents the CRC mode for LoRa packet type. More...
 
enum  lora_IQ_mode_t
 Represents the IQ mode for LoRa packet type. More...
 
enum  radio_TCXO_ctrl_voltage_t
 Represents the volatge used to control the TCXO on/off from DIO3. More...
 
enum  radio_irq_masks_t
 Represents the interruption masks available for the radio. More...
 
enum  irq_error_t
 Structure describing the error codes for callback functions. More...
 

Detailed Description

SX126x driver implementation.

______ _
/ _____) _ | |
( (____ _____ ____ _| |_ _____ ____| |__
\____ \| ___ | (_ _) ___ |/ ___) _ \
_____) ) ____| | | || |_| ____( (___| | | |
(______/|_____)_|_|_| \__)_____)\____)_| |_|
(C)2013-2017 Semtech
Author
Miguel Luis ( Semtech )
Gregory Cristian ( Semtech )

Copyright (c) 2019, Arm Limited and affiliates.

SPDX-License-Identifier: BSD-3-Clause

Definition in file sx126x_ds.h.

Macro Definition Documentation

◆ XTAL_FREQ

#define XTAL_FREQ   32000000

Provides the frequency of the chip running on the radio and the frequency step.

Remarks
These defines are used for computing the frequency divider to set the RF frequency

Definition at line 37 of file sx126x_ds.h.

◆ SX1261

#define SX1261   0

List of devices supported by this driver.

Definition at line 46 of file sx126x_ds.h.

◆ MATCHING_FREQ_915

#define MATCHING_FREQ_915   0

List of matching supported by the sx126x.

Definition at line 53 of file sx126x_ds.h.

◆ AUTO_RX_TX_OFFSET

#define AUTO_RX_TX_OFFSET   2

Compensation delay for SetAutoTx/Rx functions in 15.625 microseconds.

Definition at line 64 of file sx126x_ds.h.

◆ CRC_IBM_SEED

#define CRC_IBM_SEED   0xFFFF

LFSR initial value to compute IBM type CRC.

Definition at line 69 of file sx126x_ds.h.

◆ CRC_CCITT_SEED

#define CRC_CCITT_SEED   0x1D0F

LFSR initial value to compute CCIT type CRC.

Definition at line 74 of file sx126x_ds.h.

◆ CRC_POLYNOMIAL_IBM

#define CRC_POLYNOMIAL_IBM   0x8005

Polynomial used to compute IBM CRC.

Definition at line 79 of file sx126x_ds.h.

◆ CRC_POLYNOMIAL_CCITT

#define CRC_POLYNOMIAL_CCITT   0x1021

Polynomial used to compute CCIT CRC.

Definition at line 84 of file sx126x_ds.h.

◆ REG_LR_CRCSEEDBASEADDR

#define REG_LR_CRCSEEDBASEADDR   0x06BC

The address of the register holding the first byte defining the CRC seed.

Definition at line 90 of file sx126x_ds.h.

◆ REG_LR_CRCPOLYBASEADDR

#define REG_LR_CRCPOLYBASEADDR   0x06BE

The address of the register holding the first byte defining the CRC polynomial.

Definition at line 95 of file sx126x_ds.h.

◆ REG_LR_WHITSEEDBASEADDR_MSB

#define REG_LR_WHITSEEDBASEADDR_MSB   0x06B8

The address of the register holding the first byte defining the whitening seed.

Definition at line 100 of file sx126x_ds.h.

◆ REG_LR_PACKETPARAMS

#define REG_LR_PACKETPARAMS   0x0704

The address of the register holding the packet configuration.

Definition at line 106 of file sx126x_ds.h.

◆ REG_LR_PAYLOADLENGTH

#define REG_LR_PAYLOADLENGTH   0x0702

The address of the register holding the payload size.

Definition at line 111 of file sx126x_ds.h.

◆ REG_LR_SYNCWORDBASEADDRESS

#define REG_LR_SYNCWORDBASEADDRESS   0x06C0

The addresses of the registers holding SyncWords values.

Definition at line 116 of file sx126x_ds.h.

◆ REG_LR_SYNCWORD

#define REG_LR_SYNCWORD   0x0740

The addresses of the register holding LoRa Modem SyncWord value.

Definition at line 121 of file sx126x_ds.h.

◆ LORA_MAC_PRIVATE_SYNCWORD

#define LORA_MAC_PRIVATE_SYNCWORD   0x1424

Syncword for Private LoRa networks

Definition at line 126 of file sx126x_ds.h.

◆ LORA_MAC_PUBLIC_SYNCWORD

#define LORA_MAC_PUBLIC_SYNCWORD   0x3444

Syncword for Public LoRa networks

Definition at line 131 of file sx126x_ds.h.

◆ RANDOM_NUMBER_GENERATORBASEADDR

#define RANDOM_NUMBER_GENERATORBASEADDR   0x0819

The address of the register giving a 4 bytes random number

Definition at line 136 of file sx126x_ds.h.

◆ REG_RX_GAIN

#define REG_RX_GAIN   0x08AC

The address of the register holding RX Gain value (0x94: power saving, 0x96: rx boosted)

Definition at line 141 of file sx126x_ds.h.

◆ REG_FREQUENCY_ERRORBASEADDR

#define REG_FREQUENCY_ERRORBASEADDR   0x076B

The address of the register holding frequency error indication

Definition at line 146 of file sx126x_ds.h.

◆ REG_XTA_TRIM

#define REG_XTA_TRIM   0x0911

Change the value on the device internal trimming capacitor

Definition at line 151 of file sx126x_ds.h.

◆ REG_OCP

#define REG_OCP   0x08E7

Set the current max value in the over current protection

Definition at line 156 of file sx126x_ds.h.

Typedef Documentation

◆ radio_crc_types_t

Represents the CRC length.

◆ packet_params_t

The type describing the packet parameters for every packet types.

Enumeration Type Documentation

◆ radio_operating_mode_t

Represents the operating mode the radio is actually running.

Enumerator
MODE_DEEP_SLEEP 

The radio is in sleep mode.

MODE_STDBY_RC 

The radio is in deep-sleep mode.

MODE_STDBY_XOSC 

The radio is in standby mode with RC oscillator.

MODE_FS 

The radio is in standby mode with XOSC oscillator.

MODE_TX 

The radio is in frequency synthesis mode.

MODE_RX 

The radio is in transmit mode.

MODE_RX_DC 

The radio is in receive mode.

MODE_CAD 

The radio is in receive duty cycle mode.

The radio is in channel activity detection mode

MODE_DEEP_SLEEP 

The radio is in sleep mode.

MODE_STDBY_RC 

The radio is in deep-sleep mode.

MODE_STDBY_XOSC 

The radio is in standby mode with RC oscillator.

MODE_FS 

The radio is in standby mode with XOSC oscillator.

MODE_TX 

The radio is in frequency synthesis mode.

MODE_RX 

The radio is in transmit mode.

MODE_RX_DC 

The radio is in receive mode.

MODE_CAD 

The radio is in receive duty cycle mode.

The radio is in channel activity detection mode

Definition at line 212 of file sx126x_ds.h.

◆ radio_standby_mode_t

Declares the oscillator in use while in standby mode.

Using the STDBY_RC standby mode allow to reduce the energy consumption STDBY_XOSC should be used for time critical applications

Definition at line 230 of file sx126x_ds.h.

◆ radio_regulator_mode_t

Declares the power regulation used to power the device.

This command allows the user to specify if DC-DC or LDO is used for power regulation. Using only LDO implies that the Rx or Tx current is doubled

Definition at line 241 of file sx126x_ds.h.

◆ radio_ramp_time_t

Represents the ramping time for power amplifier.

Definition at line 249 of file sx126x_ds.h.

◆ lora_cad_symbols_t

Represents the number of symbols to be used for channel activity detection operation.

Definition at line 263 of file sx126x_ds.h.

◆ cad_exit_modes_t

Represents the Channel Activity Detection actions after the CAD operation is finished.

Definition at line 274 of file sx126x_ds.h.

◆ radio_mod_shaping_t

Represents the modulation shaping parameter.

Definition at line 283 of file sx126x_ds.h.

◆ radio_rx_bandwidth_t

Represents the modulation shaping parameter.

Definition at line 294 of file sx126x_ds.h.

◆ lora_spread_factors_t

Represents the possible spreading factor values in LoRa packet types.

Definition at line 321 of file sx126x_ds.h.

◆ lora_bandwidths_t

Represents the bandwidth values for LoRa packet type.

Definition at line 335 of file sx126x_ds.h.

◆ lora_coding_tates_t

Represents the coding rate values for LoRa packet type.

Definition at line 353 of file sx126x_ds.h.

◆ radio_preamble_detection_t

Represents the preamble length used to detect the packet on Rx side.

Enumerator
RADIO_PREAMBLE_DETECTOR_OFF 

Preamble detection length off.

RADIO_PREAMBLE_DETECTOR_08_BITS 

Preamble detection length 8 bits.

RADIO_PREAMBLE_DETECTOR_16_BITS 

Preamble detection length 16 bits.

RADIO_PREAMBLE_DETECTOR_24_BITS 

Preamble detection length 24 bits.

RADIO_PREAMBLE_DETECTOR_32_BITS 

Preamble detection length 32 bit.

RADIO_PREAMBLE_DETECTOR_OFF 

Preamble detection length off.

RADIO_PREAMBLE_DETECTOR_08_BITS 

Preamble detection length 8 bits.

RADIO_PREAMBLE_DETECTOR_16_BITS 

Preamble detection length 16 bits.

RADIO_PREAMBLE_DETECTOR_24_BITS 

Preamble detection length 24 bits.

RADIO_PREAMBLE_DETECTOR_32_BITS 

Preamble detection length 32 bit.

Definition at line 363 of file sx126x_ds.h.

◆ radio_address_filter_t

Represents the possible combinations of SyncWord correlators activated.

Enumerator
RADIO_ADDRESSCOMP_FILT_OFF 

No correlator turned on, i.e. do not search for SyncWord.

RADIO_ADDRESSCOMP_FILT_OFF 

No correlator turned on, i.e. do not search for SyncWord.

Definition at line 374 of file sx126x_ds.h.

◆ radio_pkt_length_t

Radio packet length mode.

Enumerator
RADIO_PACKET_VARIABLE_LENGTH 

The packet is on variable size, header included.

RADIO_PACKET_FIXED_LENGTH 

The packet is known on both sides, no header included in the packet.

RADIO_PACKET_VARIABLE_LENGTH 

The packet is on variable size, header included.

RADIO_PACKET_FIXED_LENGTH 

The packet is known on both sides, no header included in the packet.

Definition at line 383 of file sx126x_ds.h.

◆ radio_crc_types_e

Represents the CRC length.

Enumerator
RADIO_CRC_OFF 

No CRC in use.

RADIO_CRC_OFF 

No CRC in use.

Definition at line 391 of file sx126x_ds.h.

◆ radio_whitening_mode_t

Radio whitening mode activated or deactivated.

Definition at line 404 of file sx126x_ds.h.

◆ lora_pkt_length_t

Holds the lengths mode of a LoRa packet type.

Enumerator
LORA_PACKET_VARIABLE_LENGTH 

The packet is on variable size, header included.

LORA_PACKET_FIXED_LENGTH 

The packet is known on both sides, no header included in the packet.

LORA_PACKET_VARIABLE_LENGTH 

The packet is on variable size, header included.

LORA_PACKET_FIXED_LENGTH 

The packet is known on both sides, no header included in the packet.

Definition at line 412 of file sx126x_ds.h.

◆ lora_crc_mode_t

Represents the CRC mode for LoRa packet type.

Enumerator
LORA_CRC_ON 

CRC activated.

LORA_CRC_OFF 

CRC not used.

LORA_CRC_ON 

CRC activated.

LORA_CRC_OFF 

CRC not used.

Definition at line 422 of file sx126x_ds.h.

◆ lora_IQ_mode_t

Represents the IQ mode for LoRa packet type.

Definition at line 430 of file sx126x_ds.h.

◆ radio_TCXO_ctrl_voltage_t

Represents the volatge used to control the TCXO on/off from DIO3.

Definition at line 438 of file sx126x_ds.h.

◆ radio_irq_masks_t

Represents the interruption masks available for the radio.

Remarks
Note that not all these interruptions are available for all packet types

Definition at line 454 of file sx126x_ds.h.

◆ irq_error_t

Structure describing the error codes for callback functions.

Definition at line 530 of file sx126x_ds.h.