Program M5CAM fails



  • Hi people, sorry for the messy post, I am not sure how to format here yet. I am sure this wont be my last post.
    I have recompiled the M5CAM_demo in atom/platformio after a few hiccups and am getting the following error (verbose upload)

    *CURRENT: upload_protocol = esptool
    MethodWrapper(["upload"], [".pioenvs\esp-wrover-kit\firmware.bin"])
    Auto-detected: COM40
    "c:\users\col.platformio\penv\scripts\python.exe" "C:\Users\Col.platformio\packages\tool-esptoolpy\esptool.py" --chip esp32 --port "COM40" --baud 921600 --before default_reset --after hard_reset writ
    e_flash -z --flash_mode dio --flash_freq 40m --flash_size detect 0x1000 C:\Users\Col\Documents\PlatformIO\Projects\M5CAM_demo.pioenvs\esp-wrover-kit\bootloader.bin 0x8000 C:\Users\Col\Documents\Platfo
    rmIO\Projects\M5CAM_demo.pioenvs\esp-wrover-kit\partitions.bin 0x10000 .pioenvs\esp-wrover-kit\firmware.bin
    Serial port COM40
    Connecting......................................_____

    A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header
    *** [upload] Error 2*

    The autodetected port is correct, opening it in realterm and toggling camera power.

    ets Jun 8 2016 00:22:57

    rst:0x1 (POWERON_RESET),boot:0x17 (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:5780
    load:0x40078000,len:0
    load:0x40078000,len:15412
    entry 0x40078630
    I (28) boot: ESP-IDF v3.1-dev-1101-g1f7b41e2-dirty 2nd stage bootloader[
    0m
    I (28) boot: compile time 10:53:23

    This is my first time attempting to reprogram this and a search has not brought up anything useful, is there a trick to programming these ? It looks to me that perhaps the reset method is unsuccessful, tried holding the power button down, tried with a lithium cell connected/disconnected. The M5CAM uses the same program method as the wrover-kit so far as I can see from the schematics.

    Any ideas for things to try ?
    A little trickier to add jumpers to toggle pins with these boards.



  • Hi, I solved a similar problem by flashing the camera again. I downloaded the firmware located in: https://github.com/m5stack/esp32-cam-demo. To flash the camera I used this software https://www.espressif.com/sites/default/files/tools/flash_download_tools_v3.6.4.rar.

    Once has been downloaded the tool it has 4 options, I used the option 3 and I configured the tool as show in the image:

    alt text
    I hope this helps you.



  • I have been looking a bit closer at this and trying to make sense of it with and I think there is a simple design error but it should still work.

    this is the WROVER kit control logic ..

    0_1533664928057_5bdcf38a-6917-40c1-acde-e5b4b92f2dd9-image.png

    and this is the M5CAMs

    0_1533664993829_b21be137-0c34-4baa-8ac1-f3e64c359026-image.png

    so it looks like VT2 is reversed but it should still work regardless, it might be affecting the timing perhaps ?

    Using platformio with no mods and the WROVER kit board selected a close look at the reset timing shows that the EN line is always taken high (by about 500nS) after GPIO0 is also taken high, hence it never enters boot mode. I think I can get around it by hacking the esptool.py .. but its late now, 4am, so it can wait till tomorrow.

    a failed program attempt ..

    0_1533665238761_esp32_gpio0_norm_prog_fail.PNG

    and a close up of one of the edges shows GPIO0 always going high about 500nS-1uS before EN goes high.



  • finally have some time to continue on with this, I tried the esp32 download tool with exactly the parameters above and the demo files and I am getting an error in the CMD window of ..

    "imageIsOk()" failed at ....\src\msw\bitmap.cpp(922) in wxBitmap::CreateFromImage(): invalid image

    even if I only select the bootloader.bin section or any single part. odd .. so I looked at using the esptool.py supplied and copied the loader script from the flash.sh (made for linux), that works but I get exactly the same failed to connect as I do with platformio and also the same timing looking at pulseview, not surprising since both methods rely on esptool.

    So I ended up adding a 100nF between the B-E of VT1, oddly enough I cannot see any improvement in the timing on pulseview but it programmed first attempt and every one thereafter so I am leaving it in place. perhaps the timing the ESP sees is a little different to what my salaea clone probe is showing.