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 Development release v1.19.0.b4

    Scheduled Pinned Locked Moved Beta Announcements & Development News
    firmwaredevelopment
    33 Posts 15 Posters 9.5k Views 15 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.
    • S Offline
      Sympatron @gregcope
      last edited by

      @gregcope https://docs.pycom.io/v/d0d9191ca2df10c6ca280de6fd2f11e7c5a18e6f/chapter/firmwareapi/pycom/machine/RTC.html#rtcmemorydata

      G 1 Reply Last reply Reply Quote 0
      • catalinC Offline
        catalin
        last edited by catalin

        hi @Sympatron, I can answer the Openthread questions:

        • in this release openthread is compiled for FTD( though, no DNS, Commissioner/Joiner role, DTLS, Jam detection, here are include files)
          • you can (or I can provide) a MTD openthread library build, code is open-source at https://github.com/pycom/pycom-esp-idf/tree/idf_dev
        • I've been investigating the Border Router issue:
          • for the moment the UDP packets are not transferred to Wifi
          • Solution A: (doable by you immediately in a micropy script) you could start and UDP server (bind a socket) on the designated Border Router device, propagate it's IPv6 (RLOC or ML_EID) thru multicast in the whole network, receive all UDP packages and manually take UDP payload to the Wifi socket
          • Solution B: you can also use lora.cli('prefix add xx::xx') to insert the prefix for out-mesh traffic, then use otIp6ReceiveCallback to filter on Border Router all the IP traffic having that prefix, unpack UDP packets, repack and send on wifi socket; basically some NAT64 needs to be implemented
          • I would try the solution B, but not sure if we can release sooner than 1 month
          • for implementing Solution A, take a look here for UDP sockets example: https://github.com/pycom/pycom-libraries/tree/master/lib/lora_mesh

        Catalin,

        Have you checked out our docs for the answer? (Now with an easy search function) https://docs.pycom.io
        Check out our newly revamped device management platform, Pybytes! https://pybytes.pycom.io/

        1 Reply Last reply Reply Quote 1
        • G Offline
          gregcope @Sympatron
          last edited by

          @sympatron thanks!

          1 Reply Last reply Reply Quote 0
          • H Offline
            Harish kumar @iwahdan
            last edited by Harish kumar

            Hi @iwahdan ! I am using Arduino as a device. And lopy4 as a repeater, where lopy4 has to fetch data from the device and it needs to send to the Gateway(only by lorawan). Is it possible with this ?
            I am sending OTAA from Arduino to server.
            Thank you in Advance !

            I 1 Reply Last reply Reply Quote 0
            • R Offline
              RodgerG
              last edited by

              Hi @catalin

              This LoRaMesh is great and just what I have been looking for!

              I tried downloading the example file and library and loaded them on to a LoPy4 on a PySense.

              However, I get a strange error on start up (or reset) as below...

              Initializing filesystem as LittleFS!
              LoRa MAC: 70b3d5499625b58c
              Traceback (most recent call last):
                File "main.py", line 23, in <module>
                File "/flash/lib/loramesh.py", line 98, in led_state
              OSError: the requested operation is not possible
              Pycom MicroPython 1.19.0.b4 [v1.9.4-50f84dd] on 2018-07-13; LoPy4 with ESP32
              >>> mesh.led_state()
              >>>
              

              The call from main.py is as follows

              while True:
                  mesh.led_state()
              

              and the code on line 98 of loramesh.py is the third line of the following method

                  def led_state(self):
                      """ Sets the LED according to the Thread role """
                      pycom.rgbled(self.RGBLED[self.state()])
              

              When I just call mesh.led_state() from the command line, there is no such error, as you can see from the console log.

              I tried putting mesh.led_state() in a try-except clause, but still kept getting the same OS error.

              As a workaround, I have copied RGBLED to main, and replaced

              mesh.led_state()
              

              with

              pycom.rgbled(RGBLED[mesh.state()])
              

              and this works.

              I cannot see any obviouse reason for the error.

              1 Reply Last reply Reply Quote 0
              • R Offline
                RodgerG
                last edited by

                @ catalin

                Found the problem

                The example code was missing

                # Make sure heartbeat is disabled before setting RGB LED
                pycom.heartbeat(False)```
                E 1 Reply Last reply Reply Quote 0
                • I Offline
                  iwahdan @Harish kumar
                  last edited by

                  @harish-kumar yes it is possible, however you have to make sure that Arduino only use a single frequency, as Pycom devices can only listen on a single frequency, you should be implementing something like that
                  https://docs.pycom.io/chapter/tutorials/lora/lorawan-nano-gateway.html#otaa-over-the-air-activation
                  on Arduino.

                  Wahdan

                  1 Reply Last reply Reply Quote 0
                  • E Offline
                    egimbernat @RodgerG
                    last edited by

                    @rodgerg When pycom.heartbeat is set to true (By default it is), creates a lock around led operations that's because the OSError. Even if you adquire a lock and iterate around led operations on main thread or an volatile thread pycom.heartbeat will have priority when turned on.

                    The solution as you found is to set:

                    pycom.heartbeat(False)
                    

                    When you want to gain control over led, sometimes you may need a very small delay in order the heartbeat lock to release. For example:

                    pycom.heartbeat(False) #Assuming that it was True
                    time.delay(0.05)
                    mesh.led_state()
                    
                    1 Reply Last reply Reply Quote 1
                    • C Offline
                      cmisztur
                      last edited by cmisztur

                      @iwahdan Thanks. Should importing uasyncio work in this release ?

                      I 1 Reply Last reply Reply Quote 0
                      • I Offline
                        iwahdan @cmisztur
                        last edited by iwahdan

                        @cmisztur, We've done some updates in this Dev release to support including the uasyncio lib from micropython.

                        The uasyncio library is provided by MicroPython under micropython-lib: https://github.com/micropython/micropython-lib/tree/master/uasyncio
                        Unlike CPython's asyncio library it is splitted into several parts:

                        • uasyncio.core
                        • uasyncio.queues
                        • uasyncio.synchro
                        • uasyncio.udp
                        • uasyncio.websocket.server

                        The uasyncio library relies on the micropython-lib/collections (defaultdict, deque) and logging libraries.

                        Note: I've updated my Release post as it was wrongly implying that the uasyncio already included in firmware

                        Wahdan

                        S 1 Reply Last reply Reply Quote 1
                        • S Offline
                          soulsurfer @iwahdan
                          last edited by

                          @iwahdan - Given the recent change in wording (and the fact that I'm a micropython noob!) are there explicit instructions anywhere on precisely how to "includ[e] uasyncio micropython module[s]" plus the required libraries?

                          I C 2 Replies Last reply Reply Quote 0
                          • I Offline
                            iwahdan @soulsurfer
                            last edited by

                            @soulsurfer, using FTP or pymkr you can upload the uasyncio modules to your Pycom device with the following hierarchy :

                            • uasyncio sub-modules into /flash/lib/uasyncio
                            • websocket.server sub-module under: /flash/lib/uasyncio/websocket
                            • collections sub-modules into /flash/lib/collections
                            • logging sub-module into /flash/lib

                            And then you can import uasyncio library into your script and start using it

                            Wahdan

                            S S 2 Replies Last reply Reply Quote 1
                            • S Offline
                              Sympatron @iwahdan
                              last edited by

                              @iwahdan I think it would be nice to have this as frozen modules by default in the future.

                              1 Reply Last reply Reply Quote 0
                              • C Offline
                                cmisztur @soulsurfer
                                last edited by

                                @soulsurfer here, I documented the process https://medium.com/@chrismisztur/pycom-uasyncio-installation-94931fc71283

                                1 Reply Last reply Reply Quote 5
                                • T Offline
                                  tuftec
                                  last edited by

                                  It is good to see that RTC memory support has been added.
                                  Is there a mechanism that can keep the RTC operational when the device is in deep sleep?
                                  I need a way to maintain system time but require to deepsleep regularly to save power (battery operated).
                                  My original solution for this was to implement a s/w RTC and to save its state every time I go into deepsleep. I would then use my knowledge of the time in deepsleep (set by the deepsleep timer) and measuring execution time of the start up code (using the chrono functions) to then update my s/w RTC upon waking.
                                  Very messy but it sort of works. Not very accurate though.
                                  If there was a way to keep the RTC running (power still applied) then I could hopefully have a much better solution. Using other ESP32 based devices running standard Micropyrhon, it would appear that the RTC function actually continues to operate during deepsleep.
                                  Have I missed something???? Is there a suggested way to use the RTC when using deepsleep?

                                  Peter.

                                  J I 2 Replies Last reply Reply Quote 0
                                  • J Offline
                                    jcaron @tuftec
                                    last edited by

                                    @tuftec you may want to let us know which hardware combination (module + board) and what deep sleep mode you are using.

                                    If you are using one of the “older” boards (e.g LoPy, not LoPy 4) with a Pysense, Pytrack or the deep sleep shield, and the PIC-controlled deep sleep, then the ESP32 is indeed completely powered down during deep sleep.

                                    If you are using one of the more recent boards (e.g LoPy) and machine.deepsleep, I believe the RTC keeps running during deep sleep.

                                    1 Reply Last reply Reply Quote 1
                                    • S Offline
                                      soulsurfer @iwahdan
                                      last edited by

                                      OK - Thanks @iwahdan.

                                      1 Reply Last reply Reply Quote 0
                                      • I Offline
                                        iwahdan @tuftec
                                        last edited by

                                        Hi @tuftec, well as @jcaron mentioned if you are using a Pycom device with Deepsleep shield you cannot keep track of time using RTC as the device is completely powered Off, however if you are using the newer boards that don't require the Deepsleep shield you can keep track of time using the RTC module in Micropython, you would set the time once using RTC.init() and the RTC would keep counting from that time even in deepsleep , you can check time after wakeup using RTC.now()

                                        Wahdan

                                        1 Reply Last reply Reply Quote 1
                                        • S Offline
                                          soulsurfer
                                          last edited by

                                          Triple thanks @cmisztur!

                                          1 Reply Last reply Reply Quote 1
                                          • T Offline
                                            tuftec
                                            last edited by

                                            Sorry about the scant information.
                                            I am building custom hardware around the LoPy4 and FiPy devices.
                                            So, based on the post by @iwahdan , does this imply that the RTC should keep going in DeepSleep for both the LoPy4 and FiPy modules? This is contrary to information I was given some time ago.
                                            If the RTC keeps going that would be a big advantage for my application.

                                            Peter.

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

                                            Pycom on Twitter

                                            Pycom