Unable to flash TimerCam-F with AWS-S3-PUT IDF example from M5Stack

I am compiling the project successfully with a few minor changes.

  • MacOS 13.4 Ventura on Apple M2 Mac Air
  • VS Code 1.85.1
  • framework-espidf @ 3.50102.0 (5.1.2)
  • tool-cmake @ 3.16.4
  • tool-esptoolpy @ 1.40501.0 (4.5.1)
  • tool-mkfatfs @ 2.0.1
  • tool-mklittlefs @ 1.203.210628 (2.3)
  • tool-mkspiffs @ 2.230.0 (2.30)
  • tool-ninja @ 1.9.0
  • tool-openocd-esp32 @ 2.1100.20220706 (11.0)
  • tool-riscv32-esp-elf-gdb @ 12.1.0+20221002
  • tool-xtensa-esp-elf-gdb @ 12.1.0+20221002
  • toolchain-esp32ulp @ 1.23500.220830 (2.35.0)
  • toolchain-xtensa-esp32 @ 12.2.0+20230208
[platformio]
src_dir = main

[env:m5stack-timer-cam]
platform = espressif32@^6.0.1
board = m5stack-timer-cam
framework = espidf
upload_protocol = esptool
lib_deps = m5stack/Timer-CAM@^1.0.0

uploading to device fails with


Processing m5stack-timer-cam (platform: espressif32@^6.0.1; board: m5stack-timer-cam; framework: espidf)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/m5stack-timer-cam.html
PLATFORM: Espressif 32 (6.5.0) > M5Stack Timer CAM
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, 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-espidf @ 3.50102.0 (5.1.2) 
 - tool-cmake @ 3.16.4 
 - tool-esptoolpy @ 1.40501.0 (4.5.1) 
 - tool-mkfatfs @ 2.0.1 
 - tool-mklittlefs @ 1.203.210628 (2.3) 
 - tool-mkspiffs @ 2.230.0 (2.30) 
 - tool-ninja @ 1.9.0 
 - tool-openocd-esp32 @ 2.1100.20220706 (11.0) 
 - tool-riscv32-esp-elf-gdb @ 12.1.0+20221002 
 - tool-xtensa-esp-elf-gdb @ 12.1.0+20221002 
 - toolchain-esp32ulp @ 1.23500.220830 (2.35.0) 
 - toolchain-xtensa-esp32 @ 12.2.0+20230208
Reading CMake configuration...
Warning! Flash memory size mismatch detected. Expected 4MB, found 2MB!
Please select a proper value in your `sdkconfig.defaults` or via the `menuconfig` target!
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Retrieving maximum program size .pio/build/m5stack-timer-cam/firmware.elf
Checking size .pio/build/m5stack-timer-cam/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=         ]  11.6% (used 38052 bytes from 327680 bytes)
Flash: [==========]  96.0% (used 1006333 bytes from 1048576 bytes)
Configuring upload protocol...
AVAILABLE: cmsis-dap, esp-bridge, 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 = esptool
Looking for upload port...
Auto-detected: /dev/cu.usbserial-59527C0548
Uploading .pio/build/m5stack-timer-cam/firmware.bin
esptool.py v4.5.1
Serial port /dev/cu.usbserial-59527C0548
Connecting....
Chip is ESP32-D0WDQ6-V3 (revision v3.1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: b0:b2:1c:60:bf:b0
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.

A fatal error occurred: Unable to verify flash chip connection (No serial data received.).
*** [upload] Error 2

When I have encountered this situation I have to hold the button on the back of the unit, unplug and replug the M5Dial. Then it will flash but not start automatically. I then have to power cycle again (unplug / replug usb) and it starts.

This annoying behavior started recently. Previously i would just click upload and it would work. But this process works reliably for me.