fix(m5stack_tab5): support ST7121 LCD variant#804
Conversation
|
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 453faf1. Configure here.
|
HI @RiviaRammer thank you for this PR. Great job. I have one question:
|
Thank you for reviewing. The two panel drivers share a very similar MIPI-DPI wrapper, but they do not have the same default initialization sequence. In particular, the ST7121 sequence uses different vendor commands (for example, the 0x60 command starts with 0x71, 0x21 rather than 0x71, 0x23), and the ST7121 timing also differs. I kept a separate ST7121 driver because M5Stack's Tab5 UserDemo follows the same approach: it detects touch FW version 1, creates esp_lcd_st7121, and uses the ST7121-specific default init sequence. I verified this path on an FW-version-1 Tab5 unit with a stable RGB/color-bar test. Using the current ST7123 driver unchanged for both would select the ST7123 default initialization sequence for ST7121. It could be refactored into a shared ST712x driver in a separate change, but that would be a broader component API change. |
If the difference is only in init sequence, it can be same like this:
The detection can be still same. Detection is only reading register from I2C. As I said before, I haven't got HW and it is not available now. But I would test new init commands with |
|
I'd like to help move this PR forward toward merging. I'll arrange for one of our engineers to test it and share the test results here. Thank you, @RiviaRammer, for your support, and @espzav for the review. |
|
@Forairaaaaa Thank you for tests. Please, could you give me more info, how did you test it? Thank you! |
Thank you for the clarification. For my previous test, I built the However, that test used the implementation in this PR as-is. On the ST7121 unit it called I now understand the test you are requesting: keep the existing runtime detection, use I have not tested that configuration yet. I will prepare a build using this approach, test it on the ST7121 hardware, and report the result here. |




问题背景
M5Stack Tab5 硬件存在不同 LCD 方案。当前 BSP 在 I2C 地址
0x55探测到 ST712x 触摸控制器后,会统一按 ST7123 LCD 初始化。但实际 Tab5 UserDemo 中会读取 ST712x 寄存器
0x0000的固件版本来区分 LCD 方案:FW version = 1: ST7121FW version = 3: ST7123因此,使用 ST7121 屏幕方案的 Tab5 在当前 BSP 下无法正确初始化显示。
修改内容
esp_lcd_st7121LCD panel componentm5stack_tab5BSP 中读取 ST712x FW version,用于区分 ST7121 / ST7123FW version = 1时使用 ST7121 LCD 初始化流程FW version = 3时保持 ST7123 LCD 初始化流程测试
已在一台 ST7121 版本的 M5Stack Tab5 上验证:
git diff --check无格式错误未实机回归测试 ST7123 / ILI9881C 版本。
Note
Medium Risk
Changes runtime board detection and MIPI/LCD init for all Tab5 ST712x units; ST7123 and ILI9881C paths are intended to be unchanged but were not fully regression-tested on hardware per the PR description.
Overview
Adds ST7121 as a third M5Stack Tab5 display variant so boards that share the ST712x touch I2C address no longer always initialize as ST7123.
Board detection in
bsp_display.cnow uses a typed enum and, when the ST712x touch is present, reads touch firmware version from register0x0000: FW 1 → ST7121, FW 3 → ST7123 (unchanged ILI9881C + GT911 path). Unknown FW versions fail withESP_ERR_NOT_SUPPORTEDinstead of assuming ST7123.Display bring-up selects
esp_lcd_new_panel_st7121with ST7121-specific MIPI DPI timing, default init commands in the new driver, and a fixed 965 Mbps DSI lane rate for ST7121. Touch for ST7121 reuses the existing ST7123 touch driver.A new local component
components/lcd/esp_lcd_st7121(MIPI DSI panel driver) is wired into Tab5 viaidf_component.yml/m5stack_tab5.json; root and Tab5 README capability tables list st7121.Reviewed by Cursor Bugbot for commit af2e35d. Bugbot is set up for automated code reviews on this repo. Configure here.