xtal freq auto config for ESP8266
Greetings developers and contributors.
For ESP32 boards XTAL_FREQ_AUTO can be set using sdkconfig so that single firmware can be used with different crystal frequencies, Where as for ESP8266 boards such configuration is not available and is left to the flashing tool to patch the header for correct flashing mode, flashing frequency.
This causes issue with flashing tools such as esp-web-tools which doesn't patch the header and expects correct XTAL frequency to be set in the firmware(https://github.com/NabuCasa/esp-web-flasher/issues/103#issuecomment-1061993698).
CONFIG_XTAL_FREQ = 0 for esp32c5
Port, board and/or hardware
esp32c5
MicroPython version
Hello, I have a question regarding MicroPython that I'm having trouble understanding.
Please take a look at my forked repository. I'm working on adding MicroPython support for the ESP32C5 (some code has already been committed to GitHub).
When compiling with the command make BOARD=SEEED_XIAO_ESP32C5, I encounter an error:
ports/esp32/machine_i2c.c (#error "I2C uses XTAL but no configured freq")
I checked the generated sdkconfig and quickly identified the issue:
grep -r "CONFIG_XTAL_FREQ" ./build-SEEED_XIAO_ESP32C5/sdkconfig CONFIG_XTAL_FREQ_AUTO=y CONFIG_XTAL_FREQ=0
I then tried to modify it following the approach used for ESP32C2 (where CONFIG_XTAL_FREQ is set to 26), but unfortunately, my modifications were unsuccessful.
No matter what I try, the value of CONFIG_XTAL_FREQ remains 0.
The methods I've attempted are as follows:
1、In boards/SEEED_XIAO_ESP32C5/mpconfigboard.cmake, directly include boards/sdkconfig.c2 (using C2's configuration directly, which sets CONFIG_XTAL_FREQ to 26)
<img width="971" height="380" alt="Image" src="https://github.com/user-attachments/assets/48e6c603-7647-4cc9-b077-ecf25b4fc16e" />
2、In boards/SEEED_XIAO_ESP32C5/sdkconfig.board, set "CONFIG_XTAL_FREQ_AUTO=n"
<img width="993" height="237" alt="Image" src="https://github.com/user-attachments/assets/563e8501-a41f-49ce-b20b-de5fb5e761fc" />
3、Use idf.py -DBOARD=SEEED_XIAO_ESP32C5 menuconfig to configure it through the menu interface
<img width="1041" height="190" alt="Image" src="https://github.com/user-attachments/assets/10340eca-595c-46f3-aa60-0b178b336a5e" />
However, all three methods have failed. I can't understand why this is happening. Could there be something I'm missing in the configuration process?
Reproduction
1 git clone https://github.com/AZKKXL/micropython.git
2 git checkout xiao_esp32c5
3 make BOARD=SEEED_XIAO_ESP32C5
Expected behaviour
No response
Observed behaviour
[1204/1472] Generating ../../genhdr/qstr.i.last
FAILED: genhdr/qstr.i.last /home/itcast/Code/micropython/ports/esp32/build-SEEED_XIAO_ESP32C5/genhdr/qstr.i.last
/bin/sh esp-idf/main/CMakeFiles/qstr.i.last-93c470f.sh f83c7955379aa9c2
/home/itcast/Code/micropython/ports/esp32/machine_i2c.c:43:2: error: #error "I2C uses XTAL but no configured freq"
43 | #error "I2C uses XTAL but no configured freq"
Additional Information
No, I've provided everything above.
Code of Conduct
Yes, I agree