Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESP32-C3 bootloop #6519

Closed
1 task done
hedgemybets opened this issue Apr 1, 2022 · 15 comments
Closed
1 task done

ESP32-C3 bootloop #6519

hedgemybets opened this issue Apr 1, 2022 · 15 comments

Comments

@hedgemybets
Copy link

hedgemybets commented Apr 1, 2022

Board

ESP32-C3-DevKitC-02U

Device Description

Stock board with USB cable to PC running Arduino IDE.

Hardware Configuration

No external hardware

Version

v2.0.2

IDE Name

Arduino IDE v1.8.19

Operating System

Windows 10

Flash frequency

80MHz

PSRAM enabled

no

Upload speed

921600 and tried 512000 and 115200

Description

Using new Espressif board received last week. In Arduino IDE, selected ESP32C3 Dev Module under Tools/Board and compile any sketch, SHA-256 comparison fail occurs on boot and no other output.
Tried 40 MHz, various upload speeds, both QIO and DIO flash modes, same results with anything I tried.

One unusual thing I see during flashing is: "Chip is unknown ESP32-C3 (revision 3)"

Sketch

#define LED 2

void setup() {
    pinMode(LED, OUTPUT);
}

void loop() {
    digitalWrite(LED, HIGH);
    delay(100);
    digitalWrite(LED, LOW);
    delay(100);
    Serial.println("In Loop");
}

