fix(m5stack-tab5): power the SD card IO rail through the P4's LDO channel 4 - #797
Merged
Merged
Conversation
…nnel 4 The SD card's IO pads (GPIO39-44) on the ESP32-P4 are powered by the internal LDO channel 4 (LDO_VO4). The Tab5 BSP never gave the SDMMC host a power-control handle, so that rail stayed off, the bus floated and card init failed (send_op_cond timeouts, or ESP_FAIL on the first data transfer). Create the on-chip LDO power control like the other ESP32-P4 BSPs (and M5Stack's own Tab5 BSP) do, pin the host to slot 0 and 4-bit mode, and release the handle if mounting fails. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BAeyJSuzVyqvSe4mffGUZo
|
✅Static analysis result - no issues found! ✅ |
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The reviewed changes address SD power and host configuration with no unresolved issues.
Pull request overview
Fixes M5Stack Tab5 SD card initialization by powering the ESP32-P4 SD I/O rail through LDO channel 4.
Changes:
- Adds on-chip LDO power control.
- Configures SDMMC slot 0 in 4-bit mode.
- Cleans up the power handle when mounting fails.
File summaries
| File | Description |
|---|---|
components/m5stack-tab5/src/sdcard.cpp |
Configures SD power and SDMMC host settings. |
components/m5stack-tab5/include/m5stack-tab5.hpp |
Defines the LDO channel and stores the power-control handle. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Problem
SD card init on the M5Stack Tab5 fails (
sdmmc_init_ocr: send_op_cond returned 0x107, orsdmmc_init_sd_ssr ... returned 0xffffffffon the first data transfer) even with the pins verified correct, including in the component's own example.Cause
On the ESP32-P4 the SD card IO pads (GPIO39-44) are powered by the chip's internal LDO channel 4 (
LDO_VO4). The Tab5 BSP never sethost.pwr_ctrl_handle, so the SDMMC driver never switched that rail on and the bus floated.Fix
Create the on-chip LDO power control (
sd_pwr_ctrl_new_on_chip_ldo, channel 4) and hand it to the SDMMC host, the same wayesp32-p4-function-ev-board,esp32-p4-nano,esp32-p4-eth,esp32-p4-module-dev-kitandesp32-p4-wifi6-dev-kitalready do, and the same as M5Stack's own Tab5 BSP. Also pins the host to slot 0 / 4-bit (matching M5Stack) and releases the handle when mounting fails.The other ESP32-P4 BSPs with SD support were checked and already do this;
esp32-p4-wifi6-poe-ethhas no SD support.Testing
components/m5stack-tab5/examplebuilds for esp32p4 (IDF v6.1).🤖 Generated with Claude Code
https://claude.ai/code/session_01BAeyJSuzVyqvSe4mffGUZo