Getting started with esptool for ESP8266 & ESP32

Поделиться
HTML-код
  • Опубликовано: 21 июл 2024
  • Esptool is ESP8266 and ESP32 serial bootloader utility. This video tutorial demonstrates how to write binary blob to a ESP-based device, aka upload firmware. The example uses the open source hardware development board ANAVI Thermometer.
    Learn more and download esptool from:
    github.com/espressif/esptool
    0:00 esptool
    0:55 Required Hardware
    1:53 Using esptool
    2:35 Step 1: Install esptool
    3:09 Step 2: Connect to PC
    3:56 Step 3: Flash Firmware
    6:05 FAQ
  • НаукаНаука

Комментарии • 18

  • @pavlusa
    @pavlusa Год назад +1

    Thank you very informative !!!

  • @daniilegle9094
    @daniilegle9094 4 года назад +2

    I am using pip3 (cmd Windows 10) to install esptool, since this is the latest version I have installed previously with Python 3.8. First it was showing an error while downloading ecdsa..., so I reinstalled wheel, and did this time pip3 installed esptool successfully.

    • @LeonAnavi
      @LeonAnavi  4 года назад +2

      Thanks for the useful feedback. Great for figuring out the problem on Windows 10. I am sure that you comment will be useful to other Windows users.

  • @bennguyen1313
    @bennguyen1313 Год назад +1

    Is it possible to press the boot button and program only via putty/serial-terminal?
    Everything I've seen requires installing too much software (arduino ide, esp32 idf, vs-code, etc)... using just the esptool 4.4 executable seems like the next best thing.
    The espressif download tool seems too error-prone.. is it possible to erase the bootloader?

    • @LeonAnavi
      @LeonAnavi  Год назад

      Yes, esptool is a command line tool. The button is required to help GPIO0 low on reset to enter flashing mode. By default there is a bootloader protection to avoid mistakes when flashing:
      docs.espressif.com/projects/esptool/en/latest/esp32/esptool/basic-commands.html#bootloader-protections

  • @coin777
    @coin777 2 года назад

    3:00 i cant install this. I have this error message:
    pi@raspberrypi:~ $ sudo pip install esptool
    sudo: pip: command not found

    • @LeonAnavi
      @LeonAnavi  2 года назад

      Could you try using pip3 for Python 3 modules as in the example below? Are you using Raspberry Pi OS (previously known as Raspbian)?
      sudo pip3 install esptool

  • @Duncanwg7
    @Duncanwg7 4 года назад +1

    What is pip for windows

    • @LeonAnavi
      @LeonAnavi  4 года назад

      Please have a look at the official documentation for installing Python 3 on Windows. There is an installer and if you select "Install now" the standard library, test suite, launcher and pip will be installed. Details are available here:
      docs.python.org/3/using/windows.html

  • @oieieio741
    @oieieio741 Год назад +1

    Awesome, and Thank you for the video. It helped me learn to flash my ttgo-t-display. This command worked for me "esptool --port /dev/ttyACM0 --baud 460800 write_flash --flash_size=detect 0 LilyGo_T_Display_20200414.bin"

    • @LeonAnavi
      @LeonAnavi  Год назад

      I am happy to hear the video is useful! Thank you for the feedback about ttgo-t-display.

  • @simoniuukis9541
    @simoniuukis9541 Год назад

    where did you download thet file

    • @LeonAnavi
      @LeonAnavi  Год назад

      Which of the files from the video do you have in mind? Details about esptool are available at:
      github.com/espressif/esptool
      docs.espressif.com/projects/esptool/en/latest/esp32/

  • @thorstenjoos5620
    @thorstenjoos5620 Год назад

    Hello, I want to flash a Wemos D1 mini (ESP8266) with esptool and OS Linux Mint, but I got following error messages and I found no solution. May you can help me, thanks in advance Thorsten
    sudo esptool --port /dev/ttyUSB0 --baud 9600 write_flash 0x0 firmware.bin
    [sudo] Passwort für thorsten:
    esptool.py v2.8
    Serial port /dev/ttyUSB0
    Connecting...
    Traceback (most recent call last):
    File "/usr/bin/esptool", line 3101, in
    _main()
    File "/usr/bin/esptool", line 3094, in _main
    main()
    File "/usr/bin/esptool", line 2885, in main
    esp = ESPLoader.detect_chip(each_port, initial_baud, args.before, args.trace)
    File "/usr/bin/esptool", line 274, in detect_chip
    detect_port.connect(connect_mode)
    File "/usr/bin/esptool", line 475, in connect
    last_error = self._connect_attempt(mode=mode, esp32r0_delay=False)
    File "/usr/bin/esptool", line 433, in _connect_attempt
    self._setDTR(False) # IO0=HIGH
    File "/usr/bin/esptool", line 399, in _setDTR
    self._port.setDTR(state)
    File "/usr/lib/python3/dist-packages/serial/serialutil.py", line 603, in setDTR
    self.dtr = value
    File "/usr/lib/python3/dist-packages/serial/serialutil.py", line 473, in dtr
    self._update_dtr_state()
    File "/usr/lib/python3/dist-packages/serial/serialposix.py", line 715, in _update_dtr_state
    fcntl.ioctl(self.fd, TIOCMBIC, TIOCM_DTR_str)
    OSError: [Errno 22] Invalid argument
    Error in sys.excepthook:
    Traceback (most recent call last):
    File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 153, in apport_excepthook
    with os.fdopen(os.open(pr_filename,
    FileNotFoundError: [Errno 2] No such file or directory: '/var/crash/_usr_share_esptool_esptool.py.0.crash'
    Original exception was:
    Traceback (most recent call last):
    File "/usr/bin/esptool", line 3101, in
    _main()
    File "/usr/bin/esptool", line 3094, in _main
    main()
    File "/usr/bin/esptool", line 2885, in main
    esp = ESPLoader.detect_chip(each_port, initial_baud, args.before, args.trace)
    File "/usr/bin/esptool", line 274, in detect_chip
    detect_port.connect(connect_mode)
    File "/usr/bin/esptool", line 475, in connect
    last_error = self._connect_attempt(mode=mode, esp32r0_delay=False)
    File "/usr/bin/esptool", line 433, in _connect_attempt
    self._setDTR(False) # IO0=HIGH
    File "/usr/bin/esptool", line 399, in _setDTR
    self._port.setDTR(state)
    File "/usr/lib/python3/dist-packages/serial/serialutil.py", line 603, in setDTR
    self.dtr = value
    File "/usr/lib/python3/dist-packages/serial/serialutil.py", line 473, in dtr
    self._update_dtr_state()
    File "/usr/lib/python3/dist-packages/serial/serialposix.py", line 715, in _update_dtr_state
    fcntl.ioctl(self.fd, TIOCMBIC, TIOCM_DTR_str)
    OSError: [Errno 22] Invalid argument

    • @LeonAnavi
      @LeonAnavi  Год назад

      Hi Thorsten, could you please check the port? Is /dev/ttyUSB0 existing? Is the lsusb command listing to UART to USB debug converter?

    • @thorstenjoos5620
      @thorstenjoos5620 Год назад +1

      Hello Leon, good news. I found the issue. I tried to flash Wemos Mini D1 over its own usb io connection. This was not possible. And as you wrote ".. listing to UART to USB debug converter .." I disconnect the internal USB io connection of the Wemos Mini D1 and I used a TTL2USB Converter (CP2102) - that was it. With the TTL2USB Contverter, it was possible to flash the Wemos Mini D1. Thanks a lot Leon, you show me the right way to solve my problems, best regards Thorsten

    • @LeonAnavi
      @LeonAnavi  Год назад

      @@thorstenjoos5620 well done for solving the issue and flashing the board! Adding a UART to USB is a user-friendly for development but increases the bill of materials so some ESP boards just skip it.
      I think Wemos Mini D1 comes with built-in CH340 USB to UART converter. If it is not listed by lsusb when you have the board plugged into a PC with Linux this probably is a driver issue. So you might just need to install/configure the driver. If this is the case, SparkFun offers a nice (but bit old) tutorial: learn.sparkfun.com/tutorials/how-to-install-ch340-drivers/all