LoRa Spectral Scan
To answer my own question about LoRaWan Gateway not picking up general LoRa packets, I thought it might to be useful to get a utility in the gateway library called spectral scan working (see setup instructions). Turns out it's also a configuration to scan in the packet forwarder code too, set to false in the json config.
I tried a bunch of things and found out a lot, but no dice:
~cd LR1302_loraWAN/LR1302_HAL/sx1302_hal/util_spectral_scan
./spectral_scan
==
== Spectral Scan: freq_hz=863100000Hz, nb_channels=35, nb_scan=2000, rssi_offset=-11dB
==
CoreCell reset through GPIO17...
SX1261 reset through GPIO17...
CoreCell power enable through GPIO18...
CoreCell ADC reset through GPIO13...
Opening SPI communication interface
Note: chip version is 0x10 (v1.0)
INFO: using legacy timestamp
ARB: dual demodulation disabled for all SF
INFO: found temperature sensor on port 0x39
ERROR: sx1261_check_status: SX1261 status is not as expected: got:0x00 expected:0x22
ERROR: sx1261_load_pram: SX1261 status error
ERROR: failed to patch sx1261 radio for LBT/Spectral Scan
ERROR: failed to start the gateway
Digging a little deeper
$ ./test_loragw_com_sx1250
CoreCell reset through GPIO17...
SX1261 reset through GPIO17...
CoreCell power enable through GPIO18...
CoreCell ADC reset through GPIO13...
Opening SPI communication interface
Note: chip version is 0x10 (v1.0)
Radio0: get_status: 0x32
Radio1: get_status: 0x32
Cycle 0 > did a 4-byte R/W on a register with no error
Cycle 1 > did a 4-byte R/W on a register with no error
Cycle 2 > did a 4-byte R/W on a register with no error
Cycle 3 > did a 4-byte R/W on a register with no error
Cycle 4 > did a 4-byte R/W on a register with no error
...
but!
$ ./test_loragw_com_sx1261
CoreCell reset through GPIO17...
SX1261 reset through GPIO17...
CoreCell power enable through GPIO18...
CoreCell ADC reset through GPIO13...
Opening SPI communication interface
Note: chip version is 0x10 (v1.0)
SX1261: get_status: 0x00
Cycle 0 > error during the buffer comparison
Written value: 67C66973
Read value: 00000000
So I think what's happening is that it can't write to /dev/spidev0.1
for whatever reason, in order to use the SX1261 radio to do a scan (which you should be able to do through /dev/spidev0.1
even while accessing packets on /dev/spidev0.0
)
Things I learned:
- if you're running a Pi3 you need disable bluetooth for reasons. Not on a Pi4 though.
- You can get the chip id for a concentrator EUI for LoRaWan like this:
./chip_id
- A load of SPI / Pi stuff that doesn't seem to have any bearing on the matter
- SPI and Pi hats is a bit knackered in Bookworm, but not Bullseye (I didn't dig into this, there are workarounds by the look of it)
- Here's a handy way of seeing what's using your GPIOs:
sudo cat /sys/kernel/debug/gpio
- Here's another handy command
raspi-gpio get 7-21
- The software claims to only work on 32bit OS but people have it working on 64 bit (not tried this)
- It seems like it it ought to be a reset pin issue but changing it (from 5 to 22 or 25) didn't make a difference