pycom / pycom-micropython-sigfox

A fork of MicroPython with the ESP32 port customized to run on Pycom's IoT multi-network modules.
MIT License
198 stars 167 forks source link

FiPy does not receive JoinAccept #594

Open serafinebot-wdna opened 2 years ago

serafinebot-wdna commented 2 years ago

General Information

Pycom version

(sysname='FiPy', nodename='FiPy', release='1.20.2.r6', version='v1.11-c5a0a97 on 2021-10-28', machine='FiPy with ESP32', lorawan='1.0.2', sigfox='1.0.1', pybytes='1.7.1')

ChirpStack Information

LoRa configuration: EU868 (server & end device)

The code

import time
import pycom
import binascii

from network import LoRa

if __name__ == "__main__":
    pycom.heartbeat(False)
    pycom.rgbled(0x7f0000)

    lora = LoRa(mode=LoRa.LORAWAN, region=LoRa.EU868, device_class=LoRa.CLASS_A, public=1, adr=0, tx_retries=0)
    dev_eui = binascii.unhexlify('0000000000000000')
    app_eui = binascii.unhexlify('0000000000000000')
    app_key = binascii.unhexlify('00000000000000000000000000000000')

    lora.join(activation=LoRa.OTAA, auth=(dev_eui, app_eui, app_key), timeout=0)

    while not lora.has_joined():
        pycom.rgbled(0x7f7f00)
        time.sleep(5)
        print("joining...")

    print("joined")
    pycom.rgbled(0x007f00)

The problem

The end device is stuck an infinite join procedure loop.

image

During the join procedure, the JoinRequest and JoinAccept are displayed in the device LoRaWAN Frames log section in ChirpStack, so the issue does not reside in the LoRa server not authenticating the device properly. The most likely scenario is the JoinAccept not being properly sent to the device, due to an unexpected frequency, DR, bandwidth, etc. by the device.

We have not had any related problems with other devices (e.g. CubeCell HTCC-AB01 @ EU868) therefor there might be some sort of misconfiguration/issue with the device's code. Also, we have tried different LoRaWAN code samples by the Pycom community, all seemingly working with EU868 out of the box, with no luck.

Next steps

Thank you.