This is a LoRaWAN v1.0 implementation in python for the Dragino LoRa/GPS HAT, it is currently being used to connect to the things network https://thethingsnetwork.org. It is based on work at https://github.com/jeroennijhof/LoRaWAN
It uses https://github.com/mayeranalytics/pySX127x.
See: https://www.lora-alliance.org/portals/0/specs/LoRaWAN%20Specification%201R0.pdf
sudo apt install device-tree-compiler git python3-crypto python3-nmea2 python3-rpi.gpio python3-serial python3-spidev python3-configobj
git clone https://github.com/daq-tools/dragino.git
cd dragino/overlay
dtc -@ -I dts -O dtb -o spi-gpio-cs.dtbo spi-gpio-cs-overlay.dts
. This might generate a couple of warnings, but seems to work oksudo cp spi-gpio-cs.dtbo /boot/overlays/
echo "dtoverlay=spi-gpio-cs" | sudo tee -a /boot/config.txt
sudo reboot
ls /dev/spidev0.*
should output /dev/spidev0.0 /dev/spidev0.1 /dev/spidev0.2
. In which case the required SPI CS line now exists./test.py
and the device should transmit on the things network using ABP authenticationFor some reason the Dragino board does not use one of the standard chip select lines for the SPI communication. This can be overcome by using a device tree overlay to configure addtional SPI CS lines. I am not a device tree expert so I adapted the example given at https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=157994 to provide the code needed for this to work.