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

    OTA or not OTA that is the question...

    Scheduled Pinned Locked Moved WiPy 2&3
    86 Posts 11 Posters 52.3k 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.
    • I Offline
      Innocenzo @jylaxx
      last edited by

      @jylaxx I am looking for the same answers. I would know if it is possible write a micropython code that connect to my server, download a new version of '/flash' and replace the older.

      In other words a FS Update OTA feature.

      1 Reply Last reply Reply Quote 2
      • robert-hhR Offline
        robert-hh @jylaxx
        last edited by

        @jylaxx You can make your owh OTA mechnism for user program update, by writing a protocol that downloads a new script. You can even replace the code of the script that is actually running, even if that might not be safe. And there is machine.reset() to restart you device.

        You could also use the built-in ftp server to upload new code, if the device is accessible for remote clients, even if that is not reccomendet, since the connection is not secure.

        I 2 Replies Last reply Reply Quote 1
        • I Offline
          Innocenzo @robert-hh
          last edited by

          @robert-hh Hi Robert, so I can download a new boot.py an main.py, and also add other files in /flash/lib for example, and after reset, my device running the new code right? I know that FTP is not secure, but I can enable it only during this step and change the default password XD. Now, I do some tests.

          Thx

          1 Reply Last reply Reply Quote 1
          • I Offline
            Innocenzo @robert-hh
            last edited by

            @robert-hh Instead, the Module Firmware update can be done only through the Pycom Firmware Update Tool, right?

            [off Topic] How can I increase my reputation? I can write a message only every 600 seconds and it is pesky :( .

            robert-hhR B 2 Replies Last reply Reply Quote 2
            • robert-hhR Offline
              robert-hh @Innocenzo
              last edited by

              @Innocenzo Yes, that is true. You can replace any file in the file system, but firmware and frozen bytecode can only be loaded trough an external PC. It does not have to be the Pycom updater. If you search the board for downgrade, you'll find a manual procedure, and the firmware images are all accessible, once you guess the right name. You can also install the repository and build environment to create you own images. OTA of the firmware worked in the beginning, but that stopped at about V1.

              P.S.: One mechanism of increasing the reputation is being upvoted by someone else, which I just did for your post.

              I 1 Reply Last reply Reply Quote 1
              • B Offline
                bucknall @Innocenzo
                last edited by

                Hi @Innocenzo,

                You need a minimum of 3 reputation to post faster than once every 600 seconds. I've upvoted a couple of your posts so this should be resolved now! It's intended as a method to slow down spammers and those posting automated content.

                Regarding your questions about the Firmware Update tool, this is correct. As of current, you need to use the Pycom Firmware Update tool - we're looking into bringing OTA back but at the moment we're prioritising other core features!

                I'll post back here when this feature is released!

                Cheers,

                Alex

                Developer Evangelist - Pycom

                I 1 Reply Last reply Reply Quote 1
                • I Offline
                  Innocenzo @bucknall
                  last edited by

                  @bucknall Thx a lot for everything

                  1 Reply Last reply Reply Quote 0
                  • I Offline
                    Innocenzo @robert-hh
                    last edited by

                    @robert-hh I am sorry for the many questions, but exists something like ftplib.py that works on WiPy 2.0?

                    Or the better solution is to write code from the scratch?

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

                      @Innocenzo @spotlightkid has created a ftplib version that runs on esp8266 micropython. In general, that should work on wipy32 too. Maybe you have to adapt a little bit, since the two dialects are not 100% the same.
                      https://forum.micropython.org/viewtopic.php?f=15&t=2949&p=17523&hilit=ftplib#p17459
                      and
                      https://github.com/SpotlightKid/micropython-ftplib
                      If the code get's too large, you too can use pre-compiled files, or use frozen bytecode (code in flash). That however requires you to install the build environment for the firmware.

                      I 1 Reply Last reply Reply Quote 1
                      • I Offline
                        Innocenzo @robert-hh
                        last edited by

                        @robert-hh I've tried this version but I've some problem on memory allocation

                        MemoryError: memory allocation failed, allocating 322 bytes

                        robert-hhR J 3 Replies Last reply Reply Quote 0
                        • robert-hhR Offline
                          robert-hh @Innocenzo
                          last edited by

                          @Innocenzo If the code get's too large, you too can use pre-compiled files, or use frozen bytecode (code in flash). That however requires you to install the build environment for the firmware.

                          I 1 Reply Last reply Reply Quote 1
                          • J Offline
                            jmarcelino @Innocenzo
                            last edited by jmarcelino

                            @Innocenzo
                            a FTP client feels a bit wasteful on resources, it's a very verbose protocol with lots of old baggage. Is there a particular reason for it?

                            1 Reply Last reply Reply Quote 0
                            • I Offline
                              Innocenzo @robert-hh
                              last edited by

                              @robert-hh There is some guide where I can learn about using pre-compiled files or froze bytecode?

                              @jmarcelino I want perform the FileSystem Update through micropython code. In other words I want that a function in my code can connect to a Server, download a new version of boot.py and main.py and reset the machine. With previous answers I understand that the only way to do this is through FTP.

                              robert-hhR J 2 Replies Last reply Reply Quote 0
                              • robert-hhR Offline
                                robert-hh @Innocenzo
                                last edited by

                                @Innocenzo Besides that, you can always implement a simple file transfer using sockets with a few dozen lines of code.
                                open connection to sever
                                request: name_of_file
                                response: file_or_sorry
                                get data until the server closes the connection.

                                1 Reply Last reply Reply Quote 2
                                • robert-hhR Offline
                                  robert-hh @Innocenzo
                                  last edited by

                                  @Innocenzo Both mpy-cross and dfrozen bytecode require the buidl environment for WiPy (https://github.com/pycom/pycom-micropython-sigfox). I can make a mpy-cross (the pyhton cross-compiler) for you, if you tell me your OS. Then you would compile you python code on your PC, get a file with the extension .mpy and store it on the wipy, like a python script. Th ecompield file may not be much smaller, but it needs less space when loaded and does not need RAM during loading.

                                  I 1 Reply Last reply Reply Quote 1
                                  • J Offline
                                    jmarcelino @Innocenzo
                                    last edited by

                                    @Innocenzo
                                    It's much better if you run use a FTP client on your Server to connect to the existing FTP server running on the LoPy. (confusing sorry :) The FTP server on the LoPy is more efficient and already done in C.

                                    Alternatively use the light weight sockets approach robert-hh suggested.

                                    1 Reply Last reply Reply Quote 0
                                    • I Offline
                                      Innocenzo @robert-hh
                                      last edited by

                                      @robert-hh Actually I use Windows 10 (if there are problems I have also a VM with Ubuntu). Thx

                                      @jmarcelino For my purposes the Wipy must require the transfer and contact the server. I think that the socket approach is the better solution.

                                      robert-hhR 2 Replies Last reply Reply Quote 0
                                      • robert-hhR Offline
                                        robert-hh @Innocenzo
                                        last edited by

                                        @Innocenzo OK. It'll take a few housr before I'm home to prepare the binaries. Linux is easy, for Windows10 I can use my Windows VM.

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

                                          @Innocenzo I have placed Linux and Windows versions here:
                                          https://github.com/robert-hh/Shared-Stuff
                                          The versions for the pycom and micropython.org variants differ in the tag of the generated file, so take the right one.
                                          mpy-cross --help
                                          tells you the usage. On WiPy, the .py files take precedence over the .mpy files. If you want to run the .mpy variant, delete or rename the other version first.

                                          I 1 Reply Last reply Reply Quote 2
                                          • I Offline
                                            Innocenzo @robert-hh
                                            last edited by

                                            @robert-hh Thx a lot.

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

                                            Pycom on Twitter

                                            Pycom