esp32 c3 helloworld with idf 4.4 Checksum failure

torntrousers2
Posts: 7
Joined: Sat Aug 06, 2022 7:15 am

esp32 c3 helloworld with idf 4.4 Checksum failure

Postby torntrousers2 » Sat Aug 06, 2022 7:20 am

Hi. Trying to get the idf helloworld example to run on an esp32 c3 and it fails with crash loop:

Code: Select all

ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x7 (TG0WDT_SYS_RST),boot:0xd (SPI_FAST_FLASH_BOOT)
Saved PC:0x40047ed2
SPIWP:0xee
mode:DOUT, clock div:1
load:0x3fcd6100,len:0x38c
load:0x403ce000,len:0x6a8
load:0x403d0000,len:0x2370
Checksum failure. Calculated 0xb8 stored 0x3f
ets_main.c 333 
any suggestions?

ESP_Sprite
Posts: 8921
Joined: Thu Nov 26, 2015 4:08 am

Re: esp32 c3 helloworld with idf 4.4 Checksum failure

Postby ESP_Sprite » Sun Aug 07, 2022 1:44 am

That tends to be something to do with the flash hardware or process. What hardware are you using? Do you get any warnings/errors during flashing?

torntrousers2
Posts: 7
Joined: Sat Aug 06, 2022 7:15 am

Re: esp32 c3 helloworld with idf 4.4 Checksum failure

Postby torntrousers2 » Sun Aug 07, 2022 5:41 am

Thanks for the reply.

Its an Adafruit QT Py ESP32-C3 - https://www.adafruit.com/product/5405

This is the log from flashing:

Code: Select all

