Mistake on this page?
Report an issue in GitHub or email us
STM32WL_radio_driver.h
Go to the documentation of this file.
1 /*!
2  * \file STM32WL_radio_driver.h
3  * Copyright 2021 STMicroelectronics
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  * \brief STM32WL driver implementation
7  *
8  */
9 
10 
11 #ifndef MBED_LORA_RADIO_DRV_STM32WL_RADIO_DRIVER_H_
12 #define MBED_LORA_RADIO_DRV_STM32WL_RADIO_DRIVER_H_
13 
14 #include "LoRaRadio.h"
15 
16 #define RFO_LP 1
17 #define RFO_HP 2
18 
19 /* STM32WL Nucleo antenna switch defines */
20 #define RBI_CONF_RFO_LP_HP 0
21 #define RBI_CONF_RFO_LP 1
22 #define RBI_CONF_RFO_HP 2
23 
24 typedef enum {
25  RBI_SWITCH_OFF = 0,
26  RBI_SWITCH_RX = 1,
27  RBI_SWITCH_RFO_LP = 2,
28  RBI_SWITCH_RFO_HP = 3,
29 } RBI_Switch_TypeDef;
30 
31 
32 /**
33  * Indicates whether or not TCXO is supported by the board
34  * 0: TCXO not supported
35  * 1: TCXO supported
36  */
37 #define IS_TCXO_SUPPORTED 1U
38 
39 /**
40  * @brief drive value used anytime radio is NOT in TX low power mode
41  */
42 #define SMPS_DRIVE_SETTING_DEFAULT SMPS_DRV_40
43 
44 /**
45  * @brief drive value used anytime radio is in TX low power mode
46  * TX low power mode is the worst case because the PA sinks from SMPS
47  * while in high power mode, current is sunk directly from the battery
48  */
49 #define SMPS_DRIVE_SETTING_MAX SMPS_DRV_60
50 
51 /*!
52  * \brief Change the value on the device internal trimming capacitor
53  */
54 #define REG_XTA_TRIM 0x0911
55 
56 /*!
57  * \brief Change the value on the device internal trimming capacitor
58  */
59 #define REG_XTB_TRIM 0x0912
60 
61 /*!
62  * \brief Set the current max value in the over current protection
63  */
64 #define REG_OCP 0x08E7
65 
66 /*!
67  * \brief PA Clamping threshold
68  */
69 #define REG_TX_CLAMP 0x08D8
70 
71 /**
72  * @brief Sub-GHz radio register (re) definition
73  * @note The sub-GHz radio peripheral registers can be accessed by sub-GHz radio command
74  * SUBGRF_WriteRegisters() and SUBGRF_ReadRegisters() "
75  */
76 /*Sub-GHz radio generic bit synchronization register*/
77 #define SUBGHZ_GBSYNCR REG_BIT_SYNC
78 /*Sub-GHz radio generic packet control 1A register*/
79 #define SUBGHZ_GPKTCTL1AR REG_LR_WHITSEEDBASEADDR_MSB
80 /*Sub-GHz radio generic whitening LSB register*/
81 #define SUBGHZ_GWHITEINIRL REG_LR_WHITSEEDBASEADDR_LSB
82 /*Sub-GHz radio generic CRC initial MSB register*/
83 #define SUBGHZ_GCRCINIRH REG_LR_CRCSEEDBASEADDR
84 /*Sub-GHz radio generic CRC initial LSB register*/
85 #define SUBGHZ_GCRCINIRL 0x06BD
86 /*Sub-GHz radio generic CRC polynomial MSB register*/
87 #define SUBGHZ_GCRCPOLRH REG_LR_CRCPOLYBASEADDR
88 /*Sub-GHz radio generic CRC polynomial LSB register*/
89 #define SUBGHZ_GCRCPOLRL 0x06BF
90 /*Sub-GHz radio generic synchronization word control register 7*/
91 #define SUBGHZ_GSYNCR7 REG_LR_SYNCWORDBASEADDRESS
92 /*Sub-GHz radio generic synchronization word control register 6*/
93 #define SUBGHZ_GSYNCR6 0x06C1
94 /*Sub-GHz radio generic synchronization word control register 5*/
95 #define SUBGHZ_GSYNCR5 0x06C2
96 /*Sub-GHz radio generic synchronization word control register 4*/
97 #define SUBGHZ_GSYNCR4 0x06C3
98 /*Sub-GHz radio generic synchronization word control register 3*/
99 #define SUBGHZ_GSYNCR3 0x06C4
100 /*Sub-GHz radio generic synchronization word control register 2*/
101 #define SUBGHZ_GSYNCR2 0x06C5
102 /*Sub-GHz radio generic synchronization word control register 1*/
103 #define SUBGHZ_GSYNCR1 0x06C6
104 /*Sub-GHz radio generic synchronization word control register 0*/
105 #define SUBGHZ_GSYNCR0 0x06C7
106 /*Sub-GHz radio LoRa synchronization word MSB register*/
107 #define SUBGHZ_LSYNCRH REG_LR_SYNCWORD
108 /*Sub-GHz radio LoRa synchronization word LSB register*/
109 #define SUBGHZ_LSYNCRL 0x0741
110 /*Sub-GHz radio random number register 3*/
111 #define SUBGHZ_RNGR3 RANDOM_NUMBER_GENERATORBASEADDR
112 /*Sub-GHz radio random number register 2*/
113 #define SUBGHZ_RNGR2 0x081A
114 /*Sub-GHz radio random number register 1*/
115 #define SUBGHZ_RNGR1 0x081B
116 /*Sub-GHz radio random number register 0*/
117 #define SUBGHZ_RNGR0 0x081C
118 /*Sub-GHz radio receiver gain control register*/
119 #define SUBGHZ_RXGAINCR REG_RX_GAIN
120 /*Sub-GHz radio PA over current protection register*/
121 #define SUBGHZ_PAOCPR REG_OCP
122 /*Sub-GHz radio HSE32 OSC_IN capacitor trim register*/
123 #define SUBGHZ_HSEINTRIMR REG_XTA_TRIM
124 /*Sub-GHz radio HSE32 OSC_OUT capacitor trim register*/
125 #define SUBGHZ_HSEOUTTRIMR REG_XTB_TRIM
126 /*Sub-GHz radio SMPS control 0 register */
127 #define SUBGHZ_SMPSC0R 0x0916
128 /*Sub-GHz radio power control register*/
129 #define SUBGHZ_PCR 0x091A
130 /*Sub-GHz radio SMPS control 2 register */
131 #define SUBGHZ_SMPSC2R 0x0923
132 
133 #define SMPS_CLK_DET_ENABLE ((uint8_t) (1<<6))
134 
135 #define SMPS_DRV_20 ((uint8_t) ((0x0)<<1))
136 #define SMPS_DRV_40 ((uint8_t) ((0x1)<<1))
137 #define SMPS_DRV_60 ((uint8_t) ((0x2)<<1))
138 #define SMPS_DRV_100 ((uint8_t) ((0x3)<<1))
139 #define SMPS_DRV_MASK ((uint8_t) ((0x3)<<1))
140 
141 /*!
142  * \brief Provides the frequency of the chip running on the radio and the frequency step
143  *
144  * \remark These defines are used for computing the frequency divider to set the RF frequency
145  */
146 #define XTAL_FREQ 32000000
147 #define FREQ_DIV 33554432
148 #define FREQ_STEP 0.95367431640625 // ((double)(XTAL_FREQ / (double)FREQ_DIV))
149 #define FREQ_ERR 0.47683715820312
150 
151 
152 /*!
153  * \brief List of matching supported by the STM32WL SubGHz
154  */
155 #define MATCHING_FREQ_915 0
156 #define MATCHING_FREQ_780 1
157 #define MATCHING_FREQ_490 2
158 #define MATCHING_FREQ_434 3
159 #define MATCHING_FREQ_280 4
160 #define MATCHING_FREQ_169 5
161 #define MATCHING_FREQ_868 6
162 
163 /*!
164  * \brief Compensation delay for SetAutoTx/Rx functions in 15.625 microseconds
165  */
166 #define AUTO_RX_TX_OFFSET 2
167 
168 /*!
169  * \brief LFSR initial value to compute IBM type CRC
170  */
171 #define CRC_IBM_SEED 0xFFFF
172 
173 /*!
174  * \brief LFSR initial value to compute CCIT type CRC
175  */
176 #define CRC_CCITT_SEED 0x1D0F
177 
178 /*!
179  * \brief Polynomial used to compute IBM CRC
180  */
181 #define CRC_POLYNOMIAL_IBM 0x8005
182 
183 /*!
184  * \brief Polynomial used to compute CCIT CRC
185  */
186 #define CRC_POLYNOMIAL_CCITT 0x1021
187 
188 /*!
189  * \brief The address of the register holding the first byte defining the CRC seed
190  *
191  */
192 #define REG_LR_CRCSEEDBASEADDR 0x06BC
193 
194 /*!
195  * \brief The address of the register holding the first byte defining the CRC polynomial
196  */
197 #define REG_LR_CRCPOLYBASEADDR 0x06BE
198 
199 /*!
200  * \brief The address of the register holding the first byte defining the whitening seed
201  */
202 #define REG_LR_WHITSEEDBASEADDR_MSB 0x06B8
203 #define REG_LR_WHITSEEDBASEADDR_LSB 0x06B9
204 
205 /*!
206  * \brief The address of the register holding the packet configuration
207  */
208 #define REG_LR_PACKETPARAMS 0x0704
209 
210 /*!
211  * \brief The address of the register holding the payload size
212  */
213 #define REG_LR_PAYLOADLENGTH 0x0702
214 
215 /*!
216  * \brief The addresses of the registers holding SyncWords values
217  */
218 #define REG_LR_SYNCWORDBASEADDRESS 0x06C0
219 
220 /*!
221  * \brief The addresses of the register holding LoRa Modem SyncWord value
222  */
223 #define REG_LR_SYNCWORD 0x0740
224 
225 /*!
226  * Syncword for Private LoRa networks
227  */
228 #define LORA_MAC_PRIVATE_SYNCWORD 0x1424
229 
230 /*!
231  * Syncword for Public LoRa networks
232  */
233 #define LORA_MAC_PUBLIC_SYNCWORD 0x3444
234 
235 /*!
236  * The address of the register giving a 4 bytes random number
237  */
238 #define RANDOM_NUMBER_GENERATORBASEADDR 0x0819
239 
240 /*!
241  * The address of the register holding RX Gain value (0x94: power saving, 0x96: rx boosted)
242  */
243 #define REG_RX_GAIN 0x08AC
244 
245 /*!
246  * The address of the register holding frequency error indication
247  */
248 #define REG_FREQUENCY_ERRORBASEADDR 0x076B
249 
250 /*!
251  * Change the value on the device internal trimming capacitor
252  */
253 #define REG_XTA_TRIM 0x0911
254 
255 /*!
256  * Set the current max value in the over current protection
257  */
258 #define REG_OCP 0x08E7
259 
260 
261 /*!
262  * \brief Represents the Rx internal counters values when GFSK or LoRa packet type is used
263  */
264 typedef struct {
265  radio_modems_t modem_type; //!< Packet to which the packet status are referring to.
266  uint16_t packet_received;
267  uint16_t crc_ok;
268  uint16_t length_error;
269 } rx_counter_t;
270 
271 /*!
272  * \brief Represents a calibration configuration
273  */
274 typedef union {
275  struct {
276  uint8_t rc64k_enable : 1; //!< Calibrate RC64K clock
277  uint8_t rc13m_enable : 1; //!< Calibrate RC13M clock
278  uint8_t pll_enable : 1; //!< Calibrate PLL
279  uint8_t adc_pulse_enable : 1; //!< Calibrate ADC Pulse
280  uint8_t adc_bulkN_enable : 1; //!< Calibrate ADC bulkN
281  uint8_t adc_bulkP_enable : 1; //!< Calibrate ADC bulkP
282  uint8_t img_enable : 1;
283  uint8_t pad : 1;
284  } fields;
285 
286  uint8_t value;
287 
289 
290 /*!
291  * \brief Represents the possible radio system error states
292  */
293 typedef union {
294  struct {
295  uint8_t rc64k_calib : 1; //!< RC 64kHz oscillator calibration failed
296  uint8_t rc13m_calib : 1; //!< RC 13MHz oscillator calibration failed
297  uint8_t pll_calib : 1; //!< PLL calibration failed
298  uint8_t adc_calib : 1; //!< ADC calibration failed
299  uint8_t img_calib : 1; //!< Image calibration failed
300  uint8_t xosc_start : 1; //!< XOSC oscillator failed to start
301  uint8_t pll_lock : 1; //!< PLL lock failed
302  uint8_t buck_start : 1; //!< Buck converter failed to start
303  uint8_t pa_ramp : 1; //!< PA ramp failed
304  uint8_t reserved : 7; //!< reserved
305  } fields;
306 
307  uint16_t value;
308 
309 } radio_error_t;
310 
311 /*!
312  * \brief Represents the operating mode the radio is actually running
313  */
314 typedef enum {
315  MODE_SLEEP = 0x00, //! The radio is in sleep mode
316  MODE_DEEP_SLEEP, //! The radio is in deep-sleep mode
317  MODE_STDBY_RC, //! The radio is in standby mode with RC oscillator
318  MODE_STDBY_XOSC, //! The radio is in standby mode with XOSC oscillator
319  MODE_FS, //! The radio is in frequency synthesis mode
320  MODE_TX, //! The radio is in transmit mode
321  MODE_RX, //! The radio is in receive mode
322  MODE_RX_DC, //! The radio is in receive duty cycle mode
323  MODE_CAD //! The radio is in channel activity detection mode
325 
326 /*!
327  * \brief Declares the oscillator in use while in standby mode
328  *
329  * Using the STDBY_RC standby mode allow to reduce the energy consumption
330  * STDBY_XOSC should be used for time critical applications
331  */
332 typedef enum {
333  STDBY_RC = 0x00,
334  STDBY_XOSC = 0x01,
336 
337 /*!
338  * \brief Declares the power regulation used to power the device
339  *
340  * This command allows the user to specify if DC-DC or LDO is used for power regulation.
341  * Using only LDO implies that the Rx or Tx current is doubled
342  */
343 typedef enum {
344  USE_LDO = 0x00, // default
345  USE_DCDC = 0x01,
347 
348 /*!
349  * \brief Represents the ramping time for power amplifier
350  */
351 typedef enum {
352  RADIO_RAMP_10_US = 0x00,
353  RADIO_RAMP_20_US = 0x01,
354  RADIO_RAMP_40_US = 0x02,
355  RADIO_RAMP_80_US = 0x03,
356  RADIO_RAMP_200_US = 0x04,
357  RADIO_RAMP_800_US = 0x05,
358  RADIO_RAMP_1700_US = 0x06,
359  RADIO_RAMP_3400_US = 0x07,
361 
362 /*!
363  * \brief Represents the number of symbols to be used for channel activity detection operation
364  */
365 typedef enum {
366  LORA_CAD_01_SYMBOL = 0x00,
367  LORA_CAD_02_SYMBOL = 0x01,
368  LORA_CAD_04_SYMBOL = 0x02,
369  LORA_CAD_08_SYMBOL = 0x03,
370  LORA_CAD_16_SYMBOL = 0x04,
372 
373 /*!
374  * \brief Represents the Channel Activity Detection actions after the CAD operation is finished
375  */
376 typedef enum {
377  LORA_CAD_ONLY = 0x00,
378  LORA_CAD_RX = 0x01,
379  LORA_CAD_LBT = 0x10,
381 
382 /*!
383  * \brief Represents the modulation shaping parameter
384  */
385 typedef enum {
386  MOD_SHAPING_OFF = 0x00,
387  MOD_SHAPING_G_BT_03 = 0x08,
388  MOD_SHAPING_G_BT_05 = 0x09,
389  MOD_SHAPING_G_BT_07 = 0x0A,
390  MOD_SHAPING_G_BT_1 = 0x0B,
392 
393 /*!
394  * \brief Represents the modulation shaping parameter
395  */
396 typedef enum {
397  RX_BW_4800 = 0x1F,
398  RX_BW_5800 = 0x17,
399  RX_BW_7300 = 0x0F,
400  RX_BW_9700 = 0x1E,
401  RX_BW_11700 = 0x16,
402  RX_BW_14600 = 0x0E,
403  RX_BW_19500 = 0x1D,
404  RX_BW_23400 = 0x15,
405  RX_BW_29300 = 0x0D,
406  RX_BW_39000 = 0x1C,
407  RX_BW_46900 = 0x14,
408  RX_BW_58600 = 0x0C,
409  RX_BW_78200 = 0x1B,
410  RX_BW_93800 = 0x13,
411  RX_BW_117300 = 0x0B,
412  RX_BW_156200 = 0x1A,
413  RX_BW_187200 = 0x12,
414  RX_BW_234300 = 0x0A,
415  RX_BW_312000 = 0x19,
416  RX_BW_373600 = 0x11,
417  RX_BW_467000 = 0x09,
419 
420 /*!
421  * \brief Represents the possible spreading factor values in LoRa packet types
422  */
423 typedef enum {
424  LORA_SF5 = 0x05,
425  LORA_SF6 = 0x06,
426  LORA_SF7 = 0x07,
427  LORA_SF8 = 0x08,
428  LORA_SF9 = 0x09,
429  LORA_SF10 = 0x0A,
430  LORA_SF11 = 0x0B,
431  LORA_SF12 = 0x0C,
433 
434 /*!
435  * \brief Represents the bandwidth values for LoRa packet type
436  */
437 typedef enum {
438  LORA_BW_500 = 6,
439  LORA_BW_250 = 5,
440  LORA_BW_125 = 4,
441  LORA_BW_062 = 3,
442  LORA_BW_041 = 10,
443  LORA_BW_031 = 2,
444  LORA_BW_020 = 9,
445  LORA_BW_015 = 1,
446  LORA_BW_010 = 8,
447  LORA_BW_007 = 0,
449 
450 const uint8_t lora_bandwidths [] = {LORA_BW_125, LORA_BW_250, LORA_BW_500};
451 
452 /*!
453  * \brief Represents the coding rate values for LoRa packet type
454  */
455 typedef enum {
456  LORA_CR_4_5 = 0x01,
457  LORA_CR_4_6 = 0x02,
458  LORA_CR_4_7 = 0x03,
459  LORA_CR_4_8 = 0x04,
461 
462 /*!
463  * \brief Represents the preamble length used to detect the packet on Rx side
464  */
465 typedef enum {
466  RADIO_PREAMBLE_DETECTOR_OFF = 0x00, //!< Preamble detection length off
467  RADIO_PREAMBLE_DETECTOR_08_BITS = 0x04, //!< Preamble detection length 8 bits
468  RADIO_PREAMBLE_DETECTOR_16_BITS = 0x05, //!< Preamble detection length 16 bits
469  RADIO_PREAMBLE_DETECTOR_24_BITS = 0x06, //!< Preamble detection length 24 bits
470  RADIO_PREAMBLE_DETECTOR_32_BITS = 0x07, //!< Preamble detection length 32 bit
472 
473 /*!
474  * \brief Represents the possible combinations of SyncWord correlators activated
475  */
476 typedef enum {
477  RADIO_ADDRESSCOMP_FILT_OFF = 0x00, //!< No correlator turned on, i.e. do not search for SyncWord
478  RADIO_ADDRESSCOMP_FILT_NODE = 0x01,
479  RADIO_ADDRESSCOMP_FILT_NODE_BROAD = 0x02,
481 
482 /*!
483  * \brief Radio packet length mode
484  */
485 typedef enum {
486  RADIO_PACKET_VARIABLE_LENGTH = 0x00, //!< The packet is on variable size, header included
487  RADIO_PACKET_FIXED_LENGTH = 0x01, //!< The packet is known on both sides, no header included in the packet
489 
490 /*!
491  * \brief Represents the CRC length
492  */
493 typedef enum radio_crc_types_e {
494  RADIO_CRC_OFF = 0x01, //!< No CRC in use
495  RADIO_CRC_1_BYTES = 0x00,
496  RADIO_CRC_2_BYTES = 0x02,
497  RADIO_CRC_1_BYTES_INV = 0x04,
498  RADIO_CRC_2_BYTES_INV = 0x06,
499  RADIO_CRC_2_BYTES_IBM = 0xF1,
500  RADIO_CRC_2_BYTES_CCIT = 0xF2,
502 
503 /*!
504  * \brief Radio whitening mode activated or deactivated
505  */
506 typedef enum {
507  RADIO_DC_FREE_OFF = 0x00,
508  RADIO_DC_FREEWHITENING = 0x01,
510 
511 /*!
512  * \brief Holds the lengths mode of a LoRa packet type
513  */
514 typedef enum {
515  LORA_PACKET_VARIABLE_LENGTH = 0x00, //!< The packet is on variable size, header included
516  LORA_PACKET_FIXED_LENGTH = 0x01, //!< The packet is known on both sides, no header included in the packet
517  LORA_PACKET_EXPLICIT = LORA_PACKET_VARIABLE_LENGTH,
518  LORA_PACKET_IMPLICIT = LORA_PACKET_FIXED_LENGTH,
520 
521 /*!
522  * \brief Represents the CRC mode for LoRa packet type
523  */
524 typedef enum {
525  LORA_CRC_ON = 0x01, //!< CRC activated
526  LORA_CRC_OFF = 0x00, //!< CRC not used
528 
529 /*!
530  * \brief Represents the IQ mode for LoRa packet type
531  */
532 typedef enum {
533  LORA_IQ_NORMAL = 0x00,
534  LORA_IQ_INVERTED = 0x01,
536 
537 /*!
538  * \brief Represents the volatge used to control the TCXO on/off from DIO3
539  */
540 typedef enum {
541  TCXO_CTRL_1_6V = 0x00,
542  TCXO_CTRL_1_7V = 0x01,
543  TCXO_CTRL_1_8V = 0x02,
544  TCXO_CTRL_2_2V = 0x03,
545  TCXO_CTRL_2_4V = 0x04,
546  TCXO_CTRL_2_7V = 0x05,
547  TCXO_CTRL_3_0V = 0x06,
548  TCXO_CTRL_3_3V = 0x07,
550 
551 /*!
552  * \brief Represents the interruption masks available for the radio
553  *
554  * \remark Note that not all these interruptions are available for all packet types
555  */
556 typedef enum {
557  IRQ_RADIO_NONE = 0x0000,
558  IRQ_TX_DONE = 0x0001,
559  IRQ_RX_DONE = 0x0002,
560  IRQ_PREAMBLE_DETECTED = 0x0004,
561  IRQ_SYNCWORD_VALID = 0x0008,
562  IRQ_HEADER_VALID = 0x0010,
563  IRQ_HEADER_ERROR = 0x0020,
564  IRQ_CRC_ERROR = 0x0040,
565  IRQ_CAD_DONE = 0x0080,
566  IRQ_CAD_ACTIVITY_DETECTED = 0x0100,
567  IRQ_RX_TX_TIMEOUT = 0x0200,
568  IRQ_RADIO_ALL = 0xFFFF,
570 
571 
572 /*!
573  * \brief Structure describing the radio status
574  */
575 typedef union {
576  uint8_t value;
577  struct {
578  //bit order is lsb -> msb
579  uint8_t reserved : 1; //!< Reserved
580  uint8_t cmd_status : 3; //!< Command status
581  uint8_t chip_mode : 3; //!< Chip mode
582  uint8_t cpu_busy : 1; //!< Flag for CPU radio busy
583  } fields;
585 
586 /*!
587  * \brief Structure describing the error codes for callback functions
588  */
589 typedef enum {
590  IRQ_HEADER_ERROR_CODE = 0x01,
591  IRQ_SYNCWORD_ERROR_CODE = 0x02,
592  IRQ_CRC_ERROR_CODE = 0x04,
593 } irq_error_t;
594 
595 
596 typedef enum {
597  IRQ_PBL_DETECT_CODE = 0x01,
598  IRQ_SYNCWORD_VALID_CODE = 0x02,
599  IRQ_HEADER_VALID_CODE = 0x04,
600 } irq_valid_codes_t;
601 
602 typedef enum {
603  IRQ_RX_TIMEOUT = 0x00,
604  IRQ_TX_TIMEOUT = 0x01,
605 } irq_timeout_t;
606 
607 typedef enum {
608  RECEPTION_MODE_SINGLE = 0,
609  RECEPTION_MODE_CONTINUOUS,
610  RECEPTION_MODE_OTHER
611 } reception_mode_t;
612 
613 /*!
614  * \brief The type describing the modulation parameters for every packet types
615  */
616 typedef struct {
617  radio_modems_t modem_type; //!< Packet to which the modulation parameters are referring to.
618  struct {
619  struct {
620  uint32_t bit_rate;
621  uint32_t fdev;
622  radio_mod_shaping_t modulation_shaping;
623  uint8_t bandwidth;
624  uint32_t operational_frequency;
625  } gfsk;
626 
627  struct {
628  lora_spread_factors_t spreading_factor; //!< Spreading Factor for the LoRa modulation
629  lora_bandwidths_t bandwidth; //!< Bandwidth for the LoRa modulation
630  lora_coding_states_t coding_rate; //!< Coding rate for the LoRa modulation
631  uint8_t low_datarate_optimization; //!< Indicates if the modem uses the low datarate optimization
632  uint32_t operational_frequency;
633  } lora;
634  } params; //!< Holds the modulation parameters structure
636 
637 /*!
638  * \brief The type describing the packet parameters for every packet types
639  */
640 typedef struct packet_params {
641  radio_modems_t modem_type; //!< Packet to which the packet parameters are referring to.
642  struct {
643  /*!
644  * \brief Holds the GFSK packet parameters
645  */
646  struct {
647  uint16_t preamble_length; //!< The preamble Tx length for GFSK packet type in bit
648  radio_preamble_detection_t preamble_min_detect; //!< The preamble Rx length minimal for GFSK packet type
649  uint8_t syncword_length; //!< The synchronization word length for GFSK packet type
650  radio_address_filter_t addr_comp; //!< Activated SyncWord correlators
651  radio_pkt_length_t header_type; //!< If the header is explicit, it will be transmitted in the GFSK packet. If the header is implicit, it will not be transmitted
652  uint8_t payload_length; //!< Size of the payload in the GFSK packet
653  radio_crc_types_t crc_length; //!< Size of the CRC block in the GFSK packet
654  radio_whitening_mode_t whitening_mode;
655  } gfsk;
656  /*!
657  * \brief Holds the LoRa packet parameters
658  */
659  struct {
660  uint16_t preamble_length; //!< The preamble length is the number of LoRa symbols in the preamble
661  lora_pkt_length_t header_type; //!< If the header is explicit, it will be transmitted in the LoRa packet. If the header is implicit, it will not be transmitted
662  uint8_t payload_length; //!< Size of the payload in the LoRa packet
663  lora_crc_mode_t crc_mode; //!< Size of CRC block in LoRa packet
664  lora_IQ_mode_t invert_IQ; //!< Allows to swap IQ for LoRa packet
665  } lora;
666  } params; //!< Holds the packet parameters structure
668 
669 /*!
670  * \brief Represents the packet status for every packet type
671  */
672 typedef struct {
673  radio_modems_t modem_type; //!< Packet to which the packet status are referring to.
674  struct {
675  struct {
676  uint8_t rx_status;
677  int8_t rssi_avg; //!< The averaged RSSI
678  int8_t rssi_sync; //!< The RSSI measured on last packet
679  uint32_t freq_error;
680  } gfsk;
681  struct {
682  int8_t rssi_pkt; //!< The RSSI of the last packet
683  int8_t snr_pkt; //!< The SNR of the last packet
684  int8_t signal_rssi_pkt;
685  uint32_t freq_error;
686  } lora;
687  } params;
689 
690 /*!
691  * \brief Radio driver internal state machine states definition
692  */
693 typedef enum {
694  RFSWITCH_RX = 0, //!< The radio is in RX
695  RFSWITCH_TX = 1 //!< The radio is in TX
696 } RFState_t;
697 
698 #endif /* MBED_LORA_RADIO_DRV_STM32WL_RADIO_DRIVER_H_ */
radio_irq_masks_t
Represents the interruption masks available for the radio.
Preamble detection length 32 bit.
struct packet_params::@49 params
Holds the packet parameters structure.
Preamble detection length 16 bits.
The type describing the packet parameters for every packet types.
Definition: sx126x_ds.h:581
radio_rx_bandwidth_t
Represents the modulation shaping parameter.
Represents a calibration configuration.
The packet is known on both sides, no header included in the packet.
The radio is in sleep mode.
Represents the possible radio system error states.
Definition: sx126x_ds.h:191
Preamble detection length 8 bits.
enum modem_type radio_modems_t
Type of modem.
lora_IQ_mode_t
Represents the IQ mode for LoRa packet type.
radio_crc_types_t crc_length
Size of the CRC block in the GFSK packet.
Definition: sx126x_ds.h:594
modem_type
Type of modem.
Definition: LoRaRadio.h:102
radio_ramp_time_t
Represents the ramping time for power amplifier.
The radio is in RX.
lora_crc_mode_t
Represents the CRC mode for LoRa packet type.
lora_spread_factors_t
Represents the possible spreading factor values in LoRa packet types.
Preamble detection length 24 bits.
radio_whitening_mode_t
Radio whitening mode activated or deactivated.
No correlator turned on, i.e. do not search for SyncWord.
The radio is in receive duty cycle mode.
radio_operating_mode_t
Represents the operating mode the radio is actually running.
lora_coding_states_t
Represents the coding rate values for LoRa packet type.
CRC activated.
CRC not used.
The radio is in frequency synthesis mode.
radio_TCXO_ctrl_voltage_t
Represents the volatge used to control the TCXO on/off from DIO3.
lora_cad_symbols_t
Represents the number of symbols to be used for channel activity detection operation.
Represents the packet status for every packet type.
Definition: sx126x_ds.h:613
cad_exit_modes_t
Represents the Channel Activity Detection actions after the CAD operation is finished.
lora_bandwidths_t
Represents the bandwidth values for LoRa packet type.
radio_mod_shaping_t
Represents the modulation shaping parameter.
struct packet_params::@49::@51 lora
Holds the LoRa packet parameters.
radio_address_filter_t
Represents the possible combinations of SyncWord correlators activated.
uint8_t syncword_length
The synchronization word length for GFSK packet type.
Definition: sx126x_ds.h:590
lora_coding_states_t coding_rate
Coding rate for the LoRa modulation.
lora_IQ_mode_t invert_IQ
Allows to swap IQ for LoRa packet.
Definition: sx126x_ds.h:605
radio_pkt_length_t header_type
If the header is explicit, it will be transmitted in the GFSK packet. If the header is implicit...
Definition: sx126x_ds.h:592
The packet is known on both sides, no header included in the packet.
The radio is in standby mode with RC oscillator.
The radio is in TX.
The radio is in deep-sleep mode.
enum radio_crc_types_e radio_crc_types_t
Represents the CRC length.
uint16_t preamble_length
The preamble Tx length for GFSK packet type in bit.
Definition: sx126x_ds.h:588
No CRC in use.
The radio is in receive mode.
Preamble detection length off.
radio_preamble_detection_t
Represents the preamble length used to detect the packet on Rx side.
struct packet_params::@49::@50 gfsk
Holds the GFSK packet parameters.
uint8_t payload_length
Size of the payload in the GFSK packet.
Definition: sx126x_ds.h:593
RFState_t
Radio driver internal state machine states definition.
radio_regulator_mode_t
Declares the power regulation used to power the device.
struct packet_params packet_params_t
The type describing the packet parameters for every packet types.
radio_pkt_length_t
Radio packet length mode.
The radio is in transmit mode.
The packet is on variable size, header included.
lora_crc_mode_t crc_mode
Size of CRC block in LoRa packet.
Definition: sx126x_ds.h:604
radio_address_filter_t addr_comp
Activated SyncWord correlators.
Definition: sx126x_ds.h:591
radio_preamble_detection_t preamble_min_detect
The preamble Rx length minimal for GFSK packet type.
Definition: sx126x_ds.h:589
irq_error_t
Structure describing the error codes for callback functions.
The packet is on variable size, header included.
lora_pkt_length_t
Holds the lengths mode of a LoRa packet type.
radio_modems_t modem_type
Packet to which the packet parameters are referring to.
Definition: sx126x_ds.h:582
radio_standby_mode_t
Declares the oscillator in use while in standby mode.
The radio is in standby mode with XOSC oscillator.
Represents the Rx internal counters values when GFSK or LoRa packet type is used. ...
Definition: sx126x_ds.h:162
Structure describing the radio status.
Definition: sx126x_ds.h:516
The type describing the modulation parameters for every packet types.
Definition: sx126x_ds.h:557
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.