espressif: fix Wi-Fi IRQ issue during SPI Flash operations#18709
Merged
xiaoxiang781216 merged 2 commits intoapache:masterfrom Apr 11, 2026
Merged
espressif: fix Wi-Fi IRQ issue during SPI Flash operations#18709xiaoxiang781216 merged 2 commits intoapache:masterfrom
xiaoxiang781216 merged 2 commits intoapache:masterfrom
Conversation
Contributor
|
@fdcavalcanti I opened an Issue about this wapi.conf keeping the password in plain text: |
acassis
reviewed
Apr 10, 2026
Wi-Fi used a locally allocated vector_desc, so those CPU interrupt lines were never recorded in the HAL non_iram_int_mask. During SPI flash, esp_intr_noniram_disable() therefore did not mask them, and Wi-Fi ISRs could still run with the cache off. Now, Wi-Fi IRQs are treated as non-IRAM and get masked while flash/cache is suspended. Signed-off-by: Filipe Cavalcanti <[email protected]>
Wi-Fi used a locally allocated vector_desc, so those CPU interrupt lines were never recorded in the HAL non_iram_int_mask. During SPI flash, esp_intr_noniram_disable() therefore did not mask them, and Wi-Fi ISRs could still run with the cache off. Now, Wi-Fi IRQs are treated as non-IRAM and get masked while flash/cache is suspended. Signed-off-by: Filipe Cavalcanti <[email protected]>
909177e to
09502b5
Compare
acassis
approved these changes
Apr 10, 2026
xiaoxiang781216
approved these changes
Apr 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Wi-Fi interrupt setup in the ESP32/ESP32-S2/ESP32-S3 (Xtensa) and ESP32-C3/C6 (RISC-V) Wi-Fi adapters now uses the HAL’s global vector descriptor (
get_desc_for_int) instead of a separately allocatedvector_desc, and registers each line as not in IRAM viaesp_intr_set_in_iram(handle, false). That aligns Wi-Fi IRQs withesp_intr_noniram_disable()so they are masked while SPI flash operations hold the cache disabled, reducing risk of Wi-Fi ISRs running from flash in that window.3405a94f29arch/risc-v: register Wi-Fi IRQs in non_iram mask for SPI flash909177e5b7arch/xtensa: register Wi-Fi IRQs in non_iram mask for SPI flashThis PR fixes an issue where SPI Flash and Wi-Fi would crash when used together. The reason was that Wi-Fi interrupts were accessing cached functions while it was disabled. The correct operation here is to disable Wi-Fi interrupts while cache is off.
Impact
Impact on user: YES — Wi-Fi stability on Espressif boards when SPI flash holds the cache disabled; no public API change.
Impact on build: NO
Impact on hardware: YES — ESP32, ESP32-S2, ESP32-S3, ESP32-C3, ESP32-C6 (Wi-Fi + SPI flash coexistence).
Impact on documentation: NO
Impact on security: NO
Impact on compatibility: NO
Testing
Building
./tools/configure.sh esp32c6-devkitcmake(with usual parallelism)Running
wapi psk wlan0 <password> 3 2wapi essid wlan0 <ssid> 1renew wlan0wapi save_config wlan0Results
Before the changes,
wapi save_configwould simply crash with no warning or backtrace. Now it works properly.