cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F429I-discovery : Print "Hello, world" on LCD

Fred830d
Associate II

I want to display "Hello, world" on the onboard screen of my STM32F429I-discovery board. Searching around the internet showed that the BSP has a library called "stm32f429i_discovery_lcd.h" that suits this purpose. Simply including the library with

#include "stm32f429i_discovery_lcd.h"

yielded build errors, because the compiler could not find the library file. In addition, even after adding the file location to my project's include path, I got warnings stating that "static SDRAM_HandleTypeDef SdramHandle" is not defined, which suggested to me that some associated source files might not be included in the build.

After a long time I finally just decided to include the BSP/Components directory and the BSP/STM32F429I-Discovery directory to my project, add the include paths, and add the two folders to the source location.

Fred830d_0-1746091539664.png

With this code, I had hoped that the screen would turn red, but unfortunately, it does literally nothing:

#include "main.h"

/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#include "stm32f429i_discovery_lcd.h"  
/*More stuff */

/* Initialize all configured peripherals */
  MX_GPIO_Init();
  MX_CRC_Init();
  MX_DMA2D_Init();
  MX_FMC_Init();
  MX_LTDC_Init();
  /* USER CODE BEGIN 2 */
  BSP_LCD_Init();
  BSP_LCD_LayerDefaultInit(0, LCD_FRAME_BUFFER);
  BSP_LCD_SelectLayer(0);
  BSP_LCD_Clear(LCD_COLOR_WHITE);
  BSP_LCD_SetBackColor(LCD_COLOR_RED);

I have not touched the .ioc file, I just assumed that the onboard screen was ready to use "out of the box".

Can anyone help me display "Hello world" on the screen?

6 REPLIES 6
Andrew Neil
Super User

@Fred830d wrote:

BSP has a library called "stm32f429i_discovery_lcd.h" ?


That's not a library - that's just a header file.

Basically, a header file just gives the compiler information about the interface to the library - it does not implement the library's functions.

 


@Fred830d wrote:

yielded build errors, because the compiler could not find the library file. 


Of course - because you have not included the implementation of the library.

 


@Fred830d wrote:

Can anyone help me display "Hello world" on the screen?


Is there not an example which uses the LCD ?

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

Hi Andrew

I found an example in my /STM32Cube/Repository/STM32Cube_FW_F4_V1.28.1/Projects/STM32F429I Discovery/Examples/BSP directory, and tried copying the code that involves the LCD from main.c over to my project and run it. The LCD still never displays anything. I have also tried playing with the configuration values of FMC, LTDC, DMA2D to see if that helped. It didn't. I suppose these configuration settings are actually important for the LCD to work properly. Here are the current settings: -

Fred830d_0-1746100127009.png

I appreciate any help I can get. I cannot find anything on the internet about this.

 

 

Did you try just running the example as-is?

Have you tried using TouchGFX ?

https://www.st.com/en/evaluation-tools/32f429idiscovery.html#tools-software

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.
GaetanGodart
ST Employee

Hello @Fred830d ,

 

As Andrew said, the simplest way is probably to use TouchGFX (Aarhus based :) ).

Here are our guides :

 

If you just want to set a red screen, you should be able to do it but you probably shouldn't modify the values of FMC and LTDC from the example, they probably already use the correct values for the display.
You can have a look at this guide and the 2 guides that are prerequisite for this one too.

 

Regards,

Gaetan Godart
Software engineer at ST (TouchGFX)
Fred830d
Associate II

Thanks for the suggestions guys, I will try them out as soon as I have time for it. I will return with updates on how it went. I appreciate the effort.

MOBEJ
ST Employee

Hello @Fred830d ,

You can utilize the BSP example for the STM32F429I-Discovery board available on GitHub (link) . Alternatively, you can download the STM32CubeF4 package from ST.com. Once downloaded, follow this path: Firmware\Projects\STM32F429I-Discovery\Examples\BSP
In this BSP example , you will find a sub-example named LCD Demo. This example demonstrates how to use various LCD features, such as displaying strings with different fonts, displaying various shapes, and drawing bitmaps.

To customize the display to show "Hello World" on your board, you can modify the lcd.c file within the example.

 

BR

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.