HOW DO OTA UPDATES HAPPEN IN THE ESP32? | ADVANCED ESP32

แชร์
ฝัง
  • เผยแพร่เมื่อ 12 มิ.ย. 2024
  • How do OTA Updates happen in the ESP32?
    In this video, we will learn about the use case of OTA Updates in the ESP32. Then we will learn about the Partition Tables and Bootloader of the ESP32. Finally, we will learn the OTA update mechanism in the ESP32.
    (If you liked this video and would like to buy our course, you are in for a pleasant surprise. Please click on the link below to buy the course for $25 ONLY. Original price is $195.
    utm.io/upz1)
    A fantastic feature of any WiFi-enabled microcontroller like the ESP32 is the possibility of using the same WiFi Feature to flash a new program.This will eliminate the need for a physical connection between the device and a PC. So, implementing the OTA Update feature in an ESP32 board will be extremely useful especially if you are into product development.
    Just imagine that you manage a company which makes smart thermostats and more than 10000 devices are on the field. Let's say that you found a security vulnerability in your device and want to patch this bug with an update on all your customer’s devices. In this case, it is not practical to ask the customer to manually update by connecting the thermostat to a PC. Furthermore, your company may have to employ technicians to help customers with this update.
    The simple solution is to implement an OTA Update feature before the product reached the market. Then we can simply update all our devices over the air using WiFi. Is it that simple?
    In practice, it is not that simple as we can’t simply overwrite the current firmware with the security update. There are two reasons for this.
    The first reason is that the current firmware is actually the one running and responsible for performing the network retrieval of data. Thus, while we overwrite with new firmware, the network retrieval instructions might get corrupted and will result in an incomplete update that can disable OTA functionality altogether.
    The second problem is that something could go wrong with the data transmission and we would end up with a partial update which likely would not boot. So, what is the workaround to these hurdles?
    The solution is to load our new code in a completely separate, but equally sized, area of flash memory. If the download of the new code completes successfully, only then use the new partition as the boot partition.
    Before, we look at how this is implemented in ESP32, let's learn what happens inside the flash memory when a new code is flashed via the USB Cable.
    Whenever a new code is flashed to the ESP32, the code is stored inside the flash memory that is attached to the SPI Bus of the ESP32 chip. The flash memory is a non-volatile memory, unlike the RAM inside the ESP32 Chip. Thus, even when the ESP32 is switched off, the code will be safe in the Flash Memory. The Sparkfun ESP32 Thing has a flash memory of size 4 MegaBytes.
    A single ESP32’s flash can contain multiple apps, as well as many different kinds of data like calibration data, file systems, parameter storage, etc. As all these data are present in single flash memory, the ESP32 chip needs a map to locate the position of different data sets. This is done in ESP32 through a concept called Partition Tables. It is just like the Index page of a big book, but with more details of the content, it’s pointing to. The partition table starts at a default offset of 32768 Bytes. It has a size of 3072 bytes with a maximum of 95 distinct table entries. Each table entry is 32 bytes long, thus all the 95 entries together takes 3040 bytes. The last 32 bytes are MDF Checksum used for checking the integrity of the partition table. If you want to know more about the partition tables please visit the link in the resources.
    Summary
    In this video, we have covered the following topics
    ● Why implement OTA Programming in the ESP32
    ● Partition Tables and Bootloader in the ESP32
    ● The OTA Update Mechanism in the ESP32
    (If you liked this video and would like to buy our course, you are in for a pleasant surprise. Please click on the link below to buy the course for $25 ONLY. Original price is $195.
    utm.io/upz1)
    Check us out on
    Website : makerdemy.com
    Catalogue : makerdemy1.teachable.com
    Facebook : / makerdemy
    Twitter : / makerdemy
    LinkedIn : / makerdemy
    Instagram : / makerdemy
    Email : support@makerdemy.com

ความคิดเห็น • 14

  • @MAKERDEMY
    @MAKERDEMY  4 ปีที่แล้ว +2

    Check out the "Advanced ESP32" video playlist
    th-cam.com/play/PLZPR_hmBy0czw9wDUtqp_brOmfrhVPjrQ.html

  • @rodneytapit5636
    @rodneytapit5636 ปีที่แล้ว +2

    Great overview how the Partition Tables / Bootloader is implemented and OTA. One of the clearest tutorials available, well done.

    • @MAKERDEMY
      @MAKERDEMY  ปีที่แล้ว

      Glad it was helpful!

  • @horrorhotel1999
    @horrorhotel1999 2 ปีที่แล้ว +1

    Extremely useful and well explained. This taught me a lot in a very short time.

    • @MAKERDEMY
      @MAKERDEMY  2 ปีที่แล้ว

      Great to hear!

  • @BlondieSL
    @BlondieSL 10 หลายเดือนก่อน

    Sometimes acronyms cause confusion. LOL
    I was searching for "ESP32 OTA TV guide" and this channel came up.
    For decades, OTA has mean, "Over The Air" for receiving television using antennas. Tv shows. LOL
    But clearly, this over the air is referring to wireless updates. LOL
    Oh well... the search is on to see if anyone has implemented an ESP32 with a nice display to pick up TV Guide information for the entered zip code, from the internet.
    I'm not so experienced with ESP32 as yet to do this on my own. But ima learn'n.

  • @crashbuilds
    @crashbuilds 3 ปีที่แล้ว +2

    This was very useful, thank you doing this!

    • @MAKERDEMY
      @MAKERDEMY  3 ปีที่แล้ว

      You're welcome

  • @fab65400
    @fab65400 2 ปีที่แล้ว +1

    Hi, Thank you for your video, is there a way to perform ôta using classic bluetooth (not ble) thks

  • @edgardsalas8269
    @edgardsalas8269 ปีที่แล้ว

    Thank you very much for your video, it is very useful, but i have doubts about the OTA data partition, i explain my doubts: such partition has 0x2000 bytes being 2 sectors de 4kb, how these bytes are filled???. The bootloader will see the OTA data partition to select the firmware partition to boot, i can fill the bytes of firmware partitions but how i fill the bytes of OTA data partition?.
    Again I thank you in advance for your help.

  • @shamilyazeen4062
    @shamilyazeen4062 3 ปีที่แล้ว

    any way to upload Spiffs via OTA??

    • @MAKERDEMY
      @MAKERDEMY  3 ปีที่แล้ว

      Hi Shamil Yazeen,
      In this video, the SPIFFS method is not used for the OTA Update. If you want to implement the same, we have found some great resources to acheve the implementation.
      techtutorialsx.com/2019/07/21/esp32-arduino-updating-firmware-from-the-spiffs-file-system/
      learn.sparkfun.com/tutorials/esp32-ota-updates-over-ble-from-a-react-web-application/all
      randomnerdtutorials.com/install-esp32-filesystem-uploader-arduino-ide/
      We hope this was helpful.
      Thank You.

  • @rowifi
    @rowifi 3 ปีที่แล้ว

    Why do I see the arduino default partition has only one ota section?

    • @MAKERDEMY
      @MAKERDEMY  3 ปีที่แล้ว +1

      Hi Rowifi.
      If you are referring to why the partition scheme for your ESP32 board in Arduino IDE is showing only 1 OTA Partition, it is because the partition schemes are set by the specific manufactures of the Development Board. For example, SparkFun ESP32 boards may have totally different skews of partition schemes as opposed to the ESP32 WROOM Dev Boards. This is because different manufacturers source different types of flash memory chips from different vendors and design the partition schemes that are optimum for them. However, you can design your own partition schemes if you wish. We hope this was helpful. Thank You.