This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
wiki:scan [2018/08/23 11:25] ghi [Example] |
— (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> | ||
- | |||
- | 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. | ||
- | <code> | ||
- | root@klk-lpbs-04018B:/user/rootfs_rw/var/log/bnm # lldrwxr-xr-x 2 root root 4.0K Feb 20 15:41 | ||
- | .drwxr-xr-x 3 root root 4.0K Feb 20 15:40 ..-rw-r--r-- 1 root root 317 Feb 20 15:41 | ||
- | bnm_slot2_radio1_180220154120.csv-rw-r--r-- 1 root root 324 Feb 20 15:41 | ||
- | bnm_slot2_radio2_180220154120.csv-rw-r--r-- 1 root root 331 Feb 20 15:41 | ||
- | bnm_slot3_radio1_180220154120.csv-rw-r--r-- 1 root root 352 Feb 20 15:41 | ||
- | bnm_slot3_radio2_180220154120.csv-rw-r--r-- 1 root root 337 Feb 20 15:41 | ||
- | bnm_slot4_radio1_180220154120.csv-rw-r--r-- 1 root root 322 Feb 20 15:41 | ||
- | </code> | ||
- | |||
- | In this example, three LoRa modules are connected. For each LoRa module the spectral scan is done for the channel 1 and for the channel 2. | ||
- | |||
- | <code> | ||
- | bnm_slot2_radio1_180220154120.csv-rw-r--r-- 1 root root 324 Feb 20 15:41 | ||
- | </code> | ||
- | |||
- | === Interpret the result === | ||
- | |||
- | This file is the result of the spectral scan analysis on the LoRa module located in slot 2 and for the radio channel 1. \\ | ||
- | |||
- | 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 863 MHz and the stop frequency 873 MHz. | ||
- | Thus 220 samples are measured. Former measurements are backuped in the directory ''/user/rootfs_rw/var/backups/bnm''. | ||
- | |||
- | <code> | ||
- | root@klk-lpbs-04018B:/user/rootfs_rw/var/log/bnm # cat bnm_slot2_radio1_180220154120.csv | ||
- | 863000000,-125,4,-124,15,-123,1 | ||
- | 864000000,-115,3,-114,13,-113,4 | ||
- | 865000000,-124,3,-123,17 | ||
- | 866000000,-124,18,-123,2 | ||
- | 867000000,-126,2,-125,7,-124,11 | ||
- | 868000000,-126,14,-125,6 | ||
- | 869000000,-127,1,-126,12,-125,6,-124,1 | ||
- | 870000000,-127,1,-126,14,-125,5 | ||
- | 871000000,-126,18,-125,2 | ||
- | 872000000,-127,3,-126,17 | ||
- | 873000000,-127,8,-126,12 | ||
- | root@klk-lpbs-04018B:/user/rootfs_rw/var/log/bnm # | ||
- | </code> | ||
- | |||
- | In the above result 20 measures has been done for 863 MHz frequency. 4 times the result was -125 dBm, 15 times -124 dBm and 1 time -123 dBm. | ||
- | |||
- | ==== Known issues ==== | ||
- | |||
- | The number of steps is limited to 255. Mind that the step number must be below that limit. Ajustments are possible by configuring ''START_FREQ_MHZ'', ''STOP_FREQ_MHZ'' and ''STEP_FREQ_MHZ''. | ||
- | |||
- | <ifauth @admin,@klk> | ||
- | ===== Manuel radio scanning ===== | ||
- | |||
- | 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 of 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 Wirnet™ iBTS) | ||
- | |||
- | <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> |