Bus_SPI: initialize spi_bus_config_t::dma_burst_size for ESP-IDF 6.1 - #280
Merged
Merged
Conversation
ESP-IDF 6.1 added dma_burst_size to spi_bus_config_t. The memset(~0u) that seeds the *_io_num fields with -1 leaves it at 0xFFFFFFFF, which the GDMA driver rejects on chips with an adjustable burst size (ESP32-S3, C5, C61, P4). spi_bus_initialize() then panics in its error path and the board boot-loops in init(). Set it to 0 (driver default) on 6.1 and later. Reproduced and verified on ESP32-S3 with ESP-IDF v6.1.
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.
Fixes #278.
ESP-IDF v6.1 added
dma_burst_sizetospi_bus_config_t.spi::init()seeds the struct withmemset(&buscfg, ~0u, ...)so that every*_io_numdefaults to -1, which leaves the new field at0xFFFFFFFF. On chips whose GDMA burst size is configurable the driver rejects that value,spi_bus_initialize()fails insidealloc_dma_chan(), and its error path then panics (LoadProhibited), soinit()boot-loops.This sets
dma_burst_size = 0(driver default) on v6.1 and later. The assignment is placed inside the existing#if defined (ESP_IDF_VERSION_VAL)block so that toolchains withoutesp_idf_version.hkeep compiling.Affected chips (from the v6.1 sources): ESP32-S3 / C5 / C61 / H4 (
GDMA_LL_AHB_BURST_SIZE_ADJUSTABLE) and ESP32-P4 / S31 (SOC_AXI_GDMA_SUPPORTED). ESP32 / S2 have no GDMA, and C3 / C6 / C2 / H2 force the default burst size regardless of the requested value, so they were never affected.Verification
A/B on hardware with ESP-IDF v6.1 (tag), M5GFX from
developvs. this branch:invalid max_data_burst_size: 4294967295→ panic loopspi::initon Port B, since the DSI panel path does not touch SPI)spi::initOK, DSI display OK