DevNonce always 0000



  • Hi, I got this problem after a wdt reset and being too far from the gateway. I'm using a Lopy4 with a private network. The dev nonce is a random value! Why is always sending 0?

    Message Type = Join Request
      PHYPayload = 007A8C1D9C49D5B3707A8C1D9C49D5B3700000C735B2CF
    
    ( PHYPayload = MHDR[1] | MACPayload[..] | MIC[4] )
            MHDR = 00
      MACPayload = 7A8C1D9C49D5B3707A8C1D9C49D5B3700000
             MIC = C735B2CF
    
    ( MACPayload = AppEUI[8] | DevEUI[8] | DevNonce[2] )
          AppEUI = 70B3D5499C1D8C7A
          DevEUI = 70B3D5499C1D8C7A
        DevNonce = 0000
    


  • @jcaron This problem occurs after a wdt reset. This conditions is caused because the device is too far from the gateway and not received the ack message. It get stuck on lora send function and the wdt reset the board. It seems that the communication with the SX1276 is lost. The SX1276Read seems to read 0. The last firmware update was on january. The device is on a farm tractor,

    def lora_send_data(sock, data):
        """ Send a message, can use confirmed message or not, depending the configuration
    
        :param sock: a lora socket
        :type sock: object
    
        :param data: the data to be sent
        :type data: bytes
        """
        global lora_send_completed
        global lora_ack_error
        lora_ack_error = False
        lora_send_completed = False
        if conf.LORA_MESSAGE_CONFIRMED:
            try:
                sock.setblocking(True)
                sock.send(data)
                if(settings.LORA_DEBUG):
                    print("lora sent data:",ubinascii.hexlify(data))
                sock.setblocking(False)
            except OSError as e:
                sock.setblocking(False)
                if e.args[0] == 11:
                    if settings.LORA_DEBUG:
                        print("tx_exception")
        else:
            sock.send(data)
    def lora_cb(lora):
        """ lora_send_data Call back function
    
        :param lora: lora configuration
        :type lora: object
        """
        global lora_send_completed
        global lora_ack_error
        events = lora.events()
        if events & LoRa.TX_PACKET_EVENT:
            lora_ack_error = False
            if settings.LORA_DEBUG:
                print('Lora packet sent')
        if events & LoRa.TX_FAILED_EVENT:
            lora_ack_error = True
            if settings.LORA_DEBUG:
                print('Lora packet tx failed')
        lora_send_completed = True
    


  • @fernandes-son the nonce should come from a sampling of RSSI, the process is here and it is used here.

    Do you have the problem all the time, or just after a WDT reset? Can you share the relevant parts of your code? What firmware version are you using?


Log in to reply
 

Pycom on Twitter