* Added missing LICENSE.TXT file
* HAL & Packet Forwarder: added support for sx1250-based reference design for
CN490 region
* Packet Forwarder: disabled beaconing by default
This commit is contained in:
Michael Coracin 2019-11-22 16:08:34 +01:00
commit 81e748c904
23 changed files with 306 additions and 48 deletions

View file

@ -170,12 +170,13 @@ struct lgw_rssi_tcomp_s {
@brief Configuration structure for a RF chain
*/
struct lgw_conf_rxrf_s {
bool enable; /*!> enable or disable that RF chain */
uint32_t freq_hz; /*!> center frequency of the radio in Hz */
float rssi_offset; /*!> Board-specific RSSI correction factor */
struct lgw_rssi_tcomp_s rssi_tcomp; /*!> Board-specific RSSI temperature compensation coefficients */
lgw_radio_type_t type; /*!> Radio type for that RF chain (SX1255, SX1257....) */
bool tx_enable; /*!> enable or disable TX on that RF chain */
bool enable; /*!> enable or disable that RF chain */
uint32_t freq_hz; /*!> center frequency of the radio in Hz */
float rssi_offset; /*!> Board-specific RSSI correction factor */
struct lgw_rssi_tcomp_s rssi_tcomp; /*!> Board-specific RSSI temperature compensation coefficients */
lgw_radio_type_t type; /*!> Radio type for that RF chain (SX1255, SX1257....) */
bool tx_enable; /*!> enable or disable TX on that RF chain */
bool single_input_mode; /*!> Configure the radio in single or differential input mode (SX1250 only) */
};
/**

View file

@ -95,7 +95,7 @@ int sx1250_write_command(uint8_t rf_chain, sx1250_op_code_t op_code, uint8_t *da
int sx1250_read_command(uint8_t rf_chain, sx1250_op_code_t op_code, uint8_t *data, uint16_t size);
int sx1250_calibrate(uint8_t rf_chain, uint32_t freq_hz);
int sx1250_setup(uint8_t rf_chain, uint32_t freq_hz);
int sx1250_setup(uint8_t rf_chain, uint32_t freq_hz, bool single_input_mode);
#endif

View file

@ -362,7 +362,18 @@ To debug your application, it might help to compile the loragw_hal function
with the debug messages activated (set DEBUG_HAL=1 in library.cfg).
It then send a lot of details, including detailed error messages to *stderr*.
## 6. License
## 6. Notes
### 6.1. Spreading factor SF5 & SF6
The sx1302 supports SF5 and SF6 spreading factors, and the HAL also. But it is
important to note that the only syncword supported for SF5 and SF6 is 0x12
(also known as "private").
This is true whatever how of the "lorawan_public" field of lgw_conf_board_s is
set.
## 7. License
Copyright (c) 2019, SEMTECH S.A.
All rights reserved.

View file

@ -291,13 +291,15 @@ int lgw_rxrf_setconf(uint8_t rf_chain, struct lgw_conf_rxrf_s * conf) {
CONTEXT_RF_CHAIN[rf_chain].rssi_tcomp.coeff_e = conf->rssi_tcomp.coeff_e;
CONTEXT_RF_CHAIN[rf_chain].type = conf->type;
CONTEXT_RF_CHAIN[rf_chain].tx_enable = conf->tx_enable;
CONTEXT_RF_CHAIN[rf_chain].single_input_mode = conf->single_input_mode;
DEBUG_PRINTF("Note: rf_chain %d configuration; en:%d freq:%d rssi_offset:%f radio_type:%d tx_enable:%d\n", rf_chain,
DEBUG_PRINTF("Note: rf_chain %d configuration; en:%d freq:%d rssi_offset:%f radio_type:%d tx_enable:%d single_input_mode:%d\n", rf_chain,
CONTEXT_RF_CHAIN[rf_chain].enable,
CONTEXT_RF_CHAIN[rf_chain].freq_hz,
CONTEXT_RF_CHAIN[rf_chain].rssi_offset,
CONTEXT_RF_CHAIN[rf_chain].type,
CONTEXT_RF_CHAIN[rf_chain].tx_enable);
CONTEXT_RF_CHAIN[rf_chain].tx_enable,
CONTEXT_RF_CHAIN[rf_chain].single_input_mode);
return LGW_HAL_SUCCESS;
}
@ -594,7 +596,7 @@ int lgw_start(void) {
sx1302_radio_reset(i, CONTEXT_RF_CHAIN[i].type);
switch (CONTEXT_RF_CHAIN[i].type) {
case LGW_RADIO_TYPE_SX1250:
sx1250_setup(i, CONTEXT_RF_CHAIN[i].freq_hz);
sx1250_setup(i, CONTEXT_RF_CHAIN[i].freq_hz, CONTEXT_RF_CHAIN[i].single_input_mode);
break;
case LGW_RADIO_TYPE_SX1255:
case LGW_RADIO_TYPE_SX1257:

View file

@ -198,7 +198,7 @@ int sx1250_calibrate(uint8_t rf_chain, uint32_t freq_hz) {
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
int sx1250_setup(uint8_t rf_chain, uint32_t freq_hz) {
int sx1250_setup(uint8_t rf_chain, uint32_t freq_hz, bool single_input_mode) {
int32_t freq_reg;
uint8_t buff[16];
@ -297,6 +297,15 @@ int sx1250_setup(uint8_t rf_chain, uint32_t freq_hz) {
buff[2] = 0xFF;
sx1250_write_command(rf_chain, SET_RX, buff, 3); /* Rx Continuous */
/* Select single input or differential input mode */
if (single_input_mode == true) {
printf("INFO: Configuring SX1250_%u in single input mode\n", rf_chain);
buff[0] = 0x08;
buff[1] = 0xE2;
buff[2] = 0x0D;
sx1250_write_command(rf_chain, WRITE_REGISTER, buff, 3);
}
buff[0] = 0x05;
buff[1] = 0x87;
buff[2] = 0x0B;

View file

@ -103,6 +103,7 @@ void usage(void) {
printf(" -k <uint> Concentrator clock source (Radio A or Radio B) [0..1]\n");
printf(" -c <uint> RF chain to be used for TX (Radio A or Radio B) [0..1]\n");
printf(" -r <uint> Radio type (1255, 1257, 1250)\n");
printf(" -j Set radio in single input mode (SX1250 only)\n");
printf(" -f <float> Radio TX frequency in MHz\n");
printf( "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" );
printf(" --pa <uint> PA gain [0..3]\n");
@ -465,6 +466,7 @@ int main(int argc, char **argv)
uint8_t clocksource = 0;
uint8_t rf_chain = 0;
lgw_radio_type_t radio_type = LGW_RADIO_TYPE_NONE;
bool single_input_mode = false;
struct lgw_conf_board_s boardconf;
struct lgw_conf_rxrf_s rfconf;
@ -490,7 +492,7 @@ int main(int argc, char **argv)
};
/* parse command line options */
while ((i = getopt_long (argc, argv, "hf:k:r:c:d:", long_options, &option_index)) != -1) {
while ((i = getopt_long (argc, argv, "hjf:k:r:c:d:", long_options, &option_index)) != -1) {
switch (i) {
case 'h':
usage();
@ -543,6 +545,10 @@ int main(int argc, char **argv)
}
break;
case 'j':
single_input_mode = true;
break;
case 'f': /* <float> Radio TX frequency in MHz */
i = sscanf(optarg, "%lf", &arg_d);
if (i != 1) {
@ -616,6 +622,7 @@ int main(int argc, char **argv)
rfconf.freq_hz = ft;
rfconf.type = radio_type;
rfconf.tx_enable = true;
rfconf.single_input_mode = single_input_mode;
if (lgw_rxrf_setconf(0, &rfconf) != LGW_HAL_SUCCESS) {
printf("ERROR: failed to configure rxrf 0\n");
return EXIT_FAILURE;
@ -626,6 +633,7 @@ int main(int argc, char **argv)
rfconf.freq_hz = ft;
rfconf.type = radio_type;
rfconf.tx_enable = true;
rfconf.single_input_mode = single_input_mode;
if (lgw_rxrf_setconf(1, &rfconf) != LGW_HAL_SUCCESS) {
printf("ERROR: failed to configure rxrf 1\n");
return EXIT_FAILURE;

View file

@ -196,7 +196,7 @@ int main(int argc, char **argv)
sx1302_radio_reset(i, rf_radio_type[i]);
switch (radio_type) {
case LGW_RADIO_TYPE_SX1250:
sx1250_setup(i, rf_rx_freq[i]);
sx1250_setup(i, rf_rx_freq[i], false);
break;
case LGW_RADIO_TYPE_SX1255:
case LGW_RADIO_TYPE_SX1257:

View file

@ -192,6 +192,7 @@ int main(int argc, char **argv)
rfconf.freq_hz = fa;
rfconf.type = radio_type;
rfconf.tx_enable = false;
rfconf.single_input_mode = false;
if (lgw_rxrf_setconf(0, &rfconf) != LGW_HAL_SUCCESS) {
printf("ERROR: failed to configure rxrf 0\n");
return EXIT_FAILURE;
@ -202,6 +203,7 @@ int main(int argc, char **argv)
rfconf.freq_hz = fb;
rfconf.type = radio_type;
rfconf.tx_enable = false;
rfconf.single_input_mode = false;
if (lgw_rxrf_setconf(1, &rfconf) != LGW_HAL_SUCCESS) {
printf("ERROR: failed to configure rxrf 1\n");
return EXIT_FAILURE;
@ -235,6 +237,7 @@ int main(int argc, char **argv)
lgw_get_trigcnt(&counter);
}
wait_ms(10);
printf("%u\n", counter);
}
/* Stop the gateway */

View file

@ -286,6 +286,7 @@ int main(int argc, char **argv)
rfconf.rssi_offset = 0.0;
rfconf.type = radio_type;
rfconf.tx_enable = false;
rfconf.single_input_mode = false;
if (lgw_rxrf_setconf(0, &rfconf) != LGW_HAL_SUCCESS) {
printf("ERROR: failed to configure rxrf 0\n");
return EXIT_FAILURE;
@ -297,6 +298,7 @@ int main(int argc, char **argv)
rfconf.rssi_offset = 0.0;
rfconf.type = radio_type;
rfconf.tx_enable = false;
rfconf.single_input_mode = false;
if (lgw_rxrf_setconf(1, &rfconf) != LGW_HAL_SUCCESS) {
printf("ERROR: failed to configure rxrf 1\n");
return EXIT_FAILURE;

View file

@ -67,15 +67,16 @@ static void sig_handler(int sigio) {
void usage(void) {
//printf("Library version information: %s\n", lgw_version_info());
printf( "Available options:\n");
printf( " -h print this help\n");
printf( " -k <uint> Concentrator clock source (Radio A or Radio B) [0..1]\n");
printf( " -r <uint> Radio type (1255, 1257, 1250)\n");
printf( " -a <float> Radio A RX frequency in MHz\n");
printf( " -b <float> Radio B RX frequency in MHz\n");
printf( " -n <uint> Number of packet received with CRC OK for each HAL start/stop loop\n");
printf( " -z <uint> Size of the RX packet array to be passed to lgw_receive()\n");
printf( " -m <uint> Channel frequency plan mode [0:LoRaWAN-like, 1:Same frequency for all channels (-400000Hz on RF0)]\n");
printf("Available options:\n");
printf(" -h print this help\n");
printf(" -k <uint> Concentrator clock source (Radio A or Radio B) [0..1]\n");
printf(" -r <uint> Radio type (1255, 1257, 1250)\n");
printf(" -a <float> Radio A RX frequency in MHz\n");
printf(" -b <float> Radio B RX frequency in MHz\n");
printf(" -n <uint> Number of packet received with CRC OK for each HAL start/stop loop\n");
printf(" -z <uint> Size of the RX packet array to be passed to lgw_receive()\n");
printf(" -m <uint> Channel frequency plan mode [0:LoRaWAN-like, 1:Same frequency for all channels (-400000Hz on RF0)]\n");
printf(" -j Set radio in single input mode (SX1250 only)\n");
}
/* -------------------------------------------------------------------------- */
@ -97,6 +98,7 @@ int main(int argc, char **argv)
uint8_t clocksource = 0;
lgw_radio_type_t radio_type = LGW_RADIO_TYPE_NONE;
uint8_t max_rx_pkt = 16;
bool single_input_mode = false;
struct lgw_conf_board_s boardconf;
struct lgw_conf_rxrf_s rfconf;
@ -136,7 +138,7 @@ int main(int argc, char **argv)
const uint8_t channel_rfchain_mode1[9] = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
/* parse command line options */
while ((i = getopt (argc, argv, "ha:b:k:r:n:z:m:")) != -1) {
while ((i = getopt (argc, argv, "hja:b:k:r:n:z:m:")) != -1) {
switch (i) {
case 'h':
usage();
@ -170,6 +172,9 @@ int main(int argc, char **argv)
clocksource = (uint8_t)arg_u;
}
break;
case 'j': /* Set radio in single input mode */
single_input_mode = true;
break;
case 'a': /* <float> Radio A RX frequency in MHz */
i = sscanf(optarg, "%lf", &arg_d);
if (i != 1) {
@ -250,6 +255,7 @@ int main(int argc, char **argv)
rfconf.freq_hz = fa;
rfconf.type = radio_type;
rfconf.tx_enable = false;
rfconf.single_input_mode = single_input_mode;
if (lgw_rxrf_setconf(0, &rfconf) != LGW_HAL_SUCCESS) {
printf("ERROR: failed to configure rxrf 0\n");
return EXIT_FAILURE;
@ -260,6 +266,7 @@ int main(int argc, char **argv)
rfconf.freq_hz = fb;
rfconf.type = radio_type;
rfconf.tx_enable = false;
rfconf.single_input_mode = single_input_mode;
if (lgw_rxrf_setconf(1, &rfconf) != LGW_HAL_SUCCESS) {
printf("ERROR: failed to configure rxrf 1\n");
return EXIT_FAILURE;

View file

@ -80,6 +80,7 @@ void usage(void) {
printf(" -t <uint> TX mode timestamped with delay in ms. If delay is 0, TX mode GPS trigger\n");
printf(" -p <int> RF power in dBm\n");
printf(" -i Send LoRa packet using inverted modulation polarity\n");
printf(" -j Set radio in single input mode (SX1250 only)\n");
printf( "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" );
printf(" --pa <uint> PA gain SX125x:[0..3], SX1250:[0,1]\n");
printf(" --dig <uint> sx1302 digital gain for sx125x [0..3]\n");
@ -131,6 +132,7 @@ int main(int argc, char **argv)
uint16_t preamble = 8;
bool invert_pol = false;
bool no_header = false;
bool single_input_mode = false;
struct lgw_conf_board_s boardconf;
struct lgw_conf_rxrf_s rfconf;
@ -165,7 +167,7 @@ int main(int argc, char **argv)
};
/* parse command line options */
while ((i = getopt_long (argc, argv, "hif:s:b:n:z:p:k:r:c:l:t:m:o:q:d:", long_options, &option_index)) != -1) {
while ((i = getopt_long (argc, argv, "hjif:s:b:n:z:p:k:r:c:l:t:m:o:q:d:", long_options, &option_index)) != -1) {
switch (i) {
case 'h':
usage();
@ -174,6 +176,9 @@ int main(int argc, char **argv)
case 'i': /* Send packet using inverted modulation polarity */
invert_pol = true;
break;
case 'j': /* Set radio in single input mode */
single_input_mode = true;
break;
case 'r': /* <uint> Radio type */
i = sscanf(optarg, "%u", &arg_u);
if ((i != 1) || ((arg_u != 1255) && (arg_u != 1257) && (arg_u != 1250))) {
@ -424,9 +429,10 @@ int main(int argc, char **argv)
memset( &rfconf, 0, sizeof rfconf);
rfconf.enable = true; /* rf chain 0 needs to be enabled for calibration to work on sx1257 */
rfconf.freq_hz = 868500000; /* dummy */
rfconf.freq_hz = ft;
rfconf.type = radio_type;
rfconf.tx_enable = true;
rfconf.single_input_mode = single_input_mode;
if (lgw_rxrf_setconf(0, &rfconf) != LGW_HAL_SUCCESS) {
printf("ERROR: failed to configure rxrf 0\n");
return EXIT_FAILURE;
@ -434,9 +440,10 @@ int main(int argc, char **argv)
memset( &rfconf, 0, sizeof rfconf);
rfconf.enable = (((rf_chain == 1) || (clocksource == 1)) ? true : false);
rfconf.freq_hz = 868500000; /* dummy */
rfconf.freq_hz = ft;
rfconf.type = radio_type;
rfconf.tx_enable = false;
rfconf.single_input_mode = single_input_mode;
if (lgw_rxrf_setconf(1, &rfconf) != LGW_HAL_SUCCESS) {
printf("ERROR: failed to configure rxrf 1\n");
return EXIT_FAILURE;