LoginSignup
KenjiMaehara
@KenjiMaehara (Kenji maemae)

Are you sure you want to delete the question?

Leaving a resolved question undeleted may help others!

platformioでESP32にファームウェアを書き込めない

解決したいこと

VSCode + platformioでESP32用のプロジェクトを作成しています。
ビルドは成功したのですが、ファームウェアを書き込もうと”Upload”を実施してもエラーが出てESP32に書き込みが失敗してしまいます。
ちゃんとplatformioとESP32の書き込みの通信接続ができているのかご教示の程宜しくお願い致します。

発生している問題・エラー

> Executing task: C:\Users\kmaeh\.platformio\penv\Scripts\platformio.exe run --target upload <

Processing esp32dev (platform: espressif32; board: esp32dev; framework: arduino)
--------------------------------------------------------------------------------------------------------------------

Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (2.0.0) > Espressif ESP32 Dev Module
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (minimodule) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
 - framework-arduinoespressif32 3.10004.200129 (1.0.4)
 - tool-esptoolpy 1.20600.0 (2.6.0)
 - tool-mkspiffs 2.230.0 (2.30)
 - tool-openocd-esp32 1.1000.20190709 (10.0)
 - toolchain-xtensa32 2.50200.80 (5.2.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 41 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <TFT_eSPI> 2.3.2
|   |-- <SPIFFS> 1.0
|   |   |-- <FS> 1.0
|   |-- <FS> 1.0
|   |-- <SPI> 1.0
|-- <lv_arduino> 3.0.1
|-- <ESP32 BLE Arduino> 1.0.1
Building in debug mode
Retrieving maximum program size .pio\build\esp32dev\firmware.elf
Checking size .pio\build\esp32dev\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   4.8% (used 15820 bytes from 327680 bytes)
Flash: [==        ]  21.4% (used 280403 bytes from 1310720 bytes)
Configuring upload protocol...
AVAILABLE: esp-prog, espota, esptool, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa
CURRENT: upload_protocol = minimodule
Uploading .pio\build\esp32dev\firmware.bin
Open On-Chip Debugger  v0.10.0-esp32-20190708 (2019-07-08-11:04)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
debug_level: 1
adapter speed: 20000 kHz
esp32 interrupt mask on
Error: no device found
Error: unable to open ftdi device with vid 0403, pid 6010, description 'FT2232H MiniModule', serial '*' at bus location '*'
** OpenOCD init failed **
shutdown command invoked

Warn : Flash driver of esp32.flash does not support free_driver_priv()
Warn : Flash driver of irom does not support free_driver_priv()
Warn : Flash driver of drom does not support free_driver_priv()
*** [upload] Error 1
============================================ [FAILED] Took 4.22 seconds ============================================
The terminal process "C:\Users\kmaeh\.platformio\penv\Scripts\platformio.exe 'run', '--target', 'upload'" terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.

自分で試したこと

platformio.iniには、次のように設定しています。

platformio.ini
[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
debug_tool = minimodule
monitor_port = COM12
monitor_speed = 115200
upload_speed = 460800
upload_protocol = minimodule
build_type = debug
lib_deps = bodmer/TFT_eSPI@^2.3.2

現在PCとESP32をUSBケーブルで直接つないでいます。
その際にデバイスマネージャで確認してみるとCOM12と表示されている状態です。

0

2Answer

確認ですが、

  • ESP32のモジュールはどこで買いましたか(商品ページURL)?
  • VSCodeのバージョン
  • PlatformIOのバージョン
  • 一応windowsのバージョン
0

Comments

  1. @KenjiMaehara

    Questioner
    ESP32にUSBケーブルでPCにつなげてTeraTermでシリアル通信させて、リセットボタンを押したときのスタートのデータが下のものです。

    rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
    flash read err, 1000
    ets_main.c 371
    ets Jun 8 2016 00:22:57

    rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
    configsip: 0, SPIWP:0xee
    clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
    mode:DIO, clock div:2
    load:0x3fff0018,len:4
    load:0x3fff001c,len:1216
    ho 0 tail 12 room 4
    load:0x40078000,len:9720
    ho 0 tail 12 room 4
    load:0x40080400,len:6364
    entry 0x400806b8


  2. @KenjiMaehara

    Questioner
    VScodeのVersion

    Version: 1.50.1 (user setup)
    Commit: d2e414d9e4239a252d1ab117bd7067f125afd80a
    Date: 2020-10-13T15:06:15.712Z
    Electron: 9.2.1
    Chrome: 83.0.4103.122
    Node.js: 12.14.1
    V8: 8.3.110.13-electron.0
    OS: Windows_NT x64 10.0.18362
  3. @KenjiMaehara

    Questioner
    Platformioのversion

    PS D:\test\EST32Test20201009\lvglTest20201003> platformio --version
    PlatformIO, version 5.0.1
    PS D:\test\EST32Test20201009\lvglTest20201003>
  4. @KenjiMaehara

    Questioner
    PCのスペック

    プロセッサ Intel(R)Core(TM)i9-9900K CPU @ 3.60 GHz
    実装RAM 16.0GB(15.9GB 使用可能)

SimpleKalmanFilter_pressureKalmanFilter__•_Untitled-1_—_ms5611.png

一度この削除ボタンを押して一回ビルドした内容を綺麗にしてから再度アップロードしたらどうですか?

またはlib_depsなどを一切入れないまっさらな状態(New Project)をビルドしても起動が失敗しますか?

boardをesp32doit-devkit-v1に選択して、New Projectをしたらどうなりますか?

0

Comments

  1. @KenjiMaehara

    Questioner
    一度削除ボタンを押してきれいにしてから再アップロードというのをやってみたのですが、やはり同じようなエラーが発生してしまいます。

    Executing task: C:\Users\kmaeh.platformio\penv\Scripts\platformio.exe run --target upload <

    Processing esp32dev (platform: espressif32; board: esp32dev; framework: arduino)
    Verbose mode can be enabled via -v, --verbose option
    CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
    PLATFORM: Espressif 32 (2.0.0) > Espressif ESP32 Dev Module
    HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
    DEBUG: Current (minimodule) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
    PACKAGES:
    - framework-arduinoespressif32 3.10004.200129 (1.0.4)
    - tool-esptoolpy 1.20600.0 (2.6.0)
    - tool-mkspiffs 2.230.0 (2.30)
    - tool-openocd-esp32 1.1000.20190709 (10.0)
    - toolchain-xtensa32 2.50200.80 (5.2.0)
    LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
    LDF Modes: Finder ~ chain, Compatibility ~ soft
    Found 41 compatible libraries
    Scanning dependencies...
    Dependency Graph
    |-- 2.3.2
    | |-- 1.0
    | | |-- 1.0
    | |-- 1.0

    | |-- 1.0

    |-- 3.0.1
    |-- 1.0.1
    Building in debug mode
    Archiving .pio\build\esp32dev\liba04\liblv_arduino.a
    Linking .pio\build\esp32dev\firmware.elf
    Building .pio\build\esp32dev\firmware.bin
    Retrieving maximum program size .pio\build\esp32dev\firmware.elf
    Checking size .pio\build\esp32dev\firmware.elf
    Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
    RAM: [ ] 4.8% (used 15820 bytes from 327680 bytes)
    Flash: [== ] 19.6% (used 257547 bytes from 1310720 bytes)
    esptool.py v2.6
    Configuring upload protocol...
    AVAILABLE: esp-prog, espota, esptool, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h,
    olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa
    CURRENT: upload_protocol = minimodule
    Uploading .pio\build\esp32dev\firmware.bin
    Open On-Chip Debugger v0.10.0-esp32-20190708 (2019-07-08-11:04)
    Licensed under GNU GPL v2
    For bug reports, read
    http://openocd.org/doc/doxygen/bugs.html
    debug_level: 1
    adapter speed: 20000 kHz
    esp32 interrupt mask on
    Error: no device found
    Error: unable to open ftdi device with vid 0403, pid 6010, description 'FT2232H MiniModule', serial '' at bus location ''
    ** OpenOCD init failed **
    shutdown command invoked

    Warn : Flash driver of esp32.flash does not support free_driver_priv()
    Warn : Flash driver of irom does not support free_driver_priv()
    Warn : Flash driver of drom does not support free_driver_priv()
    *** [upload] Error 1
    ========================================== [FAILED] Took 6.75 seconds ==========================================
    The terminal process "C:\Users\kmaeh.platformio\penv\Scripts\platformio.exe 'run', '--target', 'upload'" terminated with exit code: 1.

    Terminal will be reused by tasks, press any key to close it.
  2. @KenjiMaehara

    Questioner
    現在使っているESP32の基板ですが、flash領域を4Mbyteから16Mbyteにする改造を行っているのですが、今回の現象と何か関係はありますでしょうか?
  3. @KenjiMaehara

    Questioner
    VSCodeで始めるESP32デバッグ ~ハイパワーUSBシリアルデバッガ~ https://youtu.be/iNUwrOVPoh8 @YouTubeより

    こちらの動画を参考にして、新しいプロジェクトを新規作成して行ってみたところ、”upload”はできました。
    ただ、”start debug”は同様のエラーが出てくることが判りました。


    このような警告メッセージボックスが出てきます。
    Failed to launch GDB: .pioinit:11 : Error in sourced command file:
    Remote communication error. Target disconnected.: No error.(from interpreter-exec console "source .pioinit")


    動画内ではすんなり動作できているように見えるのですが、これはデバッガ側のESP32との接続が不良だったり、そのような関係の問題でしょうか?

  4. @KenjiMaehara

    Questioner
    ただ、依然としてデバッグはできない状態です。
  5. @KenjiMaehara

    Questioner
    お世話になっております。この件に関しまして、デバッグができるようになりました。
    教えて頂いたサイト記事の”ハマリポイント3 設定ファイル”の項目の
    ~/.platformio/packages/tool-openocd-esp32/share/openocd/scripts/interface/ftdi/minimodule.cfg

    このファイル内容を

    interface ftdi
    ftdi_vid_pid 0x0403 0x6014
    ftdi_layout_init 0x0008 0x000b
    ftdi_layout_signal nSRST -data 0x0020 -oe 0x0020

    こちらの内容に修正したところ、エラーは出ず、デバッグに移行できるようになりました。

    助かります。



    この質問項目にて、ファームウェアアップロードとデバッグの方法を混同してしまいまして大変申し訳ありません。

Your answer might help someone💌