This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
wiki:scan [2019/01/08 14:56] hch |
— (current) | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Radio scanning ====== | ||
- | ===== Boot Noise Measurment ===== | ||
- | |||
- | The ''BNM'', which stand for Boot Noise Measurement, initiates a spectral scan at startup. | ||
- | |||
- | ==== The BNM files ==== | ||
- | |||
- | <code> | ||
- | / | ||
- | ├── etc | ||
- | │ ├── bnm | ||
- | │ │ ├── bnm-868.conf # The board configuration file. | ||
- | │ │ │ | ||
- | │ │ └── bnm.conf # The global configuration file. | ||
- | │ │ | ||
- | │ ├── init.d | ||
- | │ │ └── bnm # The startup script. | ||
- | │ │ | ||
- | │ └── rc5.d | ||
- | │ └── S55bnm -> ../init.d/bnm # The BNM is started whith runlevel 5. | ||
- | │ | ||
- | ├── usr | ||
- | │ ├── bin | ||
- | │ │ └── klk_spectral_scan # The utility which run the spectral scan. | ||
- | │ │ | ||
- | │ └── share | ||
- | │ └── bnm | ||
- | │ ├── bnm-868.conf # The default board configuration files. | ||
- | │ ├── bnm-915.conf # These files define the min and max frequencies | ||
- | │ ├── bnm-923.conf # to scan. | ||
- | │ │ | ||
- | │ └── klk-loraloc-v1.0.6.kbin # The needed loraloc firmware. | ||
- | │ | ||
- | └── var | ||
- | ├── backups | ||
- | │ └── bnm | ||
- | │ ├── bnm.0.tar.gz # The backup files. Every output files are included | ||
- | │ └── bnm.1.tar.gz # in these files. Backup files are rotated by size. | ||
- | └── log | ||
- | └── bnm | ||
- | ├── bnm_slot1_radio1_180219155423.csv # The last output files. There is one for each slot | ||
- | └── bnm_slot1_radio2_180219155423.csv # and for each radio. | ||
- | </code> | ||
- | |||
- | ==== Configure BNM ==== | ||
- | |||
- | These parameters can be changed by the user in the global configuration file ''/etc/bnm/bnm.conf''. | ||
- | The BNM feature takes some time when the gateway is booting. To avoid Boot Noise Measurement, disable it in this file (Set ''disable'' in the field ''BNM_ENABLE''). \\ | ||
- | The default configuration is the following. | ||
- | |||
- | <file bash bnm.conf> | ||
- | # BNM is executed at boot. | ||
- | BNM_ENABLE="enable" | ||
- | |||
- | # Radio configuration. | ||
- | STEP_FREQ_MHZ=1 | ||
- | BANDWIDTH_HZ=62500 | ||
- | BITRATE_BPS=600 | ||
- | RADIO_NB="1 2" | ||
- | |||
- | # Number of samples by frequency. | ||
- | SAMPLES_NB=20 | ||
- | |||
- | # Additional arguments for klk_spectral_scan. | ||
- | ADDITIONAL_ARGS="--strip-zero" | ||
- | |||
- | # Number of seconds before scans timeout. | ||
- | TIMEOUT_SEC=90 | ||
- | |||
- | # Backup size in bytes. | ||
- | BACKUP_SIZE=102400 | ||
- | </file> | ||
- | //''RADIO_NB'' parameter is only available for Wirnet iBTS as this gateway owns 2 LoRa modems per LoRa module (until 4 LoRa modules). On Wirnet iFemtoCell, there is only one LoRa modem and no LoRa module.//\\ | ||
- | \\ | ||
- | The start frequency and the stop frequency are defined in the default board configuration file. The board configuration file name changes according to the region. | ||
- | |||
- | <file bash bnm-868.conf> | ||
- | # Radio configuration. | ||
- | START_FREQ_MHZ=853 | ||
- | STOP_FREQ_MHZ=883 | ||
- | </file> | ||
- | |||
- | ==== Example ==== | ||
- | |||
- | === The BNM is launched at startup === | ||
- | <code> | ||
- | Starting BNM... done | ||
- | Starting ifplugd: done | ||
- | Starting Status manager | ||
- | Starting System manager | ||
- | Starting Time manager | ||
- | Starting SMS manager | ||
- | Starting Lighttpd Web Server: lighttpd. | ||
- | Starting MonitStarting Monit 5.20.0 daemon with http interface at [localhost]:2812 | ||
- | . | ||
- | Starting network management services: snmpd. | ||
- | Executing network monitoring daemon... | ||
- | Keros (Kerlink OS Distribution) 4.0.2 klk-lpbs-050789 /dev/console | ||
- | klk-lpbs-050789 login: root | ||
- | </code> | ||
- | |||
- | === Get the result === | ||
- | The result of the measurement is available in the ''/var/log/bnm/'' folder. | ||
- | |||
- | * __Wirnet iBTS example:__<code> | ||
- | root@klk-lpbs-XXXXXX:/ # ll /var/log/bnm/ | ||
- | drwxr-xr-x 2 root root 4.0K Aug 23 09:20 . | ||
- | drwxr-xr-x 3 root root 4.0K Aug 23 09:19 .. | ||
- | -rw-r--r-- 1 root root 1.0K Aug 23 09:20 bnm_slot2_radio1_180823091951.csv | ||
- | -rw-r--r-- 1 root root 1.0K Aug 23 09:20 bnm_slot2_radio2_180823091951.csv | ||
- | </code> | ||
- | In this example, one LoRa module is connected. For each LoRa module, the spectral scan is done for the channel 1 and for the channel 2. \\ | ||
- | To configure the BNM to scan only one channel modify the field ''RADIO_NB="1 2"''. \\ | ||
- | ''RADIO_NB="1"'': Only channel 1 will be scan.\\ | ||
- | ''RADIO_NB="2"'': Only channel 2 will be scan. | ||
- | |||
- | * __Wirnet iFemtoCell example:__<code> | ||
- | root@klk-wifc-XXXXXX:~ # ll /var/log/bnm/ | ||
- | drwxr-xr-x 2 root root 4.0K Jan 8 10:38 . | ||
- | drwxr-xr-x 3 root root 4.0K Jan 8 10:38 .. | ||
- | -rw-r--r-- 1 root root 1.6K Jan 8 10:39 bnm_190108103858.csv | ||
- | </code> | ||
- | |||
- | === Interpret the result === | ||
- | |||
- | The following is the result of the spectral scan analysis on a Wirnet iBTS on the LoRa module located in slot 2 and for the radio channel 2. \\ | ||
- | |||
- | The default configuration uses frequency steps of 1MHz on a 62500Hz bandwidth. \\ | ||
- | For each frequency, 20 samples are taken. For 868 MHz gateway, the start frequency is 853 MHz and the stop frequency 883 MHz. | ||
- | Thus 620 samples are measured. Former measurements are backuped in the directory ''/var/backups/bnm''. | ||
- | |||
- | <code> | ||
- | root@klk-lpbs-XXXXXXcat :~ # cat /var/log/bnm/bnm_slot2_radio2_180823093716.csv | ||
- | 853000000,-129.0,1,-128.0,6,-127.0,13 | ||
- | 854000000,-128.0,3,-127.0,14,-126.0,3 | ||
- | 855000000,-128.0,1,-127.0,13,-126.0,6 | ||
- | 856000000,-127.0,2,-126.0,16,-125.0,2 | ||
- | 857000000,-127.0,9,-126.0,11 | ||
- | 858000000,-127.0,2,-126.0,18 | ||
- | 859000000,-126.0,14,-125.0,6 | ||
- | 860000000,-125.0,9,-124.0,11 | ||
- | 861000000,-125.0,4,-124.0,16 | ||
- | 862000000,-125.0,1,-124.0,16,-123.0,3 | ||
- | 863000000,-125.0,1,-124.0,16,-123.0,3 | ||
- | 864000000,-116.0,3,-115.0,10,-114.0,7 | ||
- | 865000000,-124.0,1,-123.0,15,-122.0,4 | ||
- | 866000000,-123.0,8,-122.0,11,-121.0,1 | ||
- | 867000000,-124.0,13,-123.0,7 | ||
- | 868000000,-125.0,2,-124.0,10,-123.0,8 | ||
- | 869000000,-126.0,1,-125.0,8,-124.0,11 | ||
- | 870000000,-126.0,1,-125.0,5,-124.0,14 | ||
- | 871000000,-126.0,2,-125.0,13,-124.0,5 | ||
- | 872000000,-126.0,2,-125.0,5,-124.0,12,-123.0,1 | ||
- | 873000000,-126.0,19,-125.0,1 | ||
- | 874000000,-127.0,1,-126.0,18,-125.0,1 | ||
- | 875000000,-127.0,19,-126.0,1 | ||
- | 876000000,-128.0,8,-127.0,12 | ||
- | 877000000,-129.0,2,-128.0,10,-127.0,8 | ||
- | 878000000,-128.0,11,-127.0,9 | ||
- | 879000000,-128.0,13,-127.0,7 | ||
- | 880000000,-124.0,11,-123.0,9 | ||
- | 881000000,-128.0,12,-127.0,8 | ||
- | 882000000,-128.0,7,-127.0,13 | ||
- | 883000000,-128.0,11,-127.0,9 | ||
- | </code> | ||
- | |||
- | In the above result, 20 measures have been done for 863 MHz frequency. 1 time the result was -125 dBm, 16 times -124 dBm and 3 times -123 dBm. | ||
- | |||
- | |||
- | ==== Known issues ==== | ||
- | |||
- | * The number of frequency steps is limited to 255. Mind that the step number must be below that limit. Adjustments are possible by configuring ''START_FREQ_MHZ'', ''STOP_FREQ_MHZ'' and ''STEP_FREQ_MHZ''. | ||
- | * BNM frequency configuration files depending on the board (''bnm-868.conf'', ''bnm-923.conf'', ''bnm-915.conf'') are not kept by default when upgrading the gateway. These files are not written in ''sysupgrade.conf'' and must be added if necessary. | ||
- | |||
- | |||
- | <ifauth @admin,@klk> | ||
- | ===== Manuel radio scanning (for Wirnet iBTS only) ===== | ||
- | |||
- | LOC modules (used to send/receive LoRa RF) contain a chip (sx1239) used as a radio scanner. | ||
- | |||
- | To use this radio scanner, the first step is to connect to the sx1239 through the ''microcom'' serial terminal. | ||
- | |||
- | The path of the sx1239 can be retrieved in the ''/tmp/sys_startup_status.json'' json file in the ''acm_path'' field. Depending on the gateway used, up to 4 paths can be present on it. | ||
- | |||
- | <code bash> | ||
- | $ grep acm_path /tmp/sys_startup_status.json | ||
- | "acm_path": "/dev/slot/2/ttyACM", | ||
- | "acm_path": "/dev/slot/3/ttyACM", | ||
- | </code> | ||
- | |||
- | Once the slot of a modem is identified, the serial port can be opened with the ''microcom'' command, with one of the previously displayed paths as parameter. To log the traces of the ''microcom'' command, a pipe to the ''tee'' command is used. | ||
- | |||
- | <code bash> | ||
- | $ microcom /dev/slot/2/ttyACM | tee /tmp/spectral_scan.log | ||
- | </code> | ||
- | |||
- | The command to start a spectrum scanning is ''sx1239'', with the following parameters: | ||
- | * scan mode: need to be fl | ||
- | * number of paths: need to be 1 for Lora Dual modem | ||
- | * start frequency in Hertz | ||
- | * stop frequency in Hertz (a maximum bandwidth of 15MHz between the start and stop frequencies can be used) | ||
- | * frequency step in Hertz (should be 62500) | ||
- | * frequency bandwidth in Hertz (should be 62500) | ||
- | * bitrate (should be 600) | ||
- | * loop number, set to 0 for an infinite scanning | ||
- | |||
- | <code bash> | ||
- | $ sx1239 fl 1 863000000 865000000 62500 62500 600 10 | ||
- | 0:0:7C7C7B7B7B7C7C7A7B7B7A7B7B7B7B7B797B7A7A7B7A7A7A7A7A7A7B7C7B7B7B7B | ||
- | 0:216:7C7B7C7B7C7C7B7B7B7B7B7B7B7B7B7A747B7B7A7A7B7B7A7A7A7A7A7A7B7B7A7A | ||
- | 0:216:7B7C7B7B7B7B7B7B7B7B7B7B7B7A7B7B7A7A7A7A7A7A7A7A7A7A7A7B7A7B7B7B7B | ||
- | 0:216:7B7B7B7A7B7C7B7B7B7B7A7B7A7B7C7B757A7A7B7A7A7B7A7A7A7A7B7B7B7B7B7C | ||
- | 0:216:7B7B7B7C7C7B7C7A7B7B7B7B7B7C7A7B7A7B7B7A7B7A7A7A7A7A7A7A7A7A7B7A7B | ||
- | 0:216:7B7C7B7B7B7B7B7A7B7B7B7A7B7B7B7B777A7A7B7B7B7B7B7A7A7A7A7A7A7A7B7B | ||
- | 0:216:7B7B7B7B7B7B7C7B7B7B7A7B7B7C7B7B767A7A7A7B7A7A7A7A7A7B7A7B7A7C7B7B | ||
- | 0:216:7B7C7B7B7C7B7B7B7B7B7B7B7C7A7B7B767A7B7B7B7A7A7A7A7A7A7B7B7A7B7B7A | ||
- | 0:216:7C7C7B7C7B7B7C7B7B7C7B7B7A7B7B7B777A7A7B7A7A7A7B7B7A7B7B7B7A7B7B7B | ||
- | 0:216:7B7A7A7B7C7C7C7A7B7B7C7C7B7A7A7B797B7A7B7C7A7A7A7B7A7B7A7A7A7A7A7B | ||
- | |||
- | #press ctrl+x to exit microcom | ||
- | </code> | ||
- | |||
- | The spectrum data are returned line by line. Each line corresponds to a complete scan of the band. The format is ASCII and respects the following protocol: | ||
- | |||
- | <code> | ||
- | [PATH] : [DURATION] : [DATA] [END] | ||
- | </code> | ||
- | |||
- | Where : | ||
- | * [PATH] : radio path number : 0 or 1 (always 0 for Lora Dual modem) | ||
- | * [DURATION] : duration of the scan of the full band expressed in milli-seconds coded as a decimal | ||
- | * [DATA] : N x data coded as hexascii between 00 and FF, it expresses the opposite of the received power (-RSSI) | ||
- | * [END] : synchro character: \r\n (0x0D 0x0A) | ||
- | |||
- | The following command is an example of how to convert the raw data contained in the ''spectral_scan.log'' file to decimal RSSI values in dBm. (it requires gawk, therefore, it cannot be directly used on the gateway). | ||
- | |||
- | <code bash> | ||
- | $ grep "0:" spectral_scan.log | sed 's/^[\0-9]:[0-9]*://g' | sed 's/.\{2\}/& /g' | awk --non-decimal-data '{for(i=1;i<=NF;i++) $i=sprintf("%d","0x"$i)}1' | sed 's/\([0-9]\+\)/-\1/g' | ||
- | -124 -124 -123 -123 -123 -124 -124 -122 -123 -123 -122 -123 -123 -123 -123 -123 -121 -123 -122 -122 -123 -122 -122 -122 -122 -122 -122 -123 -124 -123 -123 -123 -123 | ||
- | -124 -123 -124 -123 -124 -124 -123 -123 -123 -123 -123 -123 -123 -123 -123 -122 -116 -123 -123 -122 -122 -123 -123 -122 -122 -122 -122 -122 -122 -123 -123 -122 -122 | ||
- | -123 -124 -123 -123 -123 -123 -123 -123 -123 -123 -123 -123 -123 -122 -123 -123 -122 -122 -122 -122 -122 -122 -122 -122 -122 -122 -122 -123 -122 -123 -123 -123 -123 | ||
- | -123 -123 -123 -122 -123 -124 -123 -123 -123 -123 -122 -123 -122 -123 -124 -123 -117 -122 -122 -123 -122 -122 -123 -122 -122 -122 -122 -123 -123 -123 -123 -123 -124 | ||
- | -123 -123 -123 -124 -124 -123 -124 -122 -123 -123 -123 -123 -123 -124 -122 -123 -122 -123 -123 -122 -123 -122 -122 -122 -122 -122 -122 -122 -122 -122 -123 -122 -123 | ||
- | -123 -124 -123 -123 -123 -123 -123 -122 -123 -123 -123 -122 -123 -123 -123 -123 -119 -122 -122 -123 -123 -123 -123 -123 -122 -122 -122 -122 -122 -122 -122 -123 -123 | ||
- | -123 -123 -123 -123 -123 -123 -124 -123 -123 -123 -122 -123 -123 -124 -123 -123 -118 -122 -122 -122 -123 -122 -122 -122 -122 -122 -123 -122 -123 -122 -124 -123 -123 | ||
- | -123 -124 -123 -123 -124 -123 -123 -123 -123 -123 -123 -123 -124 -122 -123 -123 -118 -122 -123 -123 -123 -122 -122 -122 -122 -122 -122 -123 -123 -122 -123 -123 -122 | ||
- | -124 -124 -123 -124 -123 -123 -124 -123 -123 -124 -123 -123 -122 -123 -123 -123 -119 -122 -122 -123 -122 -122 -122 -123 -123 -122 -123 -123 -123 -122 -123 -123 -123 | ||
- | -123 -122 -122 -123 -124 -124 -124 -122 -123 -123 -124 -124 -123 -122 -122 -123 -121 -123 -122 -123 -124 -122 -122 -122 -123 -122 -123 -122 -122 -122 -122 -122 -123 | ||
- | </code> | ||
- | |||
- | |||
- | |||
- | </ifauth> |