1 Reply Latest reply on Oct 13, 2020 2:24 AM by ChunleiL_51

    OTA Using test.mosquitto.org unstable...

    ZhZh_1423891

      I am testing 'AnyCloud_OTA_Using_MQTT' .

      Thanks  ChunleiL_51 gave me many helps.

      I follow readme.md step,but not success, as below

       

      ===============================================================

      TEST Application: OTA Update version: 1.0.0

      ===============================================================

      WLAN MAC Address : C4:AC:59:77:0A:22

      WLAN Firmware    : wl0: Jan 30 2020 21:41:53 version 7.45.98.95 (r724303 CY) FWID 01-5afc8c1e

      WLAN CLM         : API: 12.2 Data: 9.10.39 Compiler: 1.29.4 ClmImport: 1.36.3 Creation: 2020-01-30 21:30:05

      WHD VERSION      : v1.91.2 : v1.91.2 : GCC 7.2 : 2020-06-25 02:15:47 -0500

      Successfully connected to Wi-Fi network 'ASUS'.

      [WARN ][OTA][15530] Erasing Secondary Slot...

      [WARN ][OTA][17482] Erasing Secondary Slot Done.

       

      Application OTA callback ctx:0x8037008 reason:8 OTA CONNECTING value:0 state:4 OTA STATE CONNECTING OTA NO ERRORS

      [INFO ][OTA][17485] Establishing MQTT Connection for CY_IOT_DEVICE to test.mosquitto.org port:8884...

       

      [INFO ][OTA][17494] MQTT unique client identifier is CY_IOT_DEVICE17494 (length 18).

       

      Application OTA callback ctx:0x8037008 reason:9 OTA CONENCTED TO SERVER value:0 state:4 OTA STATE CONNECTING OTA NO ERRORS

      Application OTA callback ctx:0x8037008 reason:10 OTA DOWNLOAD STARTED value:0 state:5 OTA STATE DOWNLOADING OTA NO ERRORS

      [INFO ][OTA][23089]

      MQTT Subscribe for Messages..............

       

      [INFO ][OTA][23545]

      All topic filter subscriptions accepted.......

       

      [WARN ][OTA][28299] OUT OF ORDER last:0 current:11

       

      Application OTA callback ctx:0x8037008 reason:11 OTA DOWNLOAD PERCENT value:0 state:5 OTA STATE DOWNLOADING OTA NO ERRORS

      Application OTA callback ctx:0x8037008 reason:11 OTA DOWNLOAD PERCENT value:0 state:5 OTA STATE DOWNLOADING OTA NO ERRORS

      Application OTA callback ctx:0x8037008 reason:11 OTA DOWNLOAD PERCENT value:1 state:5 OTA STATE DOWNLOADING OTA NO ERRORS

      Application OTA callback ctx:0x8037008 reason:11 OTA DOWNLOAD PERCENT value:1 state:5 OTA STATE DOWNLOADING OTA NO ERRORS

      Application OTA callback ctx:0x8037008 reason:11 OTA DOWNLOAD PERCENT value:2 state:5 OTA STATE DOWNLOADING OTA NO ERRORS

      Application OTA callback ctx:0x8037008 reason:11 OTA DOWNLOAD PERCENT value:2 state:5 OTA STATE DOWNLOADING OTA NO ERRORS

      Application OTA callback ctx:0x8037008 reason:11 OTA DOWNLOAD PERCENT value:3 state:5 OTA STATE DOWNLOADING OTA NO ERRORS

      [WARN ][OTA][38312] OUT OF ORDER last:18 current:20

      [WARN ][OTA][38331] OUT OF ORDER last:20 current:19

      [WARN ][OTA][38345] OUT OF ORDER last:19 current:21

      ...............

      ...............

      Application OTA callback ctx:0x8037008 reason:11 OTA DOWNLOAD PERCENT value:94 state:5 OTA STATE DOWNLOADING OTA NO ERRORS

      [WARN ][OTA][261747] OTA Timeout waiting for a packet (60 seconds), fail

       

      Application OTA callback ctx:0x8037008 reason:3 OTA DOWNLOAD FAILED value:0 state:5 OTA STATE DOWNLOADING OTA NO ERRORS

      [WARN ][OTA][261753] Erasing Secondary Slot...

        • 1. Re: OTA Using test.mosquitto.org unstable...
          ChunleiL_51

          Hi,

           

          It seems you are facing some network connection exceptions.

          Because the device can receive some of the packets. And other packets are OUT OF ORDER or missing.

          You can verify this by running the procedure for several times, to see if the numbers shown in the log appear exactly the same each time, as below:

          [WARN ][OTA][38312] OUT OF ORDER last:18 current:20

          [WARN ][OTA][38331] OUT OF ORDER last:20 current:19

          [WARN ][OTA][38345] OUT OF ORDER last:19 current:21

          MQTT is an unreliable protocol that only offers connectionless interaction model. So each queued transmission can arrive in disorder due to the Internet routing / message queueing situation.

           

          \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

          After some trying, I found that this issue can be easily solved:

          Simply publish the new firmware using script mqtt_ota_publisher.py again and again, until the device receive all the chunked data.

           

          Explanation:

          The thing we must know is, the chunked firmware packets may be delivered in disorder to the device each time, due to the Internet routing / message queueing situation. It's inevitable because it's MQTT. So the device will miss some chunks in a round because it‘s designed to receive the chunks in sequence.

          But it's okay. In the next round, you publish the firmware again. This time, the packets may also arrive in disorder but the situation won't be exactly the same as the previous round, because it's random. Then the device will pick up from where it's left and hopefully it will make some progress in receiving the firmware in this round.

          Give it a few more rounds. Finally it will reach to 100% and the device will be upgraded, as follows:

          In the picture, we can see that though "OUT OF ORDER" appears, the OTA procedure completes successfully.

           

          Note:

          In fact, you can simply ignore the lines

          "[WARN ][OTA][38345] OUT OF ORDER last:xx current:yy"

          and focus on the lines

          "Application OTA callback ctx:0x80346c0 reason:11 OTA DOWNLOAD PERCENT value:zz state:5 OTA STATE DOWNLOADING OTA NO ERRORS"

          where the value zz indicates OTA DOWNLOAD PERCENT.

          As we don't have control on MQTT message queueing, republishing the data to the subscribers may be the best way to make sure the devices get the data correctly.

           

          Best regards

          1 of 1 people found this helpful