Skip to content

Commit 65259a5

Browse files
committed
v4.1.0
* HAL: Reworked "Listen-Before-Talk" feature to have more flexibility to define LBT channels frequency, and to be able to have spectral scan running in parallel * HAL: Updated lgw_time_on_air() function for FSK packets * HAL: Disabled GPS UART input being re-echoed as output to avoid sending wrong commands to GPS module * HAL: Fixed IF frequency configuration check issue for channel bandwidths 250K and 500HKz. * FPGA: Updated to v33 for new LBT and and v31 for spectral scan. * util_spectral_scan: updated to match new spectral scan FPGA sequence * util_lbt_test: updated to match LBT rework Note: The provided LBT feature has been validated for Japan only, and supports 8 downlink channels maximum.
1 parent a67c7d5 commit 65259a5

35 files changed

+7506
-1076
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@ all:
1010
$(MAKE) all -e -C libloragw
1111
$(MAKE) all -e -C util_pkt_logger
1212
$(MAKE) all -e -C util_spi_stress
13-
$(MAKE) all -e -C util_lbt_test
1413
$(MAKE) all -e -C util_tx_test
14+
$(MAKE) all -e -C util_lbt_test
1515
$(MAKE) all -e -C util_tx_continuous
1616
$(MAKE) all -e -C util_spectral_scan
1717

1818
clean:
1919
$(MAKE) clean -e -C libloragw
2020
$(MAKE) clean -e -C util_pkt_logger
2121
$(MAKE) clean -e -C util_spi_stress
22-
$(MAKE) clean -e -C util_lbt_test
2322
$(MAKE) clean -e -C util_tx_test
23+
$(MAKE) clean -e -C util_lbt_test
2424
$(MAKE) clean -e -C util_tx_continuous
2525
$(MAKE) clean -e -C util_spectral_scan
2626

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.0.0
1+
4.1.0
-31.5 KB
Binary file not shown.
-31.5 KB
Binary file not shown.

fpga/SX1301_FPGA_200K_NOTCH_LBT_SPECTRAL_SCAN_863_v33.hex

Lines changed: 1659 additions & 0 deletions
Large diffs are not rendered by default.

fpga/SX1301_FPGA_200K_NOTCH_LBT_SPECTRAL_SCAN_915_v33.hex

Lines changed: 1659 additions & 0 deletions
Large diffs are not rendered by default.

fpga/SX1301_FPGA_NOTCH_PROG_SPECTRAL_SCAN_v31.hex

Lines changed: 1659 additions & 0 deletions
Large diffs are not rendered by default.

fpga/readme.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,19 @@ Reference Design board (SX1301AP2-PCB_E336) flash memory.
1616

1717
The different images contain the following features:
1818

19-
* SX1301_FPGA_125K_NOTCH_LBT_bitmap_v27.bin:
20-
- 125K Notch filter for TX
21-
- Listen-Before-Talk
19+
* SX1301_FPGA_200K_NOTCH_LBT_SPECTRAL_SCAN_863_v33.hex:
20+
- 200KHz Notch filter for TX (not programmable)
21+
- Listen-Before-Talk for 863+MHz frequency range
22+
- Background Spectral Scan (limited)
2223

23-
* SX1301_FPGA_125K_NOTCH_SPECTRAL_SCAN_bitmap_v27.bin:
24-
- 125K Notch filter for TX
25-
- Background Spectral Scan
24+
* SX1301_FPGA_200K_NOTCH_LBT_SPECTRAL_SCAN_915_v33.hex:
25+
- 200KHz Notch filter for TX (not programmable)
26+
- Listen-Before-Talk for 915+MHz frequency range
27+
- Background Spectral Scan (limited)
28+
29+
* SX1301_FPGA_NOTCH_PROG_SPECTRAL_SCAN_v31.hex:
30+
- Programmable notch filter for TX
31+
- Background Spectral Scan (full)
2632

2733
2. Usage
2834
--------

libloragw/inc/loragw_fpga.h

Lines changed: 44 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -31,41 +31,60 @@ Maintainer: Michael Coracin
3131
#define LGW_REG_SUCCESS 0
3232
#define LGW_REG_ERROR -1
3333

34+
#define LGW_MIN_NOTCH_FREQ 126000U /* 126 KHz */
35+
#define LGW_MAX_NOTCH_FREQ 250000U /* 250 KHz */
36+
#define LGW_DEFAULT_NOTCH_FREQ 129000U /* 129 KHz */
37+
3438
/*
3539
auto generated register mapping for C code
3640
this file contains autogenerated C struct used to access the FPGA registers
3741
this file is autogenerated from registers description
3842
*/
43+
3944
#define LGW_FPGA_SOFT_RESET 0
40-
#define LGW_FPGA_FPGA_FEATURE 1
41-
#define LGW_FPGA_VERSION 2
42-
#define LGW_FPGA_FPGA_STATUS 3
43-
#define LGW_FPGA_CTRL_FEATURE_START 4
44-
#define LGW_FPGA_CTRL_RADIO_RESET 5
45-
#define LGW_FPGA_CTRL_INPUT_SYNC_I 6
46-
#define LGW_FPGA_CTRL_INPUT_SYNC_Q 7
47-
#define LGW_FPGA_CTRL_OUTPUT_SYNC 8
48-
#define LGW_FPGA_CTRL_INVERT_IQ 9
49-
#define LGW_FPGA_HISTO_RAM_ADDR 10
50-
#define LGW_FPGA_HISTO_RAM_DATA 11
51-
#define LGW_FPGA_HISTO_TEMPO 12
52-
#define LGW_FPGA_HISTO_NB_READ 13
53-
#define LGW_FPGA_TIMESTAMP 14
54-
#define LGW_FPGA_LBT_TIMESTAMP_CH 15
55-
#define LGW_FPGA_LBT_TIMESTAMP_SELECT_CH 16
56-
#define LGW_FPGA_LBT_TIMESTAMP_NB_CH 17
57-
#define LGW_FPGA_SPI_MASTER_SPEED_DIVIDER 18
58-
#define LGW_FPGA_NB_READ_RSSI 19
59-
#define LGW_FPGA_PLL_LOCK_TIME 20
60-
#define LGW_FPGA_RSSI_TARGET 21
61-
#define LGW_FPGA_LSB_START_FREQ 22
62-
#define LGW_FPGA_SPI_MUX_CTRL 23
63-
#define LGW_FPGA_TOTALREGS 24
45+
#define LGW_FPGA_FEATURE 1
46+
#define LGW_FPGA_LBT_INITIAL_FREQ 2
47+
#define LGW_FPGA_VERSION 3
48+
#define LGW_FPGA_STATUS 4
49+
#define LGW_FPGA_CTRL_FEATURE_START 5
50+
#define LGW_FPGA_CTRL_RADIO_RESET 6
51+
#define LGW_FPGA_CTRL_INPUT_SYNC_I 7
52+
#define LGW_FPGA_CTRL_INPUT_SYNC_Q 8
53+
#define LGW_FPGA_CTRL_OUTPUT_SYNC 9
54+
#define LGW_FPGA_CTRL_INVERT_IQ 10
55+
#define LGW_FPGA_CTRL_ACCESS_HISTO_MEM 11
56+
#define LGW_FPGA_CTRL_CLEAR_HISTO_MEM 12
57+
#define LGW_FPGA_HISTO_RAM_ADDR 13
58+
#define LGW_FPGA_HISTO_RAM_DATA 14
59+
#define LGW_FPGA_HISTO_NB_READ 15
60+
#define LGW_FPGA_LBT_TIMESTAMP_CH 16
61+
#define LGW_FPGA_LBT_TIMESTAMP_SELECT_CH 17
62+
#define LGW_FPGA_LBT_CH0_FREQ_OFFSET 18
63+
#define LGW_FPGA_LBT_CH1_FREQ_OFFSET 19
64+
#define LGW_FPGA_LBT_CH2_FREQ_OFFSET 20
65+
#define LGW_FPGA_LBT_CH3_FREQ_OFFSET 21
66+
#define LGW_FPGA_LBT_CH4_FREQ_OFFSET 22
67+
#define LGW_FPGA_LBT_CH5_FREQ_OFFSET 23
68+
#define LGW_FPGA_LBT_CH6_FREQ_OFFSET 24
69+
#define LGW_FPGA_LBT_CH7_FREQ_OFFSET 25
70+
#define LGW_FPGA_SCAN_FREQ_OFFSET 26
71+
#define LGW_FPGA_LBT_SCAN_TIME_CH0 27
72+
#define LGW_FPGA_LBT_SCAN_TIME_CH1 28
73+
#define LGW_FPGA_LBT_SCAN_TIME_CH2 29
74+
#define LGW_FPGA_LBT_SCAN_TIME_CH3 30
75+
#define LGW_FPGA_LBT_SCAN_TIME_CH4 31
76+
#define LGW_FPGA_LBT_SCAN_TIME_CH5 32
77+
#define LGW_FPGA_LBT_SCAN_TIME_CH6 33
78+
#define LGW_FPGA_LBT_SCAN_TIME_CH7 34
79+
#define LGW_FPGA_RSSI_TARGET 35
80+
#define LGW_FPGA_HISTO_SCAN_FREQ 36
81+
#define LGW_FPGA_NOTCH_FREQ_OFFSET 37
82+
#define LGW_FPGA_TOTALREGS 38
6483

6584
/* -------------------------------------------------------------------------- */
6685
/* --- PUBLIC FUNCTIONS PROTOTYPES ------------------------------------------ */
6786

68-
int lgw_fpga_configure(void);
87+
int lgw_fpga_configure(uint32_t tx_notch_freq);
6988

