-
Notifications
You must be signed in to change notification settings - Fork 90
fix MIPI DSI driver #515
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
base: main
Are you sure you want to change the base?
fix MIPI DSI driver #515
Conversation
| self->panel_config.dpi_clk_src = MIPI_DSI_DPI_CLK_SRC_DEFAULT; | ||
|
|
||
| self->panel_config.dpi_clock_freq_mhz = (uint32_t)args[ARG_freq].u_int; | ||
| self->panel_config.dpi_clock_freq_mhz = (uint8_t)args[ARG_clock_freq].u_int; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these new parameter names (also ARG_lane_bitrate) are up for discussion of course
| #include "esp_lcd_panel_io.h" | ||
| #include "esp_lcd_mipi_dsi.h" | ||
|
|
||
| #define DPI_PANEL_MAX_FB_NUM 3 // from "mipi_dsi_priv.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DPI_PANEL_MAX_FB_NUM is in a private header file in the current ESP-IDF version so that's one way to define it for this driver
| void *buf = heap_caps_calloc(1, size, caps); | ||
|
|
||
| mp_obj_array_t *view = MP_OBJ_TO_PTR(mp_obj_new_memoryview(BYTEARRAY_TYPECODE, 1, buf)); | ||
| mp_obj_array_t *view = MP_OBJ_TO_PTR(mp_obj_new_memoryview(BYTEARRAY_TYPECODE, size, buf)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't entirely sure about these allocations. One thing I found out is that the current allocation mechanism defined in the DisplayDriver didn't work very well. To make my display work I had to explicitly create buffers in SPIRAM (see code example I included in the PR description)
|
we are going to have to "roll our own" LDO handling. This is not a big deal to do and a separate user module should be used to do it or we can extend the built in MicroPython Pin class to handle it. After all the LDO is simply a GPIO that has a loop to an input. It would function only as an output pin and the voltage would be set by the user. It shouldn't be that difficult to extend the Pin class but for the sake of clarity I think I may be better to create a new class specifically to handle the LDO. It should be located in the machine module. I can handle taking care of that. |
|
I have been looking at the code changes you made and I am thinking it might be best to do the modifications needed to get the software rotation working across all of the drivers at the same time. I am going to dig into what that is going to look like in a few hours. |
the LDO in question is a feature of ESP32P4 chip. There's a built-in 4-channel (2 channels for Flash/PSRAM + 2 extra channels) LDO that's controlled via a separate driver: https://docs.espressif.com/projects/esp-idf/en/stable/esp32p4/api-reference/peripherals/ldo_regulator.html and it's not intersecting with any of the GPIO registers as far as I understand |
As discussed here, I'm submitting the fixes I made to make the DSI driver work.
Boards tested
The only ESP32P4 board that I have is WHY2025 badge (https://gitlab.com/why2025/team-badge/Hardware) with st7703-based screen (exact model is W395HDC001-A).
One thing to note is that on this board the screen is powered via one of the channels of ESP32P4 LDO, which is not currently supported by micropython, however I opened a PR there
Code exampled used to test the display
I can submit another PR with the ST7703 driver, but there's nothing I've implemented except for the custom initialization commands specific to my particular display. Rotation also doesn't work for this display for some reason (I've tried a bunch of different MADCTL commands but it only ever flips at either 90 or 270 degrees).