Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    New firmware release 1.7.6.b1

    Scheduled Pinned Locked Moved Announcements & News
    firmware
    27 Posts 13 Posters 11.7k Views 13 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J Offline
      jmarcelino @jellium
      last edited by

      @jellium
      The source on github hasn't been updated to 1.7.6 yet

      1 Reply Last reply Reply Quote 0
      • J Offline
        jcaron
        last edited by

        The LoRaWAN frame counters storage in NVS doesn't seem to work as intended when combined with deep sleep (tried with both 1.7.6.b1 and the new 1.7.7.b1): the uplink frame counter restarts at 1 after each sleep... Not sure if that's because the counter is not properly stored, not properly read, or reset in the process?

        The only thing I do after wake up is:

        lora = LoRa(mode=LoRa.LORAWAN)
        s = socket.socket(socket.AF_LORA, socket.SOCK_RAW)
        s.setsockopt(socket.SOL_LORA, socket.SO_DR, 0)
        s.send(bytes([1]));
        

        Even though lora isn't used, if I don't include the Lora() initialiser, socket throws an error (OSError: Network card not available), not sure if that call resets the counter (I would expect only the join to do so)?

        I even added a 2-second sleep after sending just to make sure the packet is actually sent, just in case the NVS storage is done only once the packet has finished sending, no change.

        Is there a way to check what is stored in NVRAM, using pycom.nvs_get() for instance?

        Thanks,

        Jacques.

        J sorenS 2 Replies Last reply Reply Quote 0
        • J Offline
          jellium @jcaron
          last edited by jellium

          @jcaron Hello, I cannot provide an answer to the problem you are reporting but in case you haven't read it, I draw your attention on the similar issue that I am reporting in this present thread on this and that posts.
          Edit: my bad, I see that you have read the post indeed :)

          J 1 Reply Last reply Reply Quote 0
          • J Offline
            jcaron @jellium
            last edited by

            @jellium @daniel OK, so I dug a bit in the code and added a few traces, and the conclusion is that:

            • there are actually two instances of the counters being reset: right from the init of the board (in TASK_LoRa, which calls LoRaMacStoreUpAndDownLinkCountersInNvs), and a second one in the LoRa constructor, which calls LoRaMacInitialization which in turn calls ResetMacParameters. Both will save the counters with their default values before they have been read from NVS.

            • the TASK_LoRa is actually an infinite loop running all the time, whether LoRa is actually running or configured or not!

            I'll try to find how this could be resolved, but I won't mind if someone who is more familiar with the code does it first or has any pointers!

            BTW, the code on GitHub has the wrong version number, is there anything else that would have missed the commit?

            1 Reply Last reply Reply Quote 1
            • sorenS Offline
              soren @jcaron
              last edited by

              @jcaron hi, has this been fixed i wonder? i get "network card not available" right now, and i'm not using lora. don't need to.

              J 1 Reply Last reply Reply Quote 0
              • J Offline
                jmarcelino @soren
                last edited by

                @soren said in New firmware release 1.7.6.b1:

                network card not available

                Can you post the code you’re trying to use, or at least the part where you setup the network / socket?

                sorenS 1 Reply Last reply Reply Quote 0
                • sorenS Offline
                  soren @jmarcelino
                  last edited by

                  @jmarcelino yes, of course. It's the part where I'm using the socket that is commented out right now:

                  import machine
                  from machine import UART
                  from network import WLAN
                  #from network import LoRa
                  #lora = LoRa(mode=LoRa.LORAWAN)
                  #from machine import SD
                  import socket
                  #import ssl
                  #import time
                  import os
                  import pycom
                  print('starting up..')
                  #sd = SD()
                  #os.mount(sd, '/sd')
                  #time.sleep(5)
                  #os.listdir('/sd')
                  #time.sleep(5)
                  
                  uart = UART(0, 115200)
                  os.dupterm(uart)
                  pycom.heartbeat(False)
                  pycom.rgbled(0x7f0000) # red
                  
                  wlan = WLAN()
                  #print('SD mounted!')
                  if machine.reset_cause() != machine.SOFT_RESET:
                      print('setting wlan config...')
                      wlan.init(mode=WLAN.STA)
                      wlan.ifconfig(config=('10.0.0.88', '255.255.255.0', '10.0.0.1', '8.8.8.8'))
                  
                  if not wlan.isconnected():
                      print('looking for network...')
                      wlan.connect('NETGEAR64', auth=(WLAN.WPA2, 'oddchair195'), timeout=5000)
                      while not wlan.isconnected():
                          machine.idle()
                  print('connected to wifi!')
                  
                  #s = socket.socket()
                  #ss = ssl.wrap_socket(s)
                  #ss.connect(socket.getaddrinfo('www.google.com', 443)[0][-1])
                  #print('connected to internet!')
                  
                  
                  space = os.getfree('/flash')
                  print('free flash mem: ', space)
                  pycom.rgbled(0x007f00) # green
                  
                  1 Reply Last reply Reply Quote 0

                  Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                  Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                  With your input, this post could be even better đź’—

                  Register Login
                  • 1
                  • 2
                  • 2 / 2
                  • First post
                    Last post

                  Pycom on Twitter

                  Pycom