summaryrefslogtreecommitdiff
path: root/util_tx_test
diff options
context:
space:
mode:
authorSylvain Miermont <smiermont@semtech.com>2015-02-05 15:03:10 +0100
committerSylvain Miermont <smiermont@semtech.com>2015-02-05 15:03:10 +0100
commitbe5c8ac770bc5b142e2c6a47702d9ac653141371 (patch)
tree37f69650eb68db46e127aa7fbcc62f68150778bc /util_tx_test
parent23127d92c2c2cbef1b870686c4fc2dd5ba05daec (diff)
downloadlora_gateway-be5c8ac770bc5b142e2c6a47702d9ac653141371.tar.gz
lora_gateway-be5c8ac770bc5b142e2c6a47702d9ac653141371.tar.bz2
lora_gateway-be5c8ac770bc5b142e2c6a47702d9ac653141371.zip
v1.7.0v1.7.0
- Added TX “start delay” compensation for timestamp mode (fix time window alignment issue at low SF and/or high BW) - Added adaptive narrowband/wideband TX filtering for LoRa - Added a command-line option to set CR in util_tx_test - Added notes for TX “start delay” in immediate and triggered mode /!\ warning: due to start delay compensation being implemented, TX that were previously 1.5ms late will be sent on time. At low datarate, this is not an issue. At high LoRa data rate (and FSK) you might have to adjust your timing.
Diffstat (limited to 'util_tx_test')
-rw-r--r--util_tx_test/readme.md22
-rw-r--r--util_tx_test/src/util_tx_test.c59
2 files changed, 55 insertions, 26 deletions
diff --git a/util_tx_test/readme.md b/util_tx_test/readme.md
index 5450f18..9fb7b22 100644
--- a/util_tx_test/readme.md
+++ b/util_tx_test/readme.md
@@ -41,30 +41,38 @@ Press Ctrl+C to stop the application before that.
Use the -f option followed by a real number (decimal point and scientific
'E notation' are OK) to specify the modulation central frequency.
+Use the -b option to set LoRa modulation bandwidth in kHz (accepted values: 125,
+250 or 500).
+
Use the -s option to specify the Spreading Factor of LoRa modulation (values 7
to 12 are valid).
-Use the -b option to set LoRa modulation bandwidth in kHz (accepted values: 125,
-250 or 500).
+Use the -c option to specify the Coding Rate of LoRa modulation ( 1 = 4/5, 2 =
+4/6, 3 = 4/7, 4 = 4/8 ).
Use the -p option to set the concentrator TX power in dBm. Not all values are
supported by hardware (typically 14 et 20 dBm are supported, other values might
not give expected power). Check with a RF power meter before connecting any
sensitive equipment.
+Use the -r option to set LoRa preamble size. A minimum preamble length of 6
+symbols is enforced.
+
+Use the -z option to set the payload size in bytes.
+
Use the -t option to specify the number of milliseconds of pause between
packets. Using zero will result in a quasi-continuous emission.
-Use the -x option to specify how many packets should be sent.
+Use the -x option to specify how many packets should be sent. The value -1 cause
+the program to send packet indefinitely, until stopped (using Ctrl-C).
Use the -i option to invert the LoRa modulation polarity.
-The packets are 20 bytes long, and protected by the smallest supported ECC.
-
The payload content is:
[T][E][S][T][packet counter MSB][packet counter LSB] followed by ASCII padding.
-All LoRa data is whitened, so the padding has no influence whatsoever on the
-packet error rate.
+
+All LoRa data is scrambled and whitened, so the padding has no influence
+whatsoever on the packet error rate.
4. License
-----------
diff --git a/util_tx_test/src/util_tx_test.c b/util_tx_test/src/util_tx_test.c
index bb7672b..e684d07 100644
--- a/util_tx_test/src/util_tx_test.c
+++ b/util_tx_test/src/util_tx_test.c
@@ -79,17 +79,18 @@ static void sig_handler(int sigio) {
/* describe command line options */
void usage(void) {
printf("*** Library version information ***\n%s\n\n", lgw_version_info());
- printf( "Available options:\n");
- printf( " -h print this help\n");
- printf( " -f <float> target frequency in MHz\n");
- printf( " -s <uint> Spreading Factor\n");
- printf( " -b <uint> Modulation bandwidth in kHz\n");
- printf( " -p <int> RF power (dBm)\n");
- printf( " -r <uint> LoRa preamble length (symbols)\n");
- printf( " -z <uint> payload size (bytes)\n");
- printf( " -t <uint> pause between packets (ms)\n");
- printf( " -x <int> numbers of times the sequence is repeated (-1 for continuous)\n");
- printf( " -i send packet using inverted modulation polarity \n");
+ printf("Available options:\n");
+ printf(" -h print this help\n");
+ printf(" -f <float> target frequency in MHz\n");
+ printf(" -b <uint> LoRa bandwidth in kHz [125, 250, 500]\n");
+ printf(" -s <uint> LoRa Spreading Factor [7-12]\n");
+ printf(" -c <uint> LoRa Coding Rate [1-4]\n");
+ printf(" -p <int> RF power (dBm)\n");
+ printf(" -r <uint> LoRa preamble length (symbols)\n");
+ printf(" -z <uint> payload size (bytes, <256)\n");
+ printf(" -t <uint> pause between packets (ms)\n");
+ printf(" -x <int> nb of times the sequence is repeated (-1 loop until stopped)\n");
+ printf(" -i send packet using inverted modulation polarity\n");
}
/* -------------------------------------------------------------------------- */
@@ -109,6 +110,7 @@ int main(int argc, char **argv)
/* application parameters */
uint32_t f_target = lowfreq[RF_CHAIN]/2 + upfreq[RF_CHAIN]/2; /* target frequency */
int sf = 10; /* SF10 by default */
+ int cr = 1; /* CR1 aka 4/5 by default */
int bw = 125; /* 125kHz bandwidth by default */
int pow = 14; /* 14 dBm by default */
int preamb = 8; /* 8 symbol preamble by default */
@@ -127,7 +129,7 @@ int main(int argc, char **argv)
uint16_t cycle_count = 0;
/* parse command line options */
- while ((i = getopt (argc, argv, "hf:s:b:p:r:z:t:x:i")) != -1) {
+ while ((i = getopt (argc, argv, "hf:b:s:c:p:r:z:t:x:i")) != -1) {
switch (i) {
case 'h':
usage();
@@ -145,6 +147,17 @@ int main(int argc, char **argv)
}
break;
+ case 'b': /* -b <int> Modulation bandwidth in kHz */
+ i = sscanf(optarg, "%i", &xi);
+ if ((i != 1) || ((xi != 125)&&(xi != 250)&&(xi != 500))) {
+ MSG("ERROR: invalid LoRa bandwidth\n");
+ usage();
+ return EXIT_FAILURE;
+ } else {
+ bw = xi;
+ }
+ break;
+
case 's': /* -s <int> Spreading Factor */
i = sscanf(optarg, "%i", &xi);
if ((i != 1) || (xi < 7) || (xi > 12)) {
@@ -156,14 +169,14 @@ int main(int argc, char **argv)
}
break;
- case 'b': /* -b <int> Modulation bandwidth in kHz */
+ case 'c': /* -c <int> Coding Rate */
i = sscanf(optarg, "%i", &xi);
- if ((i != 1) || ((xi != 125)&&(xi != 250)&&(xi != 500))) {
- MSG("ERROR: invalid LoRa bandwidth\n");
+ if ((i != 1) || (xi < 1) || (xi > 4)) {
+ MSG("ERROR: invalid coding rate\n");
usage();
return EXIT_FAILURE;
} else {
- bw = xi;
+ cr = xi;
}
break;
@@ -240,7 +253,7 @@ int main(int argc, char **argv)
MSG("ERROR: frequency out of authorized band (accounting for modulation bandwidth)\n");
return EXIT_FAILURE;
}
- printf("Sending %i packets on %u Hz (BW %i kHz, SF %i, %i bytes payload, %i symbols preamble) at %i dBm, with %i ms between each\n", repeat, f_target, bw, sf, pl_size, preamb, pow, delay);
+ printf("Sending %i packets on %u Hz (BW %i kHz, SF %i, CR %i, %i bytes payload, %i symbols preamble) at %i dBm, with %i ms between each\n", repeat, f_target, bw, sf, cr, pl_size, preamb, pow, delay);
/* configure signal handling */
sigemptyset(&sigact.sa_mask);
@@ -286,11 +299,19 @@ int main(int argc, char **argv)
MSG("ERROR: invalid 'sf' variable\n");
return EXIT_FAILURE;
}
- txpkt.coderate = CR_LORA_4_5;
+ switch (cr) {
+ case 1: txpkt.coderate = CR_LORA_4_5; break;
+ case 2: txpkt.coderate = CR_LORA_4_6; break;
+ case 3: txpkt.coderate = CR_LORA_4_7; break;
+ case 4: txpkt.coderate = CR_LORA_4_8; break;
+ default:
+ MSG("ERROR: invalid 'cr' variable\n");
+ return EXIT_FAILURE;
+ }
txpkt.invert_pol = invert;
txpkt.preamble = preamb;
txpkt.size = pl_size;
- strcpy((char *)txpkt.payload, "TEST**abcdefghijklmnopqrstuvwxyz0123456789" ); /* abc.. is for padding */
+ strcpy((char *)txpkt.payload, "TEST**abcdefghijklmnopqrstuvwxyz#0123456789#ABCDEFGHIJKLMNOPQRSTUVWXYZ#0123456789#abcdefghijklmnopqrstuvwxyz#0123456789#ABCDEFGHIJKLMNOPQRSTUVWXYZ#0123456789#abcdefghijklmnopqrstuvwxyz#0123456789#ABCDEFGHIJKLMNOPQRSTUVWXYZ#0123456789#abcdefghijklmnopqrs#" ); /* abc.. is for padding */
/* main loop */
cycle_count = 0;