2023-07-09 07:23 AM - edited 2023-07-09 07:24 AM
Hi ST experts,
I'd like to build a bare metal ARM cortex-A7 driver for my MIPI DSI display module. Because there is no HAL driver for LTDC and DSI host then I decided to build it from scratch. I followed the procedures from the STM32MP RM document to configure the parameters and initialize the HW. However, I couldn't read the display ID from DCS read command, checking bit 4 PRDFE (in register DSI_GPSR) is always 1. I tried to configure u-boot to support my display module, compiled the u-boot then I could execute DCS commands without any problem. It took a few weeks to compare my driver implementation line by line with the u-boot driver, even dumping out all the register values. Finally, I noticed there is a different register setting in the u-boot driver:
#define WRPCR_REGEN BIT(24) /* REGulator ENable */
#define WRPCR_BGREN BIT(28) /* BandGap Reference ENable */
/* Enable the regulator */
dsi_set(dsi, DSI_WRPCR, WRPCR_REGEN | WRPCR_BGREN);
There is no bit 28 in the RM document. Interestingly, if bit 28 is not set then the DCS commands do not run correctly. Is that missing in the RM documentation or are there any additional configuration steps needed to be added into the driver?
Another question related to the LTDC configuration, since we use MIPI DSI pins (clkp/n, datap/n) can I omit configuring the parallel LCD interface pins such as LTDC_R/G/B, LTDC_HSYNC/VSYNC...?
Your kind help is much appreciated.
2023-07-21 09:20 AM - edited 2023-07-21 09:21 AM
Hi @Phuong Dang
Maybe look at CubeH7 as STM32H747 which use very similar LTDC and DSI
For instance look at Projects\STM32H747I-DISCO\Examples\LCD_DSI
Regarding bit 28, there is effectively an issue in the documentation which will be corrected in future revision.
You should set it to 1.
when using DSI, the LTDC data are fed internally and there is no need to setup any LTDC pins (it is even not recommended for noise point of view).
Regards.
2023-07-26 12:16 AM - edited 2023-07-26 12:20 AM
Hi Patrick,
Thanks for sharing the information.
After setting bit 28, my driver works well. Now I'm working on LVGL graphic library, however, its performance is not really good, FPS is about 7 frame/s. Is there any bare-metal GPU implementation for STM32MP1? Just tried to refer to the GPU spec in the RM but there is not much description in there.
Thanks
2023-09-08 08:56 AM
This is very interesting. Are you able to share the baremetal MIPI DSI driver code? I maintain a repository of bare-metal example projects for the STM32MP1 and it would be very welcome there. https://github.com/4ms/stm32mp1-baremetal
I've been using LVGL on the MP153 chip, and performance is good even though I'm using SPI to write to the screen. I can get around 30fps maximum (SPI bus is the bottleneck). My screen is only 240x320x16bit. I would imagine using MIPI DSI would get able to obtain much better frame rate, so I'm surprised to see you only were able to get 7FPS. LVGL will need to be set up to use two frame buffers of course.
As for the GPU, I've wondered the same thing. There are gcnano driver is only available as a binary which requires linux. So, to use it in bare-metal I imagine it would require a linux-like kernel wrapping it (which would be a major project). Another approach might be to look at the reverse-engineering efforts here: https://github.com/etnaviv