====== Radio scanning =======
See [[wiki:lora:scan|Radio scanning]] for generic radio features.
===== Manual 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.
$ grep acm_path /tmp/sys_startup_status.json
"acm_path": "/dev/slot/2/ttyACM",
"acm_path": "/dev/slot/3/ttyACM",
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.
$ microcom /dev/slot/2/ttyACM | tee /tmp/spectral_scan.log
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
$ 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
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:
[PATH] : [DURATION] : [DATA] [END]
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)
$ 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