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.4.0.b1

    Scheduled Pinned Locked Moved Announcements & News
    65 Posts 15 Posters 40.7k Views 14 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.
    • D Offline
      daniel
      last edited by sakis

      Hello everyone,

      On this release we have added the following features:

      • WLAN and Bluetooth disabling. See wlan.deinit() and bluetooth.deinit() methods.

      • WiFi power save mode. This is enabled by default when in STA (Station) mode. The WiFi radio is disabled automatically when not being used to lower the power consumption. This cannot be done in AP mode because access points need to have their radios ON all the time.

      • ```machine.idle()`` method now stops the CPU clock until the next interrupt occurs to preserve power.

      • Bluetooth callbacks for the following events:

        • Client connected.
        • Client disconnected.
        • New advertisement received.
        • Characteristic notifications (also known as subscriptions).
      • The ```wlan.disconnect()`` bug has been fixed, see: https://github.com/pycom/pycom-micropython/issues/55

      • Finally we are now using the remote control peripheral to drive the RGB LED (instead of bit banging).

      The new firmware binaries will be available tomorrow (around 10:00 AM CET), on the usual place: https://www.pycom.io/support/supportdownloads/#firmware

      I'll notify again when the release is available for download.

      Cheers,
      Daniel

      L C 2 Replies Last reply Reply Quote 1
      • J Offline
        jmarcelino
        last edited by

        Wow power savings AND great news for BLE too, can't wait to try this.

        What are the chances the RMT code can be expanded to support more than the one LED, i.e. WS2812 strips?

        1 Reply Last reply Reply Quote 0
        • D Offline
          daniel
          last edited by

          Hello,

          The release is live :-), feel free to download it now. Thanks!

          https://www.pycom.io/support/supportdownloads/#firmware

          Cheers,
          Daniel

          1 Reply Last reply Reply Quote 0
          • B Offline
            borjam
            last edited by

            Great! I´'ve just updated one of my LoPys adn it seems to be working fine.

            However, I have a suggestion: It would be much better if wireless interfaces (LoRa, WiFi, Bluetooth, and whatever you add in the future) were in a well known disabled state by default upon power up.

            It's a bit clumsy to be required to do this just in order to get stuff running:

            from network import WLAN
            from network import Bluetooth
            wlan = WLAN()
            wlan.deinit()
            bt = Bluetooth()
            bt.deinit()

            Moreover, if in the future you add another network interface (like the planned GyPy, it will be mandatory to add proper "deinit()" commands even if not planning to use the new interface, which will hurt upwards compatibility.

            What happens when deinit() is called, by the way? Does the call to the intialization methods consume memory that I presume won't be released when calling deinit()?

            1 Reply Last reply Reply Quote 0
            • B Offline
              borjam
              last edited by borjam

              I mean something like this (I've used the equal sign for the system prompt in order to avoid generating mark-up text formatting)

              = import gc
              = gc.mem_free()
              31856
              = from network import WLAN
              = from network import Bluetooth
              = gc.mem_free()
              31536
              = wlan=WLAN()
              = gc.mem_free()
              31376
              = bt=Bluetooth()
              BTDM CONTROLLER VERSION: 010101
              btip start
              copy .data from 4000d890 to 3ffae6e0, len 00001830
              set .bss 0x0 from 3ffb8000 to 3ffbff70, len 00007f70
              BTDM ROM VERSION 0101
              BD_ADDR: 24:0A:C4:00:BD:CA
              NVDS MAGIC FAILED
              RF Init OK with coex
              = gc.mem_free()
              31152
              = wlan.deinit()
              = gc.mem_free()
              30992
              = bt.deinit()
              = gc.mem_free()
              30832

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

                I'm also a bit stumped by how to turn off wifi.

                If try a simple script:

                from network import WLAN
                import time
                import pycom
                
                pycom.heartbeat(False)
                wlan = WLAN(mode=WLAN.STA)
                wlan.deinit()
                
                while True:
                    pycom.rgbled( 0x00ff00)
                    time.sleep(0.1)
                    pycom.rgbled( 0)
                    time.sleep(9.9)
                

                I see no decrease in current at all.

                If I remove the wlan.deinit() the new power saving mode kicks in and I do see it switching from about 60mA to 140mA (@3.3V). I can't see how to turn it off. Thanks!

                P 1 Reply Last reply Reply Quote 0
                • D Offline
                  daniel @borjam
                  last edited by

                  @borjam memory from Bluetooth is not released when is not in use. This is something that we are looking to implement as it is very important.

                  @jmarcelino we are aware of this and we are checking with Espressif.

                  1 Reply Last reply Reply Quote 0
                  • B Offline
                    borjam
                    last edited by

                    Thanks @daniel. Being able to properly disable network interfaces you don't intend to use is really critical.

                    Not only for power reasons, but in order to avoid conditions in which a "stray" network device with a life of its own (after all both have reasonably complex associated software stacks) can lead to some nefarious behavior due to environmental circumstances.

                    An example: imagine that you have deployed LoPys as some kind of embedded sensors. You are using LoRa, not WiFi nor Bluetooth. Now, some device with a buggy Bluetooth or WiFi stack moves close, or it doesn't have a buggy implementation but, nevertheless, something happens that triggers a bug in the LoPy's stack. So, the WiFi or Bluetooth goes mad and something Bad™ happens.

                    Of course it could be an intentional attacker as well.

                    It would be nice to tell the Espressif guys that "off must be off" and the relevant silicon must be really powered off with no possibility of zombie behavior ;)

                    1 Reply Last reply Reply Quote 1
                    • P Offline
                      PeterBaugh @jmarcelino
                      last edited by

                      @jmarcelino Out of interest how are you measuring the power consumption of your device?

                      1 Reply Last reply Reply Quote 1
                      • C Offline
                        constantinos
                        last edited by

                        Can you give us more explanation for machine.idle and sleep modes?

                        Thanks

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

                          So there's the small caveat that disabled doesn't mean 'turn off' the interface :-) Thanks for the clarification! The STA power savings are very good news though, can save a lot of battery with almost no effort.

                          By the way I found that if I do:

                          from network import WLAN
                          wlan = WLAN(mode=WLAN.STA)
                          

                          power saving is enabled, but if I use this instead it doesn't:

                          from network import WLAN
                          wlan = WLAN()
                          wl.mode(WLAN.STA)
                          

                          @PeterBaugh: Just looking at my power supply reading at the moment. I also use a coulomb counter (LTC4150) for consumption over time (without needing to do integration) I'm hoping to do a blog post on this soon.

                          D 1 Reply Last reply Reply Quote 2
                          • D Offline
                            daniel @jmarcelino
                            last edited by

                            @jmarcelino

                            from network import WLAN
                            wlan = WLAN()
                            wl.mode(WLAN.STA)

                            If that's the case that's an issue. We'll check. Thanks!

                            1 Reply Last reply Reply Quote 0
                            • C Offline
                              crankshaft
                              last edited by

                              @daniel Been waiting for this, thanks very much, I am looking now at my power supply which definitely shows the current is down, but fluctuating a lot.

                              But I have a feature request, is it possible to have a machine.sleep(msec) where msec is the number of milliseconds that you want to sleep.

                              This would be really cool, to be able to put it to REAL sleep without interrupts.

                              And on the same subject, are the RTC interrupts on the horizon so that we can achieve the above, only with more code ?

                              1 Reply Last reply Reply Quote 0
                              • L Offline
                                livius @daniel
                                last edited by livius

                                @daniel
                                something is wrong

                                pycom.rgbled(0xff0000)
                                Traceback (most recent call last):
                                  File "<stdin>", line 1, in <module>
                                OSError: the requested operation is not possible
                                
                                >>> os.uname()
                                (sysname='WiPy', nodename='WiPy', release='1.4.0.b1', version='v1.8.6-398-g4a4a81e on 2017-01-20', machine='WiPy with ESP32')
                                

                                think about people first, then computers

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

                                  @livius that's being done on purpose, you need to disable the heartbeat first. You can either have the heartbeat enabled or control the LED manually. What are you trying to do?

                                  Cheers,
                                  Daniel

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

                                    @livius
                                    I noticed that, but wasn't sure if it's new. You have to disable the heartbeat before using rgbled

                                    pycom.heartbeat(False)
                                    pycom.rgbled(0x007f00) # green

                                    Maybe a little jarring for first time users just trying to blink the led

                                    1 Reply Last reply Reply Quote 0
                                    • L Offline
                                      livius @daniel
                                      last edited by

                                      @daniel

                                      i have this file from start(3 month ago)

                                      file "wifi_ap.py"
                                      import pycom
                                      print('wifi_ap')
                                      pycom.heartbeat(0)
                                      pycom.heartbeat(1)
                                      pycom.rgbled(0xff0000)
                                      

                                      this worked in all previous version of firmware
                                      now it does not work.
                                      If it should not work previously in that way i can fix this

                                      think about people first, then computers

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

                                        @livius
                                        Why is the code turning the heartbeat signal off just to turn it on right after?

                                        If you remove the pycom.heartbeat(1) line it should work.

                                        L 1 Reply Last reply Reply Quote 0
                                        • L Offline
                                          livius @jmarcelino
                                          last edited by livius

                                          @jmarcelino
                                          file 3 month ago and i suppose copy paste from doc or forum
                                          but why i can not change color of led when it is on?

                                          and i disable default blink of led which is after normal boot(firmware blink)

                                          think about people first, then computers

                                          1 Reply Last reply Reply Quote 0
                                          • L Offline
                                            livius
                                            last edited by livius

                                            but something is wrong try this:

                                            1. 
                                            pycom.heartbeat(0) #disable
                                            pycom.rgbled(0xff0000) #change color - but this also turn it on
                                            pycom.heartbeat(1) # strange this also disable led
                                            

                                            think about people first, then computers

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

                                            Pycom on Twitter

                                            Pycom