7089
/**
7190
@brief LoRa concentrator FPGA register write

libloragw/inc/loragw_hal.h

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Maintainer: Sylvain Miermont
6060
/* concentrator chipset-specific parameters */
6161
/* to use array parameters, declare a local const and use 'if_chain' as index */
6262
#define LGW_IF_CHAIN_NB 10 /* number of IF+modem RX chains */
63-
#define LGW_PKT_FIFO_SIZE 8 /* depth of the RX packet FIFO */
63+
#define LGW_PKT_FIFO_SIZE 16 /* depth of the RX packet FIFO */
6464
#define LGW_DATABUFF_SIZE 1024 /* size in bytes of the RX data buffer (contains payload & metadata) */
6565
#define LGW_REF_BW 125000 /* typical bandwidth of data channel */
6666
#define LGW_MULTI_NB 8 /* number of LoRa 'multi SF' chains */
@@ -152,6 +152,9 @@ Maintainer: Sylvain Miermont
152152
/* Maximum size of Tx gain LUT */
153153
#define TX_GAIN_LUT_SIZE_MAX 16
154154

155+
/* LBT constants */
156+
#define LBT_CHANNEL_FREQ_NB 8 /* Number of LBT channels */
157+
155158
/* -------------------------------------------------------------------------- */
156159
/* --- PUBLIC TYPES --------------------------------------------------------- */
157160

@@ -172,34 +175,42 @@ enum lgw_radio_type_e {
172175
@brief Configuration structure for board specificities
173176
*/
174177
struct lgw_conf_board_s {
175-
bool lorawan_public; /*!> Enable ONLY for *public* networks using the LoRa MAC protocol */
176-
uint8_t clksrc; /*!> Index of RF chain which provides clock to concentrator */
178+
bool lorawan_public; /*!> Enable ONLY for *public* networks using the LoRa MAC protocol */
179+
uint8_t clksrc; /*!> Index of RF chain which provides clock to concentrator */
180+
};
181+
182+
/**
183+
@struct lgw_conf_lbt_chan_s
184+
@brief Configuration structure for LBT channels
185+
*/
186+
struct lgw_conf_lbt_chan_s {
187+
uint32_t freq_hz;
188+
uint16_t scan_time_us;
177189
};
178190

179191
/**
180192
@struct lgw_conf_lbt_s
181193
@brief Configuration structure for LBT specificities
182194
*/
183195
struct lgw_conf_lbt_s {
184-
bool enable; /*!> enable or disable LBT */
185-
uint8_t rssi_target; /*!> RSSI threshold to detect if channel is busy or not */
186-
uint8_t nb_channel; /*!> number of LBT channels */
187-
uint16_t scan_time_us; /*!> channel activity scan duration, in microseconds */
188-
uint32_t start_freq; /*!> first LBT channel frequency */
189-
uint32_t tx_delay_1ch_us; /*!> maximum time allowed to send a packet since channel was free, when TX is on one channel only */
190-
uint32_t tx_delay_2ch_us; /*!> maximum time allowed to send a packet since channel was free, when TX is on two channels */
196+
bool enable; /*!> enable or disable LBT */
197+
int8_t rssi_target; /*!> RSSI threshold to detect if channel is busy or not (dBm) */
198+
uint8_t nb_channel; /*!> number of LBT channels */
199+
struct lgw_conf_lbt_chan_s channels[LBT_CHANNEL_FREQ_NB];
200+
int8_t rssi_offset; /*!> RSSI offset to be applied to SX127x RSSI values */
191201
};
192202

193203
/**
194204
@struct lgw_conf_rxrf_s
195205
@brief Configuration structure for a RF chain
196206
*/
197207
struct lgw_conf_rxrf_s {
198-
bool enable; /*!> enable or disable that RF chain */
199-
uint32_t freq_hz; /*!> center frequency of the radio in Hz */
200-
float rssi_offset; /*!> Board-specific RSSI correction factor */
201-
enum lgw_radio_type_e type; /*!> Radio type for that RF chain (SX1255, SX1257....) */
202-
bool tx_enable; /*!> enable or disable TX on that RF chain */
208+
bool enable; /*!> enable or disable that RF chain */
209+
uint32_t freq_hz; /*!> center frequency of the radio in Hz */
210+
float rssi_offset; /*!> Board-specific RSSI correction factor */
211+
enum lgw_radio_type_e type; /*!> Radio type for that RF chain (SX1255, SX1257....) */
212+
bool tx_enable; /*!> enable or disable TX on that RF chain */
213+
uint32_t tx_notch_freq; /*!> TX notch filter frequency [126KHz..250KHz] */
203214
};
204215

205216
/**
@@ -385,10 +396,9 @@ const char* lgw_version_info(void);
385396
/**
386397
@brief Return time on air of given packet, in milliseconds
387398
@param packet is a pointer to the packet structure
388-
@param isBeacon indicates if the packet is a beacon or not
389399
@return the packet time on air in milliseconds
390400
*/
391-
uint32_t lgw_time_on_air(struct lgw_pkt_tx_s *packet, bool isBeacon);
401+
uint32_t lgw_time_on_air(struct lgw_pkt_tx_s *packet);
392402

393403
#endif
394404

0 commit comments

Comments
 (0)