2024-04-09 04:08 AM
I am developing an application that uses TouchGFX and having issues getting DSI clocks to the display.
I am using a STM32F469i-DISCO and have replaced the supplied 800x480 screen with my own 800x800 MIPI DSI video mode display connected via an external adaptor board. All the interface signals required to drive the new display are present on the interface to the original LCD so all I have had to do is rearrange them for the new display.
My problem is that I don't see any DSI clocks going to my display. I have checked the DSI data and clock lanes for hardware issues such as shorts etc, they are ok.
I have created a simple 'Hello World' project using TouchGFX designer targeted at the original 480x800 display which runs fine using the STM32CubeIDE version.
I have then adjusted the project built by TouchGFX designer using STM32CubeIDE and STM32CUBEMX to suit my display.
To help with this process as a guide I have been following the TouchGFX. documentation https://support.touchgfx.com/docs/category/introduction
I suspect the reason I'm not getting DSI clocks is because the RCC Peripheral Clock enable is not being enabled.
The TouchGFX documentation ( https://support.touchgfx.com/docs/development/touchgfx-hal-development/scenarios/scenarios-dsi-video-mode) gives an example of using a DSI video-mode display which says After calling HAL_DSI_Start(), switch DSIHOST clock to the DSIPHY source. The document then shows some example user code for doing this as follows:-
/* Switch to DSI PHY PLL clock */
RCC_PeriphCLKInitTypeDef PeriphClkInit;
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_DSI;
PeriphClkInit.DsiClockSelection = RCC_DSICLKSOURCE_DSIPHY;
HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit);
/* USER CODE END DSIHOST_Init 2 */
Unfortunately the API for STM32F4xx does not define the parameter RCC_PERIPHCLK_DSI or the member selection of PeriphClkInit.DsiClockSelection I believe these are from the STM32L4xx API (though the documentation doesn't explain this nor state that the configuration is explicitly for the STM32L4xx or at least not for the STM32F4xx which is in my opinion a bit poor!).
I may be barking up the wrong tree here as my .ioc configuration for STM32CubeMX definetly shows the DSI clock source as coming from DSIPHY, however I don't see a way to enable the DSI Host clock from the RCC either in STM32CubeMX or in the code.
I've not got much hair left to tear out so any help would be appreciated.
2024-04-09 04:50 AM
Hello @RobNewbury ,
We have received a report of a similar issue with another round MIPI-DSI display. We are investigating it and will inform you as soon as we find something.
Thank you for your patience
Best regards,
2024-04-15 09:26 AM
It is correct that I am using a circular display, however I think my problem is generic to any Video Mode display used with STM32F469 when developing using the HAL API.
The TouchGFX documentation says After calling HAL_DSI_Start(), switch DSIHOST clock to the DSIPHY source and gives the following example code which is to be added in a user code section.
/* Switch to DSI PHY PLL clock */
RCC_PeriphCLKInitTypeDef PeriphClkInit;
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_DSI;
PeriphClkInit.DsiClockSelection = RCC_DSICLKSOURCE_DSIPHY;
HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit);
/* USER CODE END DSIHOST_Init 2 */
My problem is the API driver STM32f4xx_hal_ex.c does not contain support for the DSI PHY clock source so I am not clear as to how I should be enabling the DSIHOST clock to switch to the DSIPHY source?
Without this code when I write to the DSI GPDR register, the FiFo reports full (DSI_GPSR_CMDFE=0) after about 20 bytes have been written so I think the DSI clock is not being enabled. Also I don't see a clock on the DSI Clock lane when probing with an oscilloscope.
2024-04-15 10:11 AM
DSI clock source is either the DSI PHY or PLL R tap, selected via RCC_DCK_CFGR / DSISEL, default is from the PHY
RCC_APB2ENR for the DSIEN and LTDCEN
Mechanics of bring up fairly well demonstrated here: https://github.com/STMicroelectronics/32f469idiscovery-bsp/blob/ec051de2bff3e1b73a9ccd49c9b85abf7320add9/stm32469i_discovery_lcd.c#L178
The F7 and H7 implementations cleaned and separated clock sources more cleanly. The F4 is a very old architecture with the tail-end devices having DSI bolted on. It's also running materially slower, and the DSI at 500 MHz (250 MHz clock edges) is beyond those of the original PLL/VCO/MCU expectations.
The designs tend to be a linear progression, the design team moves to the next device, and doesn't revisit older designs.
As the DSI has it's own clocking mechanics it doesn't have to share things, it just needs to be faster than the LTDC shovels the data to it. The LTDC deals with most of the frame timing, and that does have Peripheral clock selection options.
2024-04-15 11:22 AM
I use F469 and never require this. But i search and found in drivers rcc headers FYI
#if defined(STM32F469xx) || defined(STM32F479xx)
#define __HAL_RCC_DSI_CLK_ENABLE() do { \
__IO uint32_t tmpreg = 0x00U; \
SET_BIT(RCC->APB2ENR, RCC_APB2ENR_DSIEN);\
/* Delay after an RCC peripheral clock enabling */ \
tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_DSIEN);\
UNUSED(tmpreg); \
} while(0U)
#define __HAL_RCC_DSI_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_DSIEN))
#endif
/** @brief Macro to configure the DSI clock.
* @PAram __SOURCE__ specifies the DSI clock source.
* This parameter can be one of the following values:
* @arg RCC_DSICLKSOURCE_PLLR: PLLR output used as DSI clock.
* @arg RCC_DSICLKSOURCE_DSIPHY: DSI-PHY output used as DSI clock.
*/
#define __HAL_RCC_DSI_CONFIG(__SOURCE__) (MODIFY_REG(RCC->DCKCFGR, RCC_DCKCFGR_DSISEL, (uint32_t)(__SOURCE__)))
/** @brief Macro to Get the DSI clock.
* @retval The clock source can be one of the following values:
* @arg RCC_DSICLKSOURCE_PLLR: PLLR output used as DSI clock.
* @arg RCC_DSICLKSOURCE_DSIPHY: DSI-PHY output used as DSI clock.
*/
#define __HAL_RCC_GET_DSI_SOURCE() (READ_BIT(RCC->DCKCFGR, RCC_DCKCFGR_DSISEL))
/** @defgroup RCCEx_DSI_Clock_Source RCC DSI Clock Source
* @{
*/
#define RCC_DSICLKSOURCE_DSIPHY 0x00000000U
#define RCC_DSICLKSOURCE_PLLR ((uint32_t)RCC_DCKCFGR_DSISEL)
2024-04-15 01:41 PM
Thanks Tesla DeLorean, this is great, I'm new to the STM32 so your observation about the F7 & H7 clock implentation being cleaner than that for the F4 will likely help to steer my future selection of processors. Thanks for pointing out the video-mode DSI clock bring-up example. I had seen this previously and agree it should work, I was concerned that I drove my project from TouchGFX then refining for my chosen display using STM32CubeMX so I have to get my head around how to fit this with the example.
I will post an update when I make more progress.
2024-04-15 01:52 PM
Thanks MM.. 1, I had missed this in the rcc files. I am new to STM32 so I need to go away and think about how I'm going to implement the the DSIHOST clock to the DSIPHY source as suggested in https://support.touchgfx.com/docs/development/touchgfx-hal-development/scenarios/scenarios-dsi-video-mode
but using the API for the rcc.
I'll post back when I make some progress.
2024-05-02 06:06 AM
Hello @RobNewbury ,
Sorry for the late response. I can see our good friends @MM..1 and @Tesla DeLorean have provided wonderful and useful information already.
Just wanted to update on this issue that we were not able to measure similar parameters as you did. However, there are examples for setting up the board for DSI Video mode both with single and double framebuffer. You can access them from opening STM32CubeMX -> New Project -> Example Selector and searching for STM32F469I-DISCO under the Board section. You might need to modify some settings to fit your case, but I think it's a good base to start your project on.
I hope this helps you
2024-05-03 06:36 AM
Thanks Mohammad, this is great I hadn't previously spotted that DSI video mode example in STM32CubeMX which I have now looked at and I can confirm that it runs fine on my (unmodified) STM32F469I-DISCO board.
If I connect my own circular display in place of the built in display then without doing anything else I see some scrambled lines grouped around the centre of the dispay. This is good because as you say I need to modify the example code to configure for my display. This is a whole lot more than I was getting previously when I was following the TouchGFX documentation scenario for MIPI-DSI Video mode https://support.touchgfx.com/docs/development/touchgfx-hal-development/scenarios/scenarios-dsi-video-mode#dsihost-ltdc-initialization-sequence
I will continue to correctly configure my display using the example that you have highlighted and then I will try to understand how I can use TouchGFX for future applications.
I will keep this thread open and add an update when I have achieved my aim.
2024-05-03 07:44 AM - edited 2024-05-03 07:44 AM
Glad to hear that you are making progress :D
Yes, it is always helpful to start simple and make small improvements.
We will update the documentation to reflect better on STM32F469I-DISCO
Best regards,