cancel
Showing results for 
Search instead for 
Did you mean: 

How to configure CubeMX to enable LCD in STM32F469i-disco

Wojciech Sura
Associate II
Posted on June 24, 2018 at 22:57

I'm hopelessly trying to configure CubeMX to enableLCD TFT on STM32F469i-disco board (bought recently if that matters). The best effect so far is the following:


_legacyfs_online_stmicro_images_0690X0000060N6OQAU.png

What I did:

1. Used CubeMX to generate configuration with all peripherials configured

2. Switched off all I did not need (for instance the RTOS, USART etc.)

3. Selectively copied BSP drivers from the CubeF4 examples. I added all dependencies (components, fonts), such that project builds correctly

4. I try to draw cross through the whole screen, important part of the main.c follows (I stripped comments to improve clarity):

int main(void) { HAL_Init(); SystemClock_Config(); MX_GPIO_Init(); MX_CRC_Init(); MX_DMA2D_Init(); MX_DSIHOST_DSI_Init(); MX_FMC_Init(); MX_I2C1_Init(); MX_I2C2_Init(); MX_LTDC_Init(); MX_QUADSPI_Init(); MX_SAI1_Init(); MX_SDIO_SD_Init(); MX_TIM1_Init(); MX_FATFS_Init(); BSP_SDRAM_Init(); BSP_LCD_InitEx(LCD_ORIENTATION_LANDSCAPE); BSP_LCD_DisplayOn(); BSP_TS_Init(800,480); BSP_LCD_LayerDefaultInit(0, 0xC0000000); BSP_LCD_SelectLayer(0); BSP_LCD_DisplayOn(); BSP_LCD_Clear(LCD_COLOR_DARKCYAN); BSP_LCD_SetTextColor(0x00000000); BSP_LCD_DrawLine(0, 0, 799, 399); BSP_LCD_DrawLine(0, 399, 799, 0); while (1) { } }

This is the best effect I could achieve, at least the lines are visible, but obviously this is not what I'm counting on.

I attached the CubeMX configuration file to this post. I'm kinda new in microcontroller programming (a background with Arduino only), so I have no clue, what might I misconfigured. As the source is really simple, I guess, there's something in CubeMX, that I have misconfigured or not configured, but I'm running out of ideas. I looked at the CubeF4 demos, but they lack CubeMX configuration files. Also, I failed to deduce from the sources, how to configure the LTDC in CubeMX.

I can attach the whole project if needed (though there is nothing more than HAL and BSP copied from F4).

What am I missing? How can I fix the configuration? Is there a place in the Internet that shows how to configure CubeMX for LCD?

#stm32f469-discovery #stm32f469-dsi #lcd
15 REPLIES 15
Imen.D
ST Employee

Posted on June 25, 2018 at 12:51

 Hello wojciechsura,

It may be is due to the LCD configuration.

I recommend you to follow AN4861 (https://www.st.com/content/ccc/resource/technical/document/application_note/group0/25/ca/f9/b4/ae/fc/4e/1e/DM00287603/files/DM00287603.pdf/jcr:content/translations/en.DM00287603.pdf), it may help you on the LCD configuration.

https://community.st.com/0D50X00009bMM6QSAW

With Regards,

Imen

PS: Manually edited by Amel NASRI on 27/09/2019 to fix link to AN4861 

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Arthur  Jordan
Associate II
Posted on June 25, 2018 at 16:59

Hello,

I'm having the same issues with the STM32F469I-DISCO and CubeMX-generated code. After setting up all BSP files and getting the project to compile without problemsI got a very similar output on the LCD.The text is a little blurry but readable. I'm also outputting the ADC value on the screen here.

I'm also new to STM32 and lack ideas how to solve this issue. Mybe a clock source is configured incorrectly? This is still a section I left untouched after it was generated by CubeMX, although after verifying it roughly, it should be fine...

Actually the solution to this problem should not be too difficult since all settings for the interfaces and the LCD controller are in the BSP files. Making changes to the LTDC inside Cube doesn't affect anything. Wondering where exactly cube interferes here....Any suggestions would be highly appreciated.

Greetings,

AJ

0690X0000060PHDQA2.jpg

________________

Attachments :

TestF469I.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HxTR&d=%2Fa%2F0X0000000ayW%2FHYClwOnvPPRWPcxhlBk5Q3lVL3_yGqLVSgkuZ_EE8b4&asPdf=false
Posted on June 25, 2018 at 21:50

Hi Imen, thanks for the answer.

Since STMF469I-Disco is a very specific piece of hardware, could you give us a hint about the settings? I already saw the document you linked, but it mostly defines boundaries, but does not specify, what values should we enter for certain parameters and there are a lot of them - especially for beginners (clock, pixel format, synchronization to name a few). Also it seems, that there might be some kind of generic problem, as Arthur Jordan seemed to have problem either identical or very similar to mine (I can no longer see his post though).

Maybe you could provide us with pre-configured CubeMX file to work with BSP? I managed to include BSPs into my project without bigger problems, it's mostly about setting proper include directories.

Best regards -- Wojciech 'Spook' Sura.

Posted on June 27, 2018 at 06:37

PS: From Imen's suggestion I just stumbled upon the AN4860 (

https://www.st.com/content/ccc/resource/technical/document/application_note/group0/1d/b8/33/4f/dc/0a/45/52/DM00287601/files/DM00287601.pdf/jcr:content/translations/en.DM00287601.pdf

 )