C:\temp\esp\hello_world>C:\Espressif\python_env\idf4.4_py3.8_env\Scripts\python.exe ..\..\..\Espressif\frameworks\esp-idf-v4.4\components\esptool_py\esptool\esptool.py -p COM22 -b 460800 --before default_reset --after hard_reset --chip esp32c3  write_flash --flash_mode dio --flash_size detect --flash_freq 40m 0x1000 build\bootloader\bootloader.bin 0x8000 build\partition_table\partition-table.bin 0x10000 build\hello_world.bin
esptool.py v3.2-dev
Serial port COM22
Connecting...
Chip is ESP32-C3 (revision 3)
Features: Wi-Fi
Crystal is 40MHz
MAC: 10:91:a8:32:7d:88
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Auto-detected Flash size: 4MB
Flash will be erased from 0x00001000 to 0x00007fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Flash will be erased from 0x00010000 to 0x00039fff...
Compressed 25264 bytes to 15785...
Wrote 25264 bytes (15785 compressed) at 0x00001000 in 0.5 seconds (effective 368.7 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 103...
Wrote 3072 bytes (103 compressed) at 0x00008000 in 0.1 seconds (effective 388.6 kbit/s)...
Hash of data verified.
Compressed 169776 bytes to 89622...
Wrote 169776 bytes (89622 compressed) at 0x00010000 in 2.4 seconds (effective 561.2 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...

ESP_Sprite
Posts: 8921
Joined: Thu Nov 26, 2015 4:08 am

Re: esp32 c3 helloworld with idf 4.4 Checksum failure

Postby ESP_Sprite » Sun Aug 07, 2022 10:55 am

Flash will be erased from 0x00001000 to 0x00007fff...
That's a range used in the ESP32, but not in the ESP32C3. Are you sure you selected the ESP32C3 as the ESP-IDF target? (idf.py set-target esp32c3).

torntrousers2
Posts: 7
Joined: Sat Aug 06, 2022 7:15 am

Re: esp32 c3 helloworld with idf 4.4 Checksum failure

Postby torntrousers2 » Sun Aug 07, 2022 2:52 pm

No i didn't do a "idf.py set-target esp32c3", I was following some web page about how to run the helloworld on a C3 and don't remember seeing that, and now don't remember what web page it was to check.

Anyway I have done that now and get further but still not perfect.
With ESP-IDF the helloworld sample outputs:

Code: Select all

spi_flash: Detected size(4096k) larger than the size in the binaHello world!
This is esp32c3 chip with 1 CPU core(s), WiFi/BLE, silicon revision 3, 2MB external flash
Minimum free heap size: 329692 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...
Restarting in 1 seconds...
Restarting in 0 seconds...
Restarting now.
(and then does not restart)

Running similar code with esp32/arduino it outputs:

Code: Select all

Hello world!
This is esp32c3 chip with 1 CPU core(s), WiFi/BLE, silicon revision 3, 4MB external flash
Minimum free heap size: 314688 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...
Restarting in 1 seconds...
Restarting in 0 seconds...
Restarting now.
ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xd (SPI_FAST_FLASH_BOOT)
Saved PC:0x403814ee
SPIWP:0xee
mode:DOUT, clock div:1
load:0x3fcd6100,len:0x38c
load:0x403ce000,len:0x6a8
load:0x403d0000,len:0x2358
SHA-256 comparison failed:
Calculated: 81622325b5b3d82bf48506f210cd42cc4a45185255565a883ae891633570c8f5
Expected: bef5af017887fc9f8b85cdc8d157e714dd15305a39a5b8a4fc8312b760075a67
Attempting to boot anyway...
entry 0x403ce000

setup
Hello world!
...
The code line for that is

Code: Select all

    printf("%dMB %s flash\n", spi_flash_get_chip_size() / (1024 * 1024),
            (chip_info.features & CHIP_FEATURE_EMB_FLASH) ? "embedded" : "external");
so is there some other config somewhere i need to update to tell the IDF its got 4MB?

ESP_Sprite
Posts: 8921
Joined: Thu Nov 26, 2015 4:08 am

Re: esp32 c3 helloworld with idf 4.4 Checksum failure

Postby ESP_Sprite » Mon Aug 08, 2022 12:56 am

Yep, esp-idf needs to be configured for that. Off the top of my head: Menuconfig -> serial flasher config -> flash size

torntrousers2
Posts: 7
Joined: Sat Aug 06, 2022 7:15 am

Re: esp32 c3 helloworld with idf 4.4 Checksum failure

Postby torntrousers2 » Mon Aug 08, 2022 4:41 am

Thanks. Done that, and now it gets:

Code: Select all

[0;32mI (242) sleep: Configure to isolate all GPIO pins in sleeHello world!
This is esp32c3 chip with 1 CPU core(s), WiFi/BLE, silicon revision 3, 4MB external flash
Minimum free heap size: 329692 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...
Restarting in 1 seconds...
Restarting in 0 seconds...
Restarting now.
(and does not restart)

Any ideas what that "sleep: Configure to isolate all GPIO pins in slee" is about?

And why is it not rebooting?

ESP_Sprite
Posts: 8921
Joined: Thu Nov 26, 2015 4:08 am

Re: esp32 c3 helloworld with idf 4.4 Checksum failure

Postby ESP_Sprite » Mon Aug 08, 2022 8:32 am

I think that's a message that is sent when the ESP32C3 is rebooting, but it's kind-of cut off by the reboot. I think you can ignore it.

torntrousers2
Posts: 7
Joined: Sat Aug 06, 2022 7:15 am

Re: esp32 c3 helloworld with idf 4.4 Checksum failure

Postby torntrousers2 » Mon Aug 08, 2022 12:14 pm

I don't get that mesage when using the C3 with the esp32/arduino framework though?

And any ideas about the failing to boot up again after the restart?

ESP_Sprite
Posts: 8921
Joined: Thu Nov 26, 2015 4:08 am

Re: esp32 c3 helloworld with idf 4.4 Checksum failure

Postby ESP_Sprite » Tue Aug 09, 2022 12:59 am

Ah, sorry, I didn't notice that it does not restart. That's odd. You're using the vanilla hello world example there, no changes in menuconfig aside from the flash setting?

Who is online

Users browsing this forum: Bing [Bot] and 114 guests