cesanta / mongoose-os

Mongoose OS - an IoT Firmware Development Framework. Supported microcontrollers: ESP32, ESP8266, CC3220, CC3200, STM32F4, STM32L4, STM32F7. Amazon AWS IoT, Microsoft Azure, Google IoT Core integrated. Code in C or JavaScript.
https://mongoose-os.com
Other
2.51k stars 429 forks source link

Flash Errors #458

Closed gopalakrishnan-subramani closed 5 years ago

gopalakrishnan-subramani commented 5 years ago

Getting this error every time when I try to flash. I connected to ESP32, flash is working fine only after 3-5 retries, never succeed on first attempt. Using the ESP32 USB connecting, running on Mac machine, anyone give what is wrong, how to succeed flash on first attempt.

First Run

$ mos build --arch esp32 && mos flash Connecting to https://mongoose.cloud, user test Uploading sources (7783 bytes) Firmware saved to build/fw.zip Loaded esp-sense/esp32 version 1.0 (20181013-125738) Using port /dev/cu.SLAB_USBtoUART Opening /dev/cu.SLAB_USBtoUART @ 115200... Connecting to ESP32 ROM, attempt 1 of 10... Connecting to ESP32 ROM, attempt 2 of 10... Connecting to ESP32 ROM, attempt 3 of 10... Connected, chip: ESP32D0WDQ6 R1 Running flasher @ 0... Flasher is running Error: /private/tmp/mos-20181005-44753-1lei2ig/mos-tool-b997b0fde26931ac88a11a1fc6276c52c36187c8/src/cesanta.com/mos/flash/common/slip.go:38: invalid SLIP starting byte: 0xc8 /private/tmp/mos-20181005-44753-1lei2ig/mos-tool-b997b0fde26931ac88a11a1fc6276c52c36187c8/src/cesanta.com/mos/flash/esp/flasher/flasher_client.go:128: error reading response packet /private/tmp/mos-20181005-44753-1lei2ig/mos-tool-b997b0fde26931ac88a11a1fc6276c52c36187c8/src/cesanta.com/mos/flash/esp/flasher/flasher_client.go:165: /private/tmp/mos-20181005-44753-1lei2ig/mos-tool-b997b0fde26931ac88a11a1fc6276c52c36187c8/src/cesanta.com/mos/flash/esp/flasher/common.go:94: failed to get flash chip id /private/tmp/mos-20181005-44753-1lei2ig/mos-tool-b997b0fde26931ac88a11a1fc6276c52c36187c8/src/cesanta.com/mos/flash/esp/flasher/common.go:70: flash size is not specified and could not be detected /private/tmp/mos-20181005-44753-1lei2ig/mos-tool-b997b0fde26931ac88a11a1fc6276c52c36187c8/src/cesanta.com/mos/flash/esp/flasher/flash.go:44: /private/tmp/mos-20181005-44753-1lei2ig/mos-tool-b997b0fde26931ac88a11a1fc6276c52c36187c8/src/cesanta.com/mos/flash.go:157: /private/tmp/mos-20181005-44753-1lei2ig/mos-tool-b997b0fde26931ac88a11a1fc6276c52c36187c8/src/cesanta.com/mos/main.go:151: error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Second Run

mos build --arch esp32 && mos flash Connecting to https://mongoose.cloud, user test Uploading sources (7783 bytes) Firmware saved to build/fw.zip Loaded esp-sense/esp32 version 1.0 (20181013-125738) Using port /dev/cu.SLAB_USBtoUART Opening /dev/cu.SLAB_USBtoUART @ 115200... Connecting to ESP32 ROM, attempt 1 of 10... Connecting to ESP32 ROM, attempt 2 of 10... Connected, chip: ESP32D0WDQ6 R1 Running flasher @ 0... Error: /private/tmp/mos-20181005-44753-1lei2ig/mos-tool-b997b0fde26931ac88a11a1fc6276c52c36187c8/src/cesanta.com/mos/flash/esp/flasher/flasher_client.go:233: flasher did not respond /private/tmp/mos-20181005-44753-1lei2ig/mos-tool-b997b0fde26931ac88a11a1fc6276c52c36187c8/src/cesanta.com/mos/flash/esp/flasher/flasher_client.go:95: failed to talk to flasher /private/tmp/mos-20181005-44753-1lei2ig/mos-tool-b997b0fde26931ac88a11a1fc6276c52c36187c8/src/cesanta.com/mos/flash/esp/flasher/flasher_client.go:67: /private/tmp/mos-20181005-44753-1lei2ig/mos-tool-b997b0fde26931ac88a11a1fc6276c52c36187c8/src/cesanta.com/mos/flash/esp/flasher/common.go:65: failed to run flasher /private/tmp/mos-20181005-44753-1lei2ig/mos-tool-b997b0fde26931ac88a11a1fc6276c52c36187c8/src/cesanta.com/mos/flash/esp/flasher/flash.go:44: /private/tmp/mos-20181005-44753-1lei2ig/mos-tool-b997b0fde26931ac88a11a1fc6276c52c36187c8/src/cesanta.com/mos/flash.go:157: /private/tmp/mos-20181005-44753-1lei2ig/mos-tool-b997b0fde26931ac88a11a1fc6276c52c36187c8/src/cesanta.com/mos/main.go:151: error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Third Attempt