which, besides explaining the DSI part, describes how to set up the DSI host in CubeMX. Unfortunately I cannot dig deeper into the subject this week due to time constraints but I sure will. Hope this helps someone.

Posted on June 29, 2018 at 15:35

If you try to draw something colorful, you'll notice the same effect as in my case. Try to fill screen with solid color like 0xff0000ff - you will notice, that it cycles through RGB - like the value you chose had invalid size (and someone took like 24 from 32 bits. In this case the flickering also can be easily seen.

It looks like some kind of timing problem for me, though I have no idea on where to seek. I spent some time blindly changing parameters of layers, LTDC, DMA2D, but usually with no effect. Is there anyone at all, who succeeded in configuring the STM32F469I with BSP and LCD? This is really weird, that we independently got stuck in exactly the same situation.

Posted on June 29, 2018 at 17:57

Tried it out. I agree. Looks quite sad

Spent another morning trying to get the thing running, without success. I implemented all the settings for the LTDC and DSIHOST in CUBEMX as well as the clocks as proposed in AN4860 but it didn&39t change much. The displayed text is not readable at all now. The split screen is still there. Just for kicks i set  RCC_OscInitStruct.PLL.PLLM = 4 in SystemClock_Config() to 8 and this made the &39split screen&39 go full screen but with not much more.

There&39s this forum topic with somebody sharing a Cubemx project with a partially working LCD with BSP libraries:

https://community.st.com/0D50X00009XkXVRSA3

 

Unfortunately je Cubemx project file doesn&39t work for me and the Display is offset in the X-direction and flickers a little. 

Besides my attempts with setting up a Cubemx project with a  working LCD I also tried initializing the necessary peripherals within the examples which is also quite difficult...what a newbie dilemma.

Posted on July 03, 2018 at 12:36

I'm starting to wonder, if BSP libraries are compatible with CubeMX at all. Consider the fact, that we have exactly the same issue regardless of the fact, that we configured board separately. Moreover, the effect I achieved is after choosing 'configure peripherials' in CubeMX, what should set up all peripherials optimally.

Since BSP libraries are crafted for every specific eval board, maybe the solution is simply to use BSP with their HAL configurations only? I thought of comparing BSP's HAL configurations to ones generated by CubeMX to find differences, but I'm affraid, that there may be too many differences to spot the important ones.

I'll try to create an empty BSP-only project and try to display something on LCD, will share results here.

Posted on July 06, 2018 at 18:41

I managed to prepare a working, self-contained project using BSP. You can clone it from the following repo: 

https://community.st.com/external-link.jspa?url=https%3A%2F%2Fgitlab.com%2Fspook%2FBSPTemplate.git

The project itself should open in ST4STM32 and correctly displays white screen with two diagonal lines through the whole screen.

Posted on July 07, 2018 at 10:24

Thanks for sharing your progress. Can you open this as a project directly in System Workbench? Do I have to set anything else up since i was not able to compile it as a AC6 STM32 application?.

By the way, I'm using the very versatile BSP example as a basis for my project now (the one that demonstrates many features of the board). I managed to incorporate the code for certain peripherals, as generated by CubeMX, into the project.