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