mos build --arch esp32 && mos flash Connecting to https://mongoose.cloud, user test Uploading sources (7783 bytes)

Firmware saved to build/fw.zip Loaded esp-sense/esp32 version 1.0 (20181013-125738) Using port /dev/cu.SLAB_USBtoUART Opening /dev/cu.SLAB_USBtoUART @ 115200... Connecting to ESP32 ROM, attempt 1 of 10... Connecting to ESP32 ROM, attempt 2 of 10... Connecting to ESP32 ROM, attempt 3 of 10... Connected, chip: ESP32D0WDQ6 R1 Running flasher @ 0... Flasher is running Error: /private/tmp/mos-20181005-44753-1lei2ig/mos-tool-b997b0fde26931ac88a11a1fc6276c52c36187c8/src/cesanta.com/mos/flash/esp/flasher/flasher_client.go:168: expected 1 result, got 0 /private/tmp/mos-20181005-44753-1lei2ig/mos-tool-b997b0fde26931ac88a11a1fc6276c52c36187c8/src/cesanta.com/mos/flash/esp/flasher/common.go:94: failed to get flash chip id /private/tmp/mos-20181005-44753-1lei2ig/mos-tool-b997b0fde26931ac88a11a1fc6276c52c36187c8/src/cesanta.com/mos/flash/esp/flasher/common.go:70: flash size is not specified and could not be detected /private/tmp/mos-20181005-44753-1lei2ig/mos-tool-b997b0fde26931ac88a11a1fc6276c52c36187c8/src/cesanta.com/mos/flash/esp/flasher/flash.go:44: /private/tmp/mos-20181005-44753-1lei2ig/mos-tool-b997b0fde26931ac88a11a1fc6276c52c36187c8/src/cesanta.com/mos/flash.go:157: /private/tmp/mos-20181005-44753-1lei2ig/mos-tool-b997b0fde26931ac88a11a1fc6276c52c36187c8/src/cesanta.com/mos/main.go:151: error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Disconnected USB and Reconnected (Device Restart)

$ mos build --arch esp32 && mos flash Connecting to https://mongoose.cloud, user test Uploading sources (7783 bytes) Firmware saved to build/fw.zip Loaded esp-sense/esp32 version 1.0 (20181013-125738) Using port /dev/cu.SLAB_USBtoUART Opening /dev/cu.SLAB_USBtoUART @ 115200... Connecting to ESP32 ROM, attempt 1 of 10... Connecting to ESP32 ROM, attempt 2 of 10... Connecting to ESP32 ROM, attempt 3 of 10... Connected, chip: ESP32D0WDQ6 R1 Running flasher @ 0... Flasher is running Flash size: 4194304, params: 0x0220 (dio,32m,40m) Deduping... 20864 @ 0x1000 -> 0 3072 @ 0x8000 -> 0 16384 @ 0x9000 -> 8192 8192 @ 0xd000 -> 0 974448 @ 0x10000 -> 0 262144 @ 0x190000 -> 57344 Writing... 8192 @ 0x9000 57344 @ 0x19e000 Wrote 65536 bytes in 1.76 seconds (291.10 KBit/sec) Verifying... 20864 @ 0x1000 3072 @ 0x8000 16384 @ 0x9000 8192 @ 0xd000 974448 @ 0x10000 262144 @ 0x190000 Booting firmware... All done! ✨ Done in 63.15s.

rosmianto commented 5 years ago

Have you tried with another ESP32 module? It seems that you experiencing USB connection issue.

gopalakrishnan-subramani commented 5 years ago

I found that using this command

 mos build --arch esp32 && mos flash

fails while uploading firmware.

But when I do them separately , flash is working fine.

mos build --arch esp32

 mos flash
my-life-in-codes commented 4 years ago

for me when i closed serial terminal, at the time only file loading successfully : )

After build connect board with host machine(Don't open serial console). Now you run $mos flash After flash completed you open serial console through putty or minicom

; )