-
Notifications
You must be signed in to change notification settings - Fork 7.3k
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
A build flag to disable CRC check for ESP32 esp_efuse_mac_get_default() (IDFGH-8989) #10401
Comments
Could you please attach |
The official firmware presents the same MAC address as the one that I can read from efuse.
And here's a section of the logging from the ESPHome firmware:
The MAC address in both logs is I created the summary using my development device (hence a different MAC): The interesting section from it (formatted for readability):
|
+1 for this Feature. For project Tasmota we have to use a fork with patched IDF and compile the needed Arduino libs ourself too to support this MCUs from Xiaomi. |
Is this called somewhere in the bootloader, too? What is the rationale to call abort() in the first place? This problem won't go away by rebooting. |
Not that I am aware of. I only have seen this issue at the firmware level.
Likely, the rationale is based on the assumption that the checksum will always be correct and that an invalid checksum means that there could be some read error or memory corruption that possibly could be corrected by rebooting the device.
That sounds painfully familiar. I have maintained such a patched ESP-IDF myself. I stopped maintaining that one, because I do have these MCUs working without patching ESP-IDF now, but as I described above, that solution is sub-optimal. |
@mmakaay Yep, first it was a pain, since we had to do, now we customized (stripped down) |
Backport to 4.x? |
Hi @kriegste! |
Wonderful! Thanks for the implementation @KonstantinKondrashov |
…fuse_mac_get_default returns INVALID_CRC instead of abort Closes #10401
I just ran across this same error for the first time on one of my custom ESP32 board. I'm using the
to my plaformio.ini file and I still am seeing the MAC CRC error:
Using espefuse tool I see this:
From the PIO build I see this:
So maybe the flag hasn't made it to the Arduino framework yet? I apologize in advance if this is the wrong place to post this question. |
There are two reasons defining this flag didn't change the behavior:
|
|
Looking at this arduino-esp32 issue, I suppose there is a possibility of a v2.0.8 release which could include this change, but it's better to ask about this in the arduino-esp32 project discussions. |
…fuse_mac_get_default returns INVALID_CRC instead of abort Closes #10401
Is your feature request related to a problem?
The problem that I run into has to do with the
esp_efuse_mac_get_default()
function:https://github.com/espressif/esp-idf/blob/release/v4.4/components/esp_hw_support/mac_addr.c#L106
For ESP32, (
CONFIG_IDF_TARGET_ESP32
is defined), the code will always perform a CRC check on the MAC address that was read from efuse. When this fails,abort()
is called, and the device will reboot.While this is a good policy, I do run into problems with devices for which the manufacturer managed to burn an invalid CRC alongside the MAC address. As a result, the device ends up in a boot loop.
One device for which an invalid CRC seems to be the rule rather than the exception, is the ESP32-based Xiaomi Bedside Lamp 2. For this project, I maintain an open source ESPHome-based firmware replacement
Describe the solution you'd like.
I kindly request for a new sdkconfig option, that would make it possible to optionally skip the CRC check in
esp_efuse_mac_get_default()
, for example in the sectionESP32-specific
:What I want to happen:
CONFIG_ESP32_CHECK_EFUSE_MAC_CRC=n
for my buildDescribe alternatives you've considered.
One alternative was to take the esp-idf project, remove the conflicting code from it manually, compile binary platform packages and distribute those myself for people that want to build the firmware. I had this working, but it was a painful path that I don't want to follow anymore.
Another alternative is the solution that I currently have in place. I managed to work around the reboot loop issue by learning ESPHome to read the MAC address itself and using that for the WiFi setup, along with disabling
CONFIG_ESP_PHY_CALIBRATION_AND_DATA_STORAGE
to circumvent a piece of code that would otherwise callesp_efuse_mac_get_default()
at all times.This does not feel like a very stable and maintainable solution for the issue though. Additionally, it blocks the route to using
CONFIG_ESP_PHY_CALIBRATION_AND_DATA_STORAGE
.Additional context.
No response
The text was updated successfully, but these errors were encountered: