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

    lora.nvram_restore() OSError: [Errno 122] EMSGSIZE

    Scheduled Pinned Locked Moved FiPy
    fipypytracklorawannvramsavenvramrestore
    14 Posts 6 Posters 177 Views 6 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.
    • E Offline
      Etienne DAL PRA @jcaron
      last edited by

      @jcaron I've found ! This problem comes from the fact that I flashed the card in "development" mode instead of "pybytes" and I put the version 1.20.2 r0 and it works well.

      J 1 Reply Last reply Reply Quote 0
      • J Offline
        John Baxter @Etienne DAL PRA
        last edited by

        @Etienne-DAL-PRA Please can you advise the steps you have taken? I am having a very similar problem and I'm really stuck. Thank you :)

        E 1 Reply Last reply Reply Quote 0
        • E Offline
          Etienne DAL PRA @John Baxter
          last edited by

          @John-Baxter hi ! Yes of course. I'm sorry for the delay.
          I used the Pycom Firmware Updater (you can download it there https://docs.pycom.io/updatefirmware/device/).
          You need to close Atom or VS Code (the Pymakr console) before doing the upgrade. After you can do the upgrade with the Pycom Firmware Updater, you just need to select the Port and the type of your board.
          Then, I chose as type : Pybytes and as version the lastest : 1.20.2.r4. And selected the options :

          • Erase during update
          • CONFIG partition
          • NVS partition

          And clicked on Continue.

          I hope this helps you if you are still stuck :)

          J 1 Reply Last reply Reply Quote 1
          • J Offline
            John Baxter @Etienne DAL PRA
            last edited by

            @Etienne-DAL-PRA Thank you very much. This fixed it :)

            1 Reply Last reply Reply Quote 0
            • J Offline
              Jaco Pretorius
              last edited by robert-hh

              Good day

              I have a similar problem. If try to send the string I get the following error. Any help would be appreciated.

              Traceback (most recent call last):
              File "<stdin>", line 1, in <module>
              OSError: [Errno 122] EMSGSIZE

              My code:

              import socket
              import pycom
              import time
              from network import Sigfox
              from machine import Timer
              time.sleep(1)
              
              sigfox = Sigfox(mode=Sigfox.SIGFOX, rcz=Sigfox.RCZ1)
              time.sleep(1)
              s = socket.socket(socket.AF_SIGFOX, socket.SOCK_RAW)
              time.sleep(1)
              s.setblocking(True)
              time.sleep(1)
              s.setsockopt(socket.SOL_SIGFOX, socket.SO_RX, True)
              time.sleep(1)
              
              sSend = ""
              aSigFox_Bits = [0,0,0,0, 0,0,0,1, 0,0,0,0, 0,0,1,0, 0,0,0,0, 0,0,1,1, 0,0,0,0, 0,1,0,0, 0,0,0,0, 0,1,0,1, 0,0,0,0, 0,1,1,0, 0,0,0,0, 0,1,1,1, 0,0,0,0, 1,0,0,0, 0,0,0,0, 1,0,0,1, 0,0,0,0, 1,0,1,0, 0,0,0,0, 1,0,1,1, 0,0,0,0, 1,1,0,0]
              for i in range(0, 24):
                iHexChar = 8 * aSigFox_Bits[i*4] + 4 * aSigFox_Bits[i*4+1] + 2 * aSigFox_Bits[i*4+2] + aSigFox_Bits[i*4+3]
                sSend = sSend + str(hex(iHexChar)[2:])
              print(sSend)
              
              s.send(sSend.encode())
              
              J 1 Reply Last reply Reply Quote 1
              • J Offline
                jcaron @Jaco Pretorius
                last edited by

                @Jaco-Pretorius I believe this is completely unrelated to the original issue in this thread and is just because your encoding loop is incorrect and results in in a frame which is too long. Print the string and it’s length before sending it, it should be quite obvious.

                robert-hhR 1 Reply Last reply Reply Quote 0
                • robert-hhR Offline
                  robert-hh @jcaron
                  last edited by

                  @jcaron The sample string has a length of 24 bytes. Besides that, the loop looks overly complicated. If the input has to be a list of 0/1 values, it could be simplified a little bit to

                  sSend = bytearray(24)
                  aSigFox_Bits = [0,0,0,0, 0,0,0,1, 0,0,0,0, 0,0,1,0, 0,0,0,0, 0,0,1,1, 0,0,0,0, 0,1,0,0, 0,0,0,0, 0,1,0,1, 0,0,0,0, 0,1,1,0, 0,0,0,0, 0,1,1,1, 0,0,0,0, 1,0,0,0, 0,0,0,0, 1,0,0,1, 0,0,0,0, 1,0,1,0, 0,0,0,0, 1,0,1,1, 0,0,0,0, 1,1,0,0]
                  for i in range(0, 24):
                    sSend[i] = 8 * aSigFox_Bits[i*4] + 4 * aSigFox_Bits[i*4+1] + 2 * aSigFox_Bits[i*4+2] + aSigFox_Bits[i*4+3]
                  print(len(sSend), sSend)
                  

                  If is is a constant string, it can be written as:

                  sSend = bytes([0b0000, 0b0001, 0b0000, 0b0010, 0b0000, 0b0011, 0b0000, 0b0100, 0b0000, 0b0101, 0b0000, 0b0110, 0b0000, 0b0111, 0b0000, 0b1000, 0b0000, 0b1001, 0b0000, 0b1010, 0b0000, 0b1011, 0b0000, 0b1100])
                  print(len(sSend), sSend)
                  
                  J 1 Reply Last reply Reply Quote 0
                  • J Offline
                    jcaron @robert-hh
                    last edited by

                    @robert-hh I think the goal is to form a 12-byte message (max length of a Sigfox message). Each group of four bits is a nibble, but the conversion from bits to hex to bytes is incorrect.

                    Pretty sure there’s a much much simpler way of doing it but I’m not in a mood for Python today…

                    robert-hhR 1 Reply Last reply Reply Quote 0
                    • robert-hhR Offline
                      robert-hh @jcaron
                      last edited by robert-hh

                      @jcaron OK. Then two nibbles must go into one byte. Like;

                      sSend = bytearray(12)
                      aSigFox_Bits = [0,0,0,0, 0,0,0,1, 0,0,0,0, 0,0,1,0, 0,0,0,0, 0,0,1,1, 0,0,0,0, 0,1,0,0, 0,0,0,0, 0,1,0,1, 0,0,0,0, 0,1,1,0, 0,0,0,0, 0,1,1,1, 0,0,0,0, 1,0,0,0, 0,0,0,0, 1,0,0,1, 0,0,0,0, 1,0,1,0, 0,0,0,0, 1,0,1,1, 0,0,0,0, 1,1,0,0]
                      for i in range(0, 12):
                        i8 = i * 8
                        byte = 0
                        for j in range(8):
                              byte = (byte << 1) | aSigFox_Bits[i8 + j] 
                        sSend[i] = byte
                      print(len(sSend), sSend)
                      
                      sSend = bytes([0b00000001, 0b00000010, 0b00000011, 0b00000100, 0b00000101, 0b00000110, 0b00000111, 0b00001000, 0b00001001, 0b00001010, 0b00001011, 0b00001100])
                      print(len(sSend), sSend)
                      
                      J 1 Reply Last reply Reply Quote 0
                      • J Offline
                        Jaco Pretorius @robert-hh
                        last edited by

                        @robert-hh Thank you

                        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 / 1
                        • First post
                          Last post

                        Pycom on Twitter

                        Pycom