4
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ESP32開発ボードへの書き込み時のエラー

Last updated at Posted at 2018-05-02

#コンパイルは通るけど書き込みでエラー
「A fatal error occurred: Timed out waiting for packet header」となり書き込みに失敗。
webで調べてみるとUpload speedが早すぎるため発生するようで、230400bpsに落としてみても発生。
ある時は「A fatal error occurred: MD5 of file does not match data in flash!」というファイルのチェックサムエラーまで。

次のフォルダのライブラリBLEバージョン0.4.12を使用中:C:\Users\UserName\Documents\Arduino\hardware\espressif\esp32\libraries\BLE 
最大1638400バイトのフラッシュメモリのうち、スケッチが1235369バイト(75%)を使っています。
最大294912バイトのRAMのうち、グローバル変数が46656バイト(15%)を使っていて、ローカル変数で248256バイト使うことができます。
C:\Users\UserName\Documents\Arduino\hardware\espressif\esp32/tools/esptool.exe --chip esp32 --port COM17 --baud 230400 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size detect 0xe000 C:\Users\UserName\Documents\Arduino\hardware\espressif\esp32/tools/partitions/boot_app0.bin 0x1000 C:\Users\UserName\Documents\Arduino\hardware\espressif\esp32/tools/sdk/bin/bootloader_qio_80m.bin 0x10000 C:\Users\UserName\AppData\Local\Temp\arduino_build_583622/BLE_notify_test02_HC-SR04.ino.bin 0x8000 C:\Users\UserName\AppData\Local\Temp\arduino_build_583622/BLE_notify_test02_HC-SR04.ino.partitions.bin 
esptool.py v2.3.1
Connecting....
Chip is ESP32D0WDQ6 (revision 1)
Features: WiFi, BT, Dual Core
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 230400
Changed.
Configuring flash size...
Warning: Could not auto-detect Flash size (FlashID=0x0, SizeID=0x0), defaulting to 4MB
Compressed 8192 bytes to 47...

Writing at 0x0000e000... (100 %)
Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.0 seconds (effective 3449.3 kbit/s)...

A fatal error occurred: Timed out waiting for packet header
A fatal error occurred: Timed out waiting for packet header

#何度かトライしているうちに書き込み出来るようになった
Upload speedを115200bpsまで落としてもエラーが発生し、ヤケになって何度も書き込みをリトライしているうちに成功するようになった。
試しに速度を921600bpsに戻してみると、書き込みが成功した。原因と対策が不明のまま解決?というイヤなパターン。

次のフォルダのライブラリBLEバージョン0.4.12を使用中:C:\Users\UserName\Documents\Arduino\hardware\espressif\esp32\libraries\BLE 
最大1638400バイトのフラッシュメモリのうち、スケッチが1236637バイト(75%)を使っています。
最大294912バイトのRAMのうち、グローバル変数が46664バイト(15%)を使っていて、ローカル変数で248248バイト使うことができます。
C:\Users\UserName\Documents\Arduino\hardware\espressif\esp32/tools/esptool.exe --chip esp32 --port COM19 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size detect 0xe000 C:\Users\UserName\Documents\Arduino\hardware\espressif\esp32/tools/partitions/boot_app0.bin 0x1000 C:\Users\UserName\Documents\Arduino\hardware\espressif\esp32/tools/sdk/bin/bootloader_dio_80m.bin 0x10000 C:\Users\UserName\AppData\Local\Temp\arduino_build_583622/BLE_notify_test02_HC-SR04.ino.bin 0x8000 C:\Users\UserName\AppData\Local\Temp\arduino_build_583622/BLE_notify_test02_HC-SR04.ino.partitions.bin 
esptool.py v2.3.1
Connecting....
Chip is ESP32D0WDQ6 (revision 1)
Features: WiFi, BT, Dual Core
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
Configuring flash size...
Auto-detected Flash size: 4MB
Compressed 8192 bytes to 47...

Writing at 0x0000e000... (100 %)
Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.0 seconds (effective 4369.1 kbit/s)...
Hash of data verified.
Compressed 12480 bytes to 8255...

Writing at 0x00001000... (100 %)
Wrote 12480 bytes (8255 compressed) at 0x00001000 in 0.1 seconds (effective 798.7 kbit/s)...
Hash of data verified.
Compressed 1237792 bytes to 655567...

Writing at 0x00010000... (2 %)
Writing at 0x00014000... (4 %)
Writing at 0x00018000... (7 %)
Writing at 0x0001c000... (9 %)
Writing at 0x00020000... (12 %)
Writing at 0x00024000... (14 %)
Writing at 0x00028000... (17 %)
Writing at 0x0002c000... (19 %)
Writing at 0x00030000... (21 %)
Writing at 0x00034000... (24 %)
Writing at 0x00038000... (26 %)
Writing at 0x0003c000... (29 %)
Writing at 0x00040000... (31 %)
Writing at 0x00044000... (34 %)
Writing at 0x00048000... (36 %)
Writing at 0x0004c000... (39 %)
Writing at 0x00050000... (41 %)
Writing at 0x00054000... (43 %)
Writing at 0x00058000... (46 %)
Writing at 0x0005c000... (48 %)
Writing at 0x00060000... (51 %)
Writing at 0x00064000... (53 %)
Writing at 0x00068000... (56 %)
Writing at 0x0006c000... (58 %)
Writing at 0x00070000... (60 %)
Writing at 0x00074000... (63 %)
Writing at 0x00078000... (65 %)
Writing at 0x0007c000... (68 %)
Writing at 0x00080000... (70 %)
Writing at 0x00084000... (73 %)
Writing at 0x00088000... (75 %)
Writing at 0x0008c000... (78 %)
Writing at 0x00090000... (80 %)
Writing at 0x00094000... (82 %)
Writing at 0x00098000... (85 %)
Writing at 0x0009c000... (87 %)
Writing at 0x000a0000... (90 %)
Writing at 0x000a4000... (92 %)
Writing at 0x000a8000... (95 %)
Writing at 0x000ac000... (97 %)
Writing at 0x000b0000... (100 %)
Wrote 1237792 bytes (655567 compressed) at 0x00010000 in 12.1 seconds (effective 815.5 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 146...

Writing at 0x00008000... (100 %)
Wrote 3072 bytes (146 compressed) at 0x00008000 in 0.0 seconds (effective 1445.7 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
4
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?