Debug Message

ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x1 (POWERON),boot:0xc (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x420
load:0x403ce000,len:0x90c
load:0x403d0000,len:0x236c
SHA-256 comparison failed:
Calculated: ccb0d00bac7e84e1d90a12e4f75f4ab6c5f7e71bb209afd5819c4c9557a6db71
Expected: c9cf160580940ec7801c73b16423824e72ad12055c732e83ce66332240af42a7
Attempting to boot anyway...
entry 0x403ce000

Other Steps to Reproduce

As a work-around I was able to use the approach of adding the Arduino component to an installation of the ESP-IDF v4.4. Then build and flash my full Arduino project in ESP-IDF. The instructions I used are at: https://docs.espressif.com/projects/arduino-esp32/en/latest/esp-idf_component.html

Flash size is set for 4MBs, which was the default and what is listed in specification.

BTW, I didn't see PSRAM listed as config option in Arduino IDE, so I answered no above.

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.
@hedgemybets hedgemybets added the Status: Awaiting triage Issue is waiting for triage label Apr 1, 2022
@lbernstone
Copy link
Contributor

Please change your title to ESP32-C3 bootloop. The SHA comparison failing here is cosmetic, and due to the way arduino compiles.
This seems to indicate a problem with the 2nd stage bootloader, as this is the behavior I get when I try to upload a program to the unsupported beta C3 dev board that I have. I forget that it doesn't work every couple weeks, and it does not give any indication why it fails :)
Make sure you have debug level set to verbose and provide any additional logging you might get from that.
Try to erase the flash and then reprogram- perhaps you have an error in the 2nd stage bootloader, and starting clean will fix it.

@hedgemybets
Copy link
Author

Thanks for the quick reply. I didn't call it bootloop as the ESP doesn't continuously reboot (i. e., the message doesn't continuously repeat) as in issue #6013. The boot process hangs and no further output is visible. Of course there could be a loop hanging things up in the background so I did change the title per your request.

I did try erasing the flash and it didn't change the results. Also, turning on the debug level didn't result in any more output to share. I'm just happy that I have a workaround even though I can't use the Arduino IDE integration.

@hedgemybets hedgemybets changed the title Flashing any Sketch results in SHA-256 comparison fail and sketch doesn't run Flashing any Sketch results in SHA-256 comparison fail and bootloop Apr 1, 2022
@hedgemybets hedgemybets changed the title Flashing any Sketch results in SHA-256 comparison fail and bootloop ESP32-C3 bootloop Apr 1, 2022
@Jason2866
Copy link
Collaborator

Jason2866 commented Apr 2, 2022

Please use latest Arduino core 2.0.3-rc1. GPIO handling has been refactored.
C3 has never PSRAM so there no menu entry.
Your test sketch does work fine with my two C3 boards.
I do NOT use Arduino IDE. I have made a PlatformIO port since a official version is not available from Platformio crew. You can use in Platformio with

platform = https://github.com/Jason2866/platform-espressif32/releases/download/v2.0.3-rc1/platform-espressif32-2.0.3-rc1.zip

@Jason2866
Copy link
Collaborator

Jason2866 commented Apr 2, 2022

I could imagine that your board is not identified as rev3. IDF libs are configured and compiled for Arduino to be only compatible with boards >= rev3. In this case boot process will stop.
You can try a other Platformio Arduino Core build from me which has a modified sdkconfig (we need for our Project Tasmota) which supports older C3 boards too.

 platform = https://github.com/tasmota/platform-espressif32/releases/download/v2.0.3rc1/platform-espressif32-2.0.3.zip

@ggalisky
Copy link

ggalisky commented Apr 3, 2022

I had this same issue, used the change that Jason provided for the ini file and now I get nothing on the serial monitor after uploading code.

My ini file:
[env:arduino-esp32c3]
platform = https://github.com/Jason2866/platform-espressif32/releases/download/v2.0.3-rc1/platform-espressif32-2.0.3-rc1.zip
board = esp32-c3-devkitm-1
framework = arduino
platform_packages =
framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32#master
board_build.f_flash = 80000000L
board_build.flash_mode = dio

monitor_speed = 115200

My main.cpp:

`#include "Arduino.h"

void setup() {
pinMode(10,INPUT);
Serial.begin(115200);

}

void loop(){
int HED_OUTPUT = digitalRead(10);
if (HED_OUTPUT == false){
Serial.print("BUTTON ON: ");
}
else {
Serial.print("BUTTON_OFF: ");
}
Serial.println(HED_OUTPUT);
delay(100);

}`

@Jason2866
Copy link
Collaborator

Jason2866 commented Apr 3, 2022

Just place this in the ini file.

[env:arduino-esp32c3]
platform = https://github.com/Jason2866/platform-espressif32/releases/download/v2.0.3-rc1/platform-espressif32-2.0.3-rc1.zip
board = esp32-c3-devkitm-1
framework = arduino
monitor_speed = 115200

I have reverted the faulty PR in RC1 (see issues and discussion)

@ggalisky
Copy link

ggalisky commented Apr 3, 2022

Even after changing my ini to this I still get a blank serial monitor. The same sketch on the Arduino IDE works with this board so I know it is a platform.io issue. Thank you for getting back to me quickly

@Jason2866
Copy link
Collaborator

Jason2866 commented Apr 3, 2022

Just deleted folder .platformio and used this platformio.ini

[env:esp32c3]
platform = https://github.com/Jason2866/platform-espressif32/releases/download/v2.0.3-rc1/platform-espressif32-2.0.3-rc1.zip
board = esp32-c3-devkitm-1
framework = arduino

and this sketch (my board has the Led on GPIO 3)

#include <Arduino.h>

#define LED 3

void setup() {
    pinMode(LED, OUTPUT);
}

void loop() {
    digitalWrite(LED, HIGH);
    delay(100);
    digitalWrite(LED, LOW);
    delay(100);
    Serial.println("In Loop");
}

LED is blinking, and no serial message

So sketch is working in general. I have to look what is different regarding Serial ArduinoIDE setup and current PlatformIO setup

ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x1 (POWERON),boot:0xd (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x438
load:0x403ce000,len:0x90c
load:0x403d0000,len:0x2358
SHA-256 comparison failed:
Calculated: a9753a4fc647c6545c1b919ef08db429130a48592727edca270f1e5a3da0d0a9
Expected: 3bf6ef2cf3b9eefcd4b3c70cc5d1ce5138292d101a5cb1d5db6fbebf081b0a19
Attempting to boot anyway...
entry 0x403ce000

@Jason2866
Copy link
Collaborator

Jason2866 commented Apr 3, 2022

I highly doubt it was working in Arduino IDE since there is Serial.begin(115200); missing before Serial.println("In Loop");
Adding this

#include <Arduino.h>

#define LED 3

void setup() {
    pinMode(LED, OUTPUT);
    Serial.begin(115200);
}

void loop() {
    digitalWrite(LED, HIGH);
    delay(100);
    digitalWrite(LED, LOW);
    delay(100);
    Serial.println("In Loop");
}

and i get

rst:0x1 (POWERON),boot:0xc (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x438
load:0x403ce000,len:0x90c
load:0x403d0000,len:0x2358
SHA-256 comparison failed:
Calculated: a9753a4fc647c6545c1b919ef08db429130a48592727edca270f1e5a3da0d0a9
Expected: 3bf6ef2cf3b9eefcd4b3c70cc5d1ce5138292d101a5cb1d5db6fbebf081b0a19
Attempting to boot anyway...
entry 0x403ce000
In Loop
In Loop
In Loop
In Loop
In Loop
In Loop
.
.
.

@Jason2866
Copy link
Collaborator

So there is NO issue at all.

@hedgemybets
Copy link
Author

I've retested and all is working fine now with the Arduino IDE, so I'm closing the issue. I believe my test code was missing the Serial.begin(115200) line as @Jason2866 noted above for @ggalisky's issue. So I wasn't seeing any output. Also, I do know that my larger project code did have Serial.begin(9600), but my monitor was probably in 115200. Usually when I do this I see some garbage characters which would remind me to change the baud rate, but in this case I didn't see any.

Thanks for the help!

@ggalisky
Copy link

ggalisky commented Apr 3, 2022

I've retested and all is working fine now with the Arduino IDE, so I'm closing the issue. I believe my test code was missing the Serial.begin(115200) line as @Jason2866 noted above for @ggalisky's issue. So I wasn't seeing any output. Also, I do know that my larger project code did have Serial.begin(9600), but my monitor was probably in 115200. Usually when I do this I see some garbage characters which would remind me to change the baud rate, but in this case I didn't see any.

Thanks for the help!

I had the Serial.begin(XXXXX) in my first post though... and still have no output on the Serial monitor for Platform.io. It does work on the Arduino IDE which makes me think it has something to do with "USB CDC on boot" option that is enabled in the Arduino IDE. When I turn this option off in the Arduino IDE the serial monitor stops working.

EDIT: I only have the built in USB programming circuit, not an external USB to UART converter.

@Jason2866
Copy link
Collaborator

This is related #6089 (comment)

@Sys64736
Copy link

I have a C3 with no UART and USB connected directly to 18 and 19
I'll get no Serial output unless I have this in the .ini

-D ARDUINO_USB_MODE=1
-D ARDUINO_USB_CDC_ON_BOOT=1

Then Serial output works great.

Also using @Jason2866 git link for the platform and using this latest repo for package

@VojtechBartoska VojtechBartoska added Status: Solved and removed Status: Awaiting triage Issue is waiting for triage labels Apr 12, 2022
@QGB
Copy link

QGB commented May 15, 2022

ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x1 (POWERON),boot:0xc (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x38c
load:0x403ce000,len:0x6a8
load:0x403d0000,len:0x2358
SHA-256 comparison failed:
Calculated: 4ab8657f6f5aa80b81c7dd649db3bd64a98999ed7c65acc5a2ab77ce80caf525
Expected: 6babbc7b9ea63e04e0fc89ec224f6268aa3f84392018f73ab33721f768ce2eb6
Attempting to boot anyway...
entry 0x403ce000
Hello world!
This is esp32c3 chip with 1 CPU core(s), WiFi/BLE, silicon revision 3, 4MB external flash
Minimum free heap size: 320128 bytes
Restarting in 10 seconds...
Restarting in 9 seconds...
Restarting in 8 seconds...
Restarting in 7 seconds...
Restarting in 6 seconds...
Restarting in 5 seconds...
Restarting in 4 seconds...
Restarting in 3 seconds...
Restarting in 2 seconds...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants