Closed JurajSadel closed 5 months ago
I don't have a 26mhz board, but to be sure, you're passing the 26mhz_xtal
feature too?
Yes, I used the xtal-26mhz
feature.
I can confirm it's not working by just using the feature
However, connecting with a serialmonitor setting baud rate to 74880 ( 115200 * 26 / 40 ) gets me something
So I assume you just need to flash the right bootloader and things should be fine (since then the bootloader should set 115200 bauds correctly)
I have the same problem with my Sparkfun ESP32 Thing with a 26Mhz crystal. I compiled the project with the xtal-26mhz
feature flag for esp32-hal
(taking care to disable the default features and enable rt
and vectored
as well.).
I flashed with espflash -f 26mhz path/to/binary
. (note that I previouly wrongly flashed a 40Mhz binary until I realized the board wasn't using 40Mhz)
Finally if I connect the monitor with espflash monitor --baud 76800
I can see the error as shown in the screenshot above:
I (28) boot: ESP-IDF v5.1-beta1-378-gea5e0ff298-dirt 2nd stage bootloader
I (28) boot: compile time Jun 7 2023 07:48:23
I (30) boot: Multicore bootloader
I (35) boot: chip revision: v1.0
I (38) boot.esp32: SPI Speed : 40MHz
I (43) boot.esp32: SPI Mode : DIO
I (48) boot.esp32: SPI Flash Size : 4MB
I (52) boot: Enabling RNG early entropy source...
I (58) boot: Partition Table:
I (61) boot: ## Label Usage Type ST Offset Length
I (68) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (76) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (83) boot: 2 factory factory app 00 00 00010000 003f0000
I (91) boot: End of partition table
I (95) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=041b4h ( 16820) map
I (110) esp_image: segment 1: paddr=000141dc vaddr=3ffc0000 size=00014h ( 20) load
I (112) esp_image: segment 2: paddr=000141f8 vaddr=40080000 size=01b18h ( 6936) load
I (123) esp_image: segment 3: paddr=00015d18 vaddr=00000000 size=0a300h ( 41728)
I (144) esp_image: segment 4: paddr=00020020 vaddr=400d0020 size=0a454h ( 42068) map
I (160) boot: Loaded app from partition at offset 0x10000
I (160) boot: Disabling RNG early entropy source...
!! A panic occured in '/home/esp/.cargo/registry/src/index.crates.io-6f17d22bba15001f/esp-hal-common-0.13.1/src/rtc_cntl/rtc/esp32.rs', at line 18, column 5
PanicInfo {
payload: Any { .. },
message: Some(
Did you flash the right bootloader configured for 26Mhz xtal?,
),
location: Location {
file: "/home/esp/.cargo/registry/src/index.crates.io-6f17d22bba15001f/esp-hal-common-0.13.1/src/rtc_cntl/rtc/esp32.rs",
line: 18,
col: 5,
},
can_unwind: true,
force_no_backtrace: false,
}
I have no idea how to flash a bootloader, I was under the impression that espflash would do it for me.
Id suggest building a bootloader in a esp-idf project and using it,see https://esp-rs.github.io/book/troubleshooting/espflash.html#rtc_clk_init-possibly-invalid-config_xtal_freq-setting.
I don't have a 26 MHz board but I can elaborate more on Monday if needed.
Thanks @SergioGasquez , I had not found that resource in the book.
Unfortunately, I have no esp-idf-sys-*
folder in my target/xtensa-esp32-none-elf/release/build
folder. Can't find any bootloader binary in fact...
I based my test on https://github.com/esp-rs/esp-template
I added a file sdkconfig.defaults
to the root of the project and wrote CONFIG_XTAL_FREQ_26=y
.
Using cargo espflash
doesn't solve the issue for me either.
EDIT: I didn't read your post carefully. You suggest using an empty project with the https://github.com/esp-rs/esp-idf-template template to load up a bootloader, and then forget about it?
I'm trying to compile the project generated by esp-idf-template
but it complains that ERROR: C:\tb\.embuild\espressif\espidf.constraints.v5.1.txt doesn't exist. Perhaps you've forgotten to run the install scripts. Please check the installation guide for more information.
But I don't see any install script. I used espup
to install everything.
EDIT: deleting the .embuild
folder and a cargo clean
fixed it.
we are currently revisiting how the bootloader is exposed in esp-idf-sys. This is already done on gh but not released. Currently you can find the bootloader in the build artifacts of esp-idf-sys. It might look like the following inside your target dir
target/riscv32imc-<or-your-target>/debug/build/esp-idf-sys-<random-number>/out/build/bootloader
Cool thanks, so I am now able to build and flash my project by specifying the bootloader that was built in the idf template project. Note that if I run just cargo espflash flash --release
even after a successful flash with the 26mhz bootloader, then the bootloader gets overwritten with the 40mhz one again and I have to always specify the --bootloader
arg when flashing.
Since this issue has appeared a few times, we could try to include a 26 MHz bootloader for ESP32 and ESP32-C2 and use it if we detect a 26 MHZ freq when flashing
Log from `embassy_hello_world"