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

STM32WL 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  calibration_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 IS_TCXO_SUPPORTED   1U
 Indicates whether or not TCXO is supported by the board 0: TCXO not supported 1: TCXO supported. More...
 
#define SMPS_DRIVE_SETTING_DEFAULT   SMPS_DRV_40
 drive value used anytime radio is NOT in TX low power mode More...
 
#define SMPS_DRIVE_SETTING_MAX   SMPS_DRV_60
 drive value used anytime radio is in TX low power mode TX low power mode is the worst case because the PA sinks from SMPS while in high power mode, current is sunk directly from the battery More...
 
#define REG_XTA_TRIM   0x0911
 Change the value on the device internal trimming capacitor. More...
 
#define REG_XTB_TRIM   0x0912
 Change the value on the device internal trimming capacitor. More...
 
#define REG_OCP   0x08E7
 Set the current max value in the over current protection. More...
 
#define REG_TX_CLAMP   0x08D8
 PA Clamping threshold. More...
 
#define SUBGHZ_GBSYNCR   REG_BIT_SYNC
 Sub-GHz radio register (re) definition. More...
 
#define XTAL_FREQ   32000000
 Provides the frequency of the chip running on the radio and the frequency step. More...
 
#define MATCHING_FREQ_915   0
 List of matching supported by the STM32WL SubGHz. 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
 Change the value on the device internal trimming capacitor. More...
 
#define REG_OCP   0x08E7
 Set the current max value in the over current protection. More...
 

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_states_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...
 
enum  RFState_t { RFSWITCH_RX = 0 , RFSWITCH_TX = 1 }
 Radio driver internal state machine states definition. More...
 

Detailed Description

STM32WL driver implementation.

Copyright 2021 STMicroelectronics SPDX-License-Identifier: BSD-3-Clause

Definition in file STM32WL_radio_driver.h.

Macro Definition Documentation

◆ IS_TCXO_SUPPORTED

#define IS_TCXO_SUPPORTED   1U

Indicates whether or not TCXO is supported by the board 0: TCXO not supported 1: TCXO supported.

Definition at line 46 of file STM32WL_radio_driver.h.

◆ SMPS_DRIVE_SETTING_DEFAULT

#define SMPS_DRIVE_SETTING_DEFAULT   SMPS_DRV_40

drive value used anytime radio is NOT in TX low power mode

Definition at line 51 of file STM32WL_radio_driver.h.

◆ SMPS_DRIVE_SETTING_MAX

#define SMPS_DRIVE_SETTING_MAX   SMPS_DRV_60

drive value used anytime radio is in TX low power mode TX low power mode is the worst case because the PA sinks from SMPS while in high power mode, current is sunk directly from the battery

Definition at line 58 of file STM32WL_radio_driver.h.

◆ REG_XTA_TRIM [1/2]

#define REG_XTA_TRIM   0x0911

Change the value on the device internal trimming capacitor.

Change the value on the device internal trimming capacitor

Definition at line 262 of file STM32WL_radio_driver.h.

◆ REG_XTB_TRIM

#define REG_XTB_TRIM   0x0912

Change the value on the device internal trimming capacitor.

Definition at line 68 of file STM32WL_radio_driver.h.

◆ REG_OCP [1/2]

#define REG_OCP   0x08E7

Set the current max value in the over current protection.

Set the current max value in the over current protection

Definition at line 267 of file STM32WL_radio_driver.h.

◆ REG_TX_CLAMP

#define REG_TX_CLAMP   0x08D8

PA Clamping threshold.

Definition at line 78 of file STM32WL_radio_driver.h.

◆ SUBGHZ_GBSYNCR

#define SUBGHZ_GBSYNCR   REG_BIT_SYNC

Sub-GHz radio register (re) definition.

Note
The sub-GHz radio peripheral registers can be accessed by sub-GHz radio command SUBGRF_WriteRegisters() and SUBGRF_ReadRegisters() "

Definition at line 86 of file STM32WL_radio_driver.h.

◆ 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 155 of file STM32WL_radio_driver.h.

◆ MATCHING_FREQ_915

#define MATCHING_FREQ_915   0

List of matching supported by the STM32WL SubGHz.

Definition at line 164 of file STM32WL_radio_driver.h.

◆ AUTO_RX_TX_OFFSET

#define AUTO_RX_TX_OFFSET   2

Compensation delay for SetAutoTx/Rx functions in 15.625 microseconds.

Definition at line 175 of file STM32WL_radio_driver.h.

◆ CRC_IBM_SEED

#define CRC_IBM_SEED   0xFFFF

LFSR initial value to compute IBM type CRC.

Definition at line 180 of file STM32WL_radio_driver.h.

◆ CRC_CCITT_SEED

#define CRC_CCITT_SEED   0x1D0F

LFSR initial value to compute CCIT type CRC.

Definition at line 185 of file STM32WL_radio_driver.h.

◆ CRC_POLYNOMIAL_IBM

#define CRC_POLYNOMIAL_IBM   0x8005

Polynomial used to compute IBM CRC.

Definition at line 190 of file STM32WL_radio_driver.h.

◆ CRC_POLYNOMIAL_CCITT

#define CRC_POLYNOMIAL_CCITT   0x1021

Polynomial used to compute CCIT CRC.

Definition at line 195 of file STM32WL_radio_driver.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 201 of file STM32WL_radio_driver.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 206 of file STM32WL_radio_driver.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 211 of file STM32WL_radio_driver.h.

◆ REG_LR_PACKETPARAMS

#define REG_LR_PACKETPARAMS   0x0704

The address of the register holding the packet configuration.

Definition at line 217 of file STM32WL_radio_driver.h.

◆ REG_LR_PAYLOADLENGTH

#define REG_LR_PAYLOADLENGTH   0x0702

The address of the register holding the payload size.

Definition at line 222 of file STM32WL_radio_driver.h.

◆ REG_LR_SYNCWORDBASEADDRESS

#define REG_LR_SYNCWORDBASEADDRESS   0x06C0

The addresses of the registers holding SyncWords values.

Definition at line 227 of file STM32WL_radio_driver.h.

◆ REG_LR_SYNCWORD

#define REG_LR_SYNCWORD   0x0740

The addresses of the register holding LoRa Modem SyncWord value.

Definition at line 232 of file STM32WL_radio_driver.h.

◆ LORA_MAC_PRIVATE_SYNCWORD

#define LORA_MAC_PRIVATE_SYNCWORD   0x1424

Syncword for Private LoRa networks

Definition at line 237 of file STM32WL_radio_driver.h.

◆ LORA_MAC_PUBLIC_SYNCWORD

#define LORA_MAC_PUBLIC_SYNCWORD   0x3444

Syncword for Public LoRa networks

Definition at line 242 of file STM32WL_radio_driver.h.

◆ RANDOM_NUMBER_GENERATORBASEADDR

#define RANDOM_NUMBER_GENERATORBASEADDR   0x0819

The address of the register giving a 4 bytes random number

Definition at line 247 of file STM32WL_radio_driver.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 252 of file STM32WL_radio_driver.h.

◆ REG_FREQUENCY_ERRORBASEADDR

#define REG_FREQUENCY_ERRORBASEADDR   0x076B

The address of the register holding frequency error indication

Definition at line 257 of file STM32WL_radio_driver.h.

◆ REG_XTA_TRIM [2/2]

#define REG_XTA_TRIM   0x0911

Change the value on the device internal trimming capacitor.

Change the value on the device internal trimming capacitor

Definition at line 262 of file STM32WL_radio_driver.h.

◆ REG_OCP [2/2]

#define REG_OCP   0x08E7

Set the current max value in the over current protection.

Set the current max value in the over current protection

Definition at line 267 of file STM32WL_radio_driver.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 323 of file STM32WL_radio_driver.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 341 of file STM32WL_radio_driver.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 352 of file STM32WL_radio_driver.h.

◆ radio_ramp_time_t

Represents the ramping time for power amplifier.

Definition at line 360 of file STM32WL_radio_driver.h.

◆ lora_cad_symbols_t

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

Definition at line 374 of file STM32WL_radio_driver.h.

◆ cad_exit_modes_t

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

Definition at line 385 of file STM32WL_radio_driver.h.

◆ radio_mod_shaping_t

Represents the modulation shaping parameter.

Definition at line 394 of file STM32WL_radio_driver.h.

◆ radio_rx_bandwidth_t

Represents the modulation shaping parameter.

Definition at line 405 of file STM32WL_radio_driver.h.

◆ lora_spread_factors_t

Represents the possible spreading factor values in LoRa packet types.

Definition at line 432 of file STM32WL_radio_driver.h.

◆ lora_bandwidths_t

Represents the bandwidth values for LoRa packet type.

Definition at line 446 of file STM32WL_radio_driver.h.

◆ lora_coding_states_t

Represents the coding rate values for LoRa packet type.

Definition at line 464 of file STM32WL_radio_driver.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 474 of file STM32WL_radio_driver.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 485 of file STM32WL_radio_driver.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 494 of file STM32WL_radio_driver.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 502 of file STM32WL_radio_driver.h.

◆ radio_whitening_mode_t

Radio whitening mode activated or deactivated.

Definition at line 515 of file STM32WL_radio_driver.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 523 of file STM32WL_radio_driver.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 533 of file STM32WL_radio_driver.h.

◆ lora_IQ_mode_t

Represents the IQ mode for LoRa packet type.

Definition at line 541 of file STM32WL_radio_driver.h.

◆ radio_TCXO_ctrl_voltage_t

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

Definition at line 549 of file STM32WL_radio_driver.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 565 of file STM32WL_radio_driver.h.

◆ irq_error_t

Structure describing the error codes for callback functions.

Definition at line 598 of file STM32WL_radio_driver.h.

◆ RFState_t

enum RFState_t

Radio driver internal state machine states definition.

Enumerator
RFSWITCH_RX 

The radio is in RX.

RFSWITCH_TX 

The radio is in TX.

Definition at line 702 of file STM32WL_radio_driver.h.