Alter lora frequency without reset



  • @momo232030 Are you sure that your code is complete? Besides the odd ubinascii.unhexlify('*'), which I expect that your code has the real values, I do not see where you try to set the frequency, besides in setRegion(). If you want to change the frequencies in the region, you may configure the channels. But a successful lora.join() may change that setting again.



  • @robert-hh
    Code crashes if i change the frequency and rerun the joinfrequency method. So the first time does work.

    def setRegion(region):
        lora = LoRa(mode=LoRa.LORAWAN, region=region)
        return lora
    
    
    
    
    def joinFreqency(freq, lora):
       dev_eui, app_eui, app_key = "","",""
       if freq == 433:
            dev_eui = ubinascii.unhexlify('*')
            app_eui = ubinascii.unhexlify('*')
            app_key = ubinascii.unhexlify('*')
       elif freq == 868:
                  dev_eui = ubinascii.unhexlify('*')
                  app_eui = ubinascii.unhexlify('*')
                  app_key = ubinascii.unhexlify('*')
       elif freq == 915:
            dev_eui = ubinascii.unhexlify('*')        
            app_eui = ubinascii.unhexlify('*')
            app_key = ubinascii.unhexlify('*')   
       else:
            return
    
     #lopy does not respond anymore after next line
        lora.join(activation=LoRa.OTAA, auth=(dev_eui, app_eui, app_key), timeout=0)
    
    ...
    


  • @momo232030 can you post to he code that causes the crash?


Log in to reply
 

Pycom on Twitter