Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Bug Reports
  3. OTA firmware updating is too slow..

OTA firmware updating is too slow..

Scheduled Pinned Locked Moved Bug Reports
23 Posts 7 Posters 6.5k Views 9 Watching
  • 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.
  • yd kimY Offline
    yd kimY Offline
    yd kim
    wrote on last edited by
    #1

    0_1474527483347_MySensors_20160922-171044 - Copy.zip I'm using Mysensors 2.0 for weatherstation and try to use OTA function. It works but too slow and got fail on every 4-10 message. 65k hex file took over 1hour which seems not normal. Node and Gateway are close enough( about 1.5 meter without wall) and sensor data has no loss at all.
    I think this is related with presentation issue which I have and solve with wait (200).
    I have attached log file.
    Is there anything I'm missing this issue?

    Thank you in advance.

    Regards,
    YD

    sundberg84S 1 Reply Last reply
    0
    • yd kimY yd kim

      0_1474527483347_MySensors_20160922-171044 - Copy.zip I'm using Mysensors 2.0 for weatherstation and try to use OTA function. It works but too slow and got fail on every 4-10 message. 65k hex file took over 1hour which seems not normal. Node and Gateway are close enough( about 1.5 meter without wall) and sensor data has no loss at all.
      I think this is related with presentation issue which I have and solve with wait (200).
      I have attached log file.
      Is there anything I'm missing this issue?

      Thank you in advance.

      Regards,
      YD

      sundberg84S Offline
      sundberg84S Offline
      sundberg84
      Hardware Contributor
      wrote on last edited by
      #2

      @yd-kim - I had this issue as well, because the node and gateway was to close to each-other.
      Try to move them apart some more if possible and try.

      Controller: Proxmox VM - Home Assistant
      MySensors GW: Arduino Uno - W5100 Ethernet, Gw Shield Nrf24l01+ 2,4Ghz
      MySensors GW: Arduino Uno - Gw Shield RFM69, 433mhz
      RFLink GW - Arduino Mega + RFLink Shield, 433mhz

      1 Reply Last reply
      0
      • yd kimY Offline
        yd kimY Offline
        yd kim
        wrote on last edited by
        #3

        Thank you for quick reply.
        I moved it to downstairs. There is one door is closed. but seems not much different.
        I put node into downstairs cupboard and close door but seems not much different.

        Thank you. Looks like handling issue. probably too fast to handle in steam mode?
        My node is 8Mhz 3.3V board and Gateway is 5V. Both are atmega328.

        Thanks.
        YD

        martinhjelmareM 1 Reply Last reply
        0
        • yd kimY yd kim

          Thank you for quick reply.
          I moved it to downstairs. There is one door is closed. but seems not much different.
          I put node into downstairs cupboard and close door but seems not much different.

          Thank you. Looks like handling issue. probably too fast to handle in steam mode?
          My node is 8Mhz 3.3V board and Gateway is 5V. Both are atmega328.

          Thanks.
          YD

          martinhjelmareM Offline
          martinhjelmareM Offline
          martinhjelmare
          Plugin Developer
          wrote on last edited by
          #4

          @yd-kim

          Firmware messages have longer payload than regular temp or similar sensor messages. If you don't have perfect communication you will probably experience dropped messages during OTA FW update even if you don't have that problem for normal operation.

          1 Reply Last reply
          0
          • yd kimY Offline
            yd kimY Offline
            yd kim
            wrote on last edited by
            #5

            Thanks martinhjelmare,
            Yes seems that happen to me however I have no idea why it happen.
            I have added 10uF cap for NRF24L01 and another 470uF as well.
            It happen when presentation when I load 9 sensors. I have to add wait(200) for each present() otherwise 4th or 5th fail.
            Looks like there is no handshake or doesn't consider receiver capacity.
            Is there any workaround to fix this?
            Main issue is when it fails, seems wait about 5 seconds to send again. As long as it wait less than a second, it will help for this situation..

            Cheers,
            YD

            1 Reply Last reply
            0
            • martinhjelmareM Offline
              martinhjelmareM Offline
              martinhjelmare
              Plugin Developer
              wrote on last edited by
              #6

              I can post my test sketch for OTA FW updates that I used when developing support for it in pymysensors. It worked good on a SensebenderMicro 8 MHz. I think I made some adjustments to make the update more effective. I also found that it worked better with debug activated, which might be a sign that communication was not perfect. My guess is printing to serial slows down things just a little bit.

              1 Reply Last reply
              0
              • yd kimY Offline
                yd kimY Offline
                yd kim
                wrote on last edited by
                #7

                It will be great. I also turn on debug..
                It means driver itself is too fast to handle on atmega328??
                If we can reduce delay when it fails,it will be great. 5 seconds is too much I guess.

                1 Reply Last reply
                0
                • AndurilA Offline
                  AndurilA Offline
                  Anduril
                  wrote on last edited by
                  #8

                  @yd-kim what bootloader are you using? I have similar problems with tekkas newest bootloader, but the older one works fine for me.

                  yd kimY 1 Reply Last reply
                  0
                  • AndurilA Anduril

                    @yd-kim what bootloader are you using? I have similar problems with tekkas newest bootloader, but the older one works fine for me.

                    yd kimY Offline
                    yd kimY Offline
                    yd kim
                    wrote on last edited by
                    #9

                    @Anduril
                    Oh really? I did use MYSBootloaderV13pre.hex.
                    Can you let me know which one you use?
                    Thanks!

                    1 Reply Last reply
                    0
                    • AndurilA Offline
                      AndurilA Offline
                      Anduril
                      wrote on last edited by
                      #10

                      yeah I tried with the V13pre.hex, but with that I had problems as you descibed. Also the serial upload didn't worked for me. So there was no reason to not use the old one wich was included in his beta of MYSController. That worked much better. Maybe you can find the old version on tekkas download site of MYSController.

                      yd kimY 1 Reply Last reply
                      0
                      • AndurilA Anduril

                        yeah I tried with the V13pre.hex, but with that I had problems as you descibed. Also the serial upload didn't worked for me. So there was no reason to not use the old one wich was included in his beta of MYSController. That worked much better. Maybe you can find the old version on tekkas download site of MYSController.

                        yd kimY Offline
                        yd kimY Offline
                        yd kim
                        wrote on last edited by
                        #11

                        @Anduril

                        Thank you! Will try tomorrow and update on this post!

                        1 Reply Last reply
                        0
                        • AndurilA Offline
                          AndurilA Offline
                          Anduril
                          wrote on last edited by
                          #12

                          just as an update, here the link to tekkas 'old' MySController with the old bootloader: https://forum.mysensors.org/topic/838/windows-gui-controller-for-mysensors/2

                          1 Reply Last reply
                          0
                          • martinhjelmareM Offline
                            martinhjelmareM Offline
                            martinhjelmare
                            Plugin Developer
                            wrote on last edited by
                            #13

                            I implemented a check for firmware update message in my modified SenseBenderMicro sketch, and alternative behavior in the loop if FW update is ongoing. This doesn't solve the problem of dropped messages, but could be good to speed up the update and don't waste time on sensor updates.

                            void loop() {
                              if (fwUpdateOngoing) {
                                fwUpdateOngoing = false;
                                fwUpdateOngoing = wait(OTA_WAIT_PERIOD, C_STREAM, ST_FIRMWARE_RESPONSE);
                              } else {
                                normalFlow();
                              }
                            }
                            
                            void normalFlow() {
                              // Short delay to allow buttons to properly settle
                              sleep(5);
                            
                              int buttonValue = digitalRead(BUTTON_PIN);
                            
                              measureCount ++;
                              sendBattery ++;
                              bool forceTransmit = false;
                              transmission_occured = false;
                            #ifndef MY_OTA_FIRMWARE_FEATURE
                              if ((measureCount == 5) && highfreq)
                              {
                                clock_prescale_set(clock_div_8); // Switch to 1Mhz for the reminder of the sketch, save power.
                                highfreq = false;
                              }
                            #endif
                            
                              if (measureCount > FORCE_TRANSMIT_INTERVAL) { // force a transmission
                                forceTransmit = true;
                                measureCount = 0;
                              }
                            
                              sendTempHumidityMeasurements(forceTransmit);
                              if (buttonValue != oldValue) {
                                 // Send in the new buttonValue
                                 send(msg.set(buttonValue==HIGH ? 0 : 1));
                                 oldValue = buttonValue;
                                 transmission_occured = true;
                              }
                            
                            #ifdef MY_OTA_FIRMWARE_FEATURE
                              if (transmission_occured) {
                                fwUpdateOngoing = wait(OTA_WAIT_PERIOD, C_STREAM, ST_FIRMWARE_RESPONSE);
                              }
                            #endif
                            
                              sleep(digitalPinToInterrupt(BUTTON_PIN), CHANGE, MEASURE_INTERVAL);
                            }
                            
                            Mark SwiftM M 2 Replies Last reply
                            4
                            • martinhjelmareM martinhjelmare

                              I implemented a check for firmware update message in my modified SenseBenderMicro sketch, and alternative behavior in the loop if FW update is ongoing. This doesn't solve the problem of dropped messages, but could be good to speed up the update and don't waste time on sensor updates.

                              void loop() {
                                if (fwUpdateOngoing) {
                                  fwUpdateOngoing = false;
                                  fwUpdateOngoing = wait(OTA_WAIT_PERIOD, C_STREAM, ST_FIRMWARE_RESPONSE);
                                } else {
                                  normalFlow();
                                }
                              }
                              
                              void normalFlow() {
                                // Short delay to allow buttons to properly settle
                                sleep(5);
                              
                                int buttonValue = digitalRead(BUTTON_PIN);
                              
                                measureCount ++;
                                sendBattery ++;
                                bool forceTransmit = false;
                                transmission_occured = false;
                              #ifndef MY_OTA_FIRMWARE_FEATURE
                                if ((measureCount == 5) && highfreq)
                                {
                                  clock_prescale_set(clock_div_8); // Switch to 1Mhz for the reminder of the sketch, save power.
                                  highfreq = false;
                                }
                              #endif
                              
                                if (measureCount > FORCE_TRANSMIT_INTERVAL) { // force a transmission
                                  forceTransmit = true;
                                  measureCount = 0;
                                }
                              
                                sendTempHumidityMeasurements(forceTransmit);
                                if (buttonValue != oldValue) {
                                   // Send in the new buttonValue
                                   send(msg.set(buttonValue==HIGH ? 0 : 1));
                                   oldValue = buttonValue;
                                   transmission_occured = true;
                                }
                              
                              #ifdef MY_OTA_FIRMWARE_FEATURE
                                if (transmission_occured) {
                                  fwUpdateOngoing = wait(OTA_WAIT_PERIOD, C_STREAM, ST_FIRMWARE_RESPONSE);
                                }
                              #endif
                              
                                sleep(digitalPinToInterrupt(BUTTON_PIN), CHANGE, MEASURE_INTERVAL);
                              }
                              
                              Mark SwiftM Offline
                              Mark SwiftM Offline
                              Mark Swift
                              wrote on last edited by
                              #14
                              This post is deleted!
                              tekkaT 1 Reply Last reply
                              0
                              • Mark SwiftM Mark Swift

                                This post is deleted!

                                tekkaT Offline
                                tekkaT Offline
                                tekka
                                Admin
                                wrote on last edited by
                                #15

                                @Mark-Swift I'm not sure I understood you right - can you explain how this applies to the bootloader?

                                1 Reply Last reply
                                0
                                • Mark SwiftM Offline
                                  Mark SwiftM Offline
                                  Mark Swift
                                  wrote on last edited by Mark Swift
                                  #16
                                  This post is deleted!
                                  1 Reply Last reply
                                  0
                                  • martinhjelmareM martinhjelmare

                                    I implemented a check for firmware update message in my modified SenseBenderMicro sketch, and alternative behavior in the loop if FW update is ongoing. This doesn't solve the problem of dropped messages, but could be good to speed up the update and don't waste time on sensor updates.

                                    void loop() {
                                      if (fwUpdateOngoing) {
                                        fwUpdateOngoing = false;
                                        fwUpdateOngoing = wait(OTA_WAIT_PERIOD, C_STREAM, ST_FIRMWARE_RESPONSE);
                                      } else {
                                        normalFlow();
                                      }
                                    }
                                    
                                    void normalFlow() {
                                      // Short delay to allow buttons to properly settle
                                      sleep(5);
                                    
                                      int buttonValue = digitalRead(BUTTON_PIN);
                                    
                                      measureCount ++;
                                      sendBattery ++;
                                      bool forceTransmit = false;
                                      transmission_occured = false;
                                    #ifndef MY_OTA_FIRMWARE_FEATURE
                                      if ((measureCount == 5) && highfreq)
                                      {
                                        clock_prescale_set(clock_div_8); // Switch to 1Mhz for the reminder of the sketch, save power.
                                        highfreq = false;
                                      }
                                    #endif
                                    
                                      if (measureCount > FORCE_TRANSMIT_INTERVAL) { // force a transmission
                                        forceTransmit = true;
                                        measureCount = 0;
                                      }
                                    
                                      sendTempHumidityMeasurements(forceTransmit);
                                      if (buttonValue != oldValue) {
                                         // Send in the new buttonValue
                                         send(msg.set(buttonValue==HIGH ? 0 : 1));
                                         oldValue = buttonValue;
                                         transmission_occured = true;
                                      }
                                    
                                    #ifdef MY_OTA_FIRMWARE_FEATURE
                                      if (transmission_occured) {
                                        fwUpdateOngoing = wait(OTA_WAIT_PERIOD, C_STREAM, ST_FIRMWARE_RESPONSE);
                                      }
                                    #endif
                                    
                                      sleep(digitalPinToInterrupt(BUTTON_PIN), CHANGE, MEASURE_INTERVAL);
                                    }
                                    
                                    M Offline
                                    M Offline
                                    manutremo
                                    wrote on last edited by
                                    #17

                                    Sorry to revive this old topic but I didn't find any other one that covered this topic.

                                    I started implementing FOTA in all my nodes and was finding some low speeds as described on this topic. I then implemented the checks proposed by @martinhjelmare and they certainly helped :grinning: , although they are not yet perfect.

                                    As I said I didn't other topics covering how to avoid the node from doing anything else while the FOTA is in place, not did I find any other examples on this web nor in the github mysensors examples folder.

                                    Is this the only way to do this, or is there any other better way around since this was published?

                                    1 Reply Last reply
                                    0
                                    • M Offline
                                      M Offline
                                      manutremo
                                      wrote on last edited by
                                      #18

                                      No wonder, I think I found the way... I found there is a function isFirmwareUpdateOngoing() in MyOTAFirmwareUpdate.cpp that seems to provide that functionality in a much easier way :+1:

                                      1 Reply Last reply
                                      1
                                      • Mark SwiftM Offline
                                        Mark SwiftM Offline
                                        Mark Swift
                                        wrote on last edited by
                                        #19

                                        @manutremo please share your method so we can all benefit :)

                                        1 Reply Last reply
                                        0
                                        • M Offline
                                          M Offline
                                          manutremo
                                          wrote on last edited by
                                          #20

                                          If I understood correctly, it should as simple as in loop:

                                          if (!isFirmwareUpdateOngoing()) {
                                          <do whatever>
                                          }

                                          but for the moment take it with a pinch of salt...

                                          1 Reply Last reply
                                          1
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          23

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.0k

                                          Posts


                                          Copyright 2019 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • MySensors
                                          • OpenHardware.io
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular