I am using the https://github.com/rpsreal/pySX127x library Raspberry Pi4 and a Dragino LoRa/GPS HAT for RPi v1.4. Running test_lora.py in the library, the unit test test_mode() fails with the error self.assertEqual(lora.get_mode(), m). This failure happens because the set_mode() function in that unit test never seems to be able to set the mode of the LoRa HAT to any value. The mode always remains as 0.

Does anyone know why that would be the case?

In addition, looking at the file SX127x\constants.py, I see the MODES for SLEEP and STDBY are 0x80 and 0x81 respectively. However, looking at the Dragino HAT documentation at https://github.com/raspberrypi-tw/lora-sx1278/blob/master/sx1276_77_78_79.pdf, on pages 54 & 55 (Operating Modes in FSK/OOK Mode), the respective modes for SLEEP and STDBY are 0x00 and 0x01). Why are the constants in SX127x\constants.py different?

Not that it matters though, setting either the constants in the library or the documentation do not seem to work in changing the mode of the HAT.

If it helps, the DRAGINO HAT uses an sx1278 (RF98) LoRa chip.

Any help would be appreciated.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.