Skip to main content
Ciuffoly
Senior
April 23, 2024
Solved

stm32F429BI + LCD does not switch-on the display

  • April 23, 2024
  • 46 replies
  • 7573 views

I am starting some test with this module
https://it.aliexpress.com/item/1005002482177244.html
with 7” lcd

I have found only one example that run but with Touchgfx

I have got the same ioc from this example to generate a new code and insert the functions to switch on lcd but still no result

I would like to use the normal functions

BSP_LCD_Init() ;

BSP_LCD_DisplayStringAt(10, 80, buf, LEFT_MODE);

BSP_LCD_DrawBitmap(0, 0, (uint8_t *)(&BackGround0));

 

 

 

This topic has been closed for replies.
Best answer by Tesla DeLorean

>>Is there other parts to compare ?

Convince me the SDRAM is working, write and read-back assorted walking bit test patterns.

We've already seen the LTDC getting working colour data from functional memory. Hey park a suitable bit map in internal flash, or some colour bar test patterns in there.

46 replies

Tesla DeLorean
Guru
April 23, 2024

Yeah, not sure your audience here is going to be very large, and the presented code largely unrelated to the issue.

Does it WORK with ANY of the examples you have to hand?

Any details on the display, it's controllers, datasheets, etc? Does the vendor have a github, or code available?

Looks to be a FANKE FK429M1-BIT6 board.

This example? Always cite what you're dealing with

https://github.com/aventuri/fk429m1-lcd5-touchGfx-stub/blob/master/README.md

Expect you're going to need to code or port a driver, but for that you'll need actual workable details.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
Ciuffoly
CiuffolyAuthor
Senior
April 23, 2024

Yes, the fk429m1-lcd5-touchGfx-stub-master example work but it need TouchGfx develop tool..

I want to use normal BSP function because I have develop many graphic item in the previous projects using the STM32F469-DISCO and STM32F746-DISCO.

MM..1
Super User
April 23, 2024

BSP is created for concrete display, then you write own or correct differences for actual used display. TouchGFX have nothink todo with driver and hw part. TouchGFX is C++ code generator for inteligent GUIs.

IOC dont generate hw based part of configs and required parts of code.

Ciuffoly
CiuffolyAuthor
Senior
April 23, 2024

this is my last code that does not run

www.audiodesignguide.com/sw1/stm32F429BI-test2.zip

 

Tesla DeLorean
Guru
April 23, 2024

Frame buffer 1024x600, LTDC 800x480

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
Ciuffoly
CiuffolyAuthor
Senior
April 23, 2024

new ver with strange vertical line

www.audiodesignguide.com/sw1/stm32F429BI-test2%20%282%29.zip

 

hltdc.Instance = LTDC;

hltdc.Init.HSPolarity = LTDC_HSPOLARITY_AL;

hltdc.Init.VSPolarity = LTDC_VSPOLARITY_AL;

hltdc.Init.DEPolarity = LTDC_DEPOLARITY_AL;

hltdc.Init.PCPolarity = LTDC_PCPOLARITY_IPC;

hltdc.Init.HorizontalSync = 1;   ?

hltdc.Init.VerticalSync = 1;   ?

hltdc.Init.AccumulatedHBP = 76;   ?

hltdc.Init.AccumulatedVBP = 40;  -> see vertical line and with 23 no output

hltdc.Init.AccumulatedActiveW = 880;   ?

hltdc.Init.AccumulatedActiveH = 520;   ?

hltdc.Init.TotalWidth = 1080;   ?

hltdc.Init.TotalHeigh = 542;   ?

hltdc.Init.Backcolor.Blue = 0;

hltdc.Init.Backcolor.Green = 0;

hltdc.Init.Backcolor.Red = 0;

if (HAL_LTDC_Init(&hltdc) != HAL_OK)

{

Error_Handler();

}

pLayerCfg.WindowX0 = 0;

pLayerCfg.WindowX1 = 799;

pLayerCfg.WindowY0 = 0;

pLayerCfg.WindowY1 = 479;

pLayerCfg.PixelFormat = LTDC_PIXEL_FORMAT_RGB888;

pLayerCfg.Alpha = 255;

pLayerCfg.Alpha0 = 0;

pLayerCfg.BlendingFactor1 = LTDC_BLENDING_FACTOR1_CA;

pLayerCfg.BlendingFactor2 = LTDC_BLENDING_FACTOR2_CA;

pLayerCfg.FBStartAdress = 0xD0000000;

pLayerCfg.ImageWidth = 800;

pLayerCfg.ImageHeight = 480;

pLayerCfg.Backcolor.Blue = 0;

pLayerCfg.Backcolor.Green = 0;

pLayerCfg.Backcolor.Red = 0;

if (HAL_LTDC_ConfigLayer(&hltdc, &pLayerCfg, 0) != HAL_OK)

{

Error_Handler();

}

pLayerCfg1.WindowX0 = 0;

pLayerCfg1.WindowX1 = 800;

pLayerCfg1.WindowY0 = 0;

pLayerCfg1.WindowY1 = 400;

pLayerCfg1.PixelFormat = LTDC_PIXEL_FORMAT_ARGB8888;

pLayerCfg1.Alpha = 0;

pLayerCfg1.Alpha0 = 0;

pLayerCfg1.BlendingFactor1 = LTDC_BLENDING_FACTOR1_CA;

pLayerCfg1.BlendingFactor2 = LTDC_BLENDING_FACTOR2_CA;

pLayerCfg1.FBStartAdress = 0;

pLayerCfg1.ImageWidth = 0;

pLayerCfg1.ImageHeight = 0;

pLayerCfg1.Backcolor.Blue = 0;

pLayerCfg1.Backcolor.Green = 0;

pLayerCfg1.Backcolor.Red = 0;

if (HAL_LTDC_ConfigLayer(&hltdc, &pLayerCfg1, 1) != HAL_OK)

{

Error_Handler();

}

 

 

20240423_223316.jpg

Tesla DeLorean
Guru
April 23, 2024

This is an up-hill struggle.

What's the Make/Model of Screen?

What's the Resolution of the Screen?

Can you provide a picture of the back showing the controller or part#, large, clear and in-focus.

Is there a Data Sheet for the Screen?

 

Line totals are a combination of sync, front and back porches, and the active portion (ie visible pixels), count's in pixels. Think Preamble, Content, Postamble

https://electronics.stackexchange.com/questions/639750/how-can-front-and-backporch-in-tft-displays-be-inexact

 

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
Ciuffoly
CiuffolyAuthor
Senior
April 23, 2024
Ciuffoly
CiuffolyAuthor
Senior
April 24, 2024

Until now I see only a blue screen

 

/* ARGB8888 colors definitions */

#define LCD_COLOR_ARGB8888_BLUE 0xFF0000FFUL

#define LCD_COLOR_ARGB8888_GREEN 0xFF00FF00UL

#define LCD_COLOR_ARGB8888_RED 0xFFFF0000UL

 

BSP_LCD_Clear(LCD_COLOR_ARGB8888_GREEN);

HAL_Delay(1000);

BSP_LCD_Clear(LCD_COLOR_ARGB8888_RED);

 

 

last project files for Cube IDE

www.audiodesignguide.com/sw1/stm32F429BI-test4.zip

 

 

 

Ciuffoly
CiuffolyAuthor
Senior
April 24, 2024

Until now I see only a blue screen

 

PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_LTDC;

 

#define OK1 --> RUN

#ifdef OK1

PeriphClkInitStruct.PLLSAI.PLLSAIN = 60;

PeriphClkInitStruct.PLLSAI.PLLSAIR = 2;

PeriphClkInitStruct.PLLSAIDivR = RCC_PLLSAIDIVR_2;

#endif

 

#define KO2 --> NOT RUN

#ifdef KO1

PeriphClkInitStruct.PLLSAI.PLLSAIN = 80; // 60=25MHz, 80=33.3MHz ??

PeriphClkInitStruct.PLLSAI.PLLSAIR = 2;

PeriphClkInitStruct.PLLSAIDivR = RCC_PLLSAIDIVR_2;

#endif

Ciuffoly
CiuffolyAuthor
Senior
April 24, 2024

and this hang the system

//int i;

//for (i = 0; i < 10; i++)

// BSP_LCD_DrawPixel(200,100+i, LCD_COLOR_ARGB8888_GREEN);

 

void BSP_LCD_DrawPixel(uint16_t Xpos, uint16_t Ypos, uint32_t RGB_Code)

{

/* Write data value to all SDRAM memory */

if(hLtdcHandler.LayerCfg[ActiveLayer].PixelFormat == LTDC_PIXEL_FORMAT_RGB565)

{ /* RGB565 format */

*(__IO uint16_t*) (hLtdcHandler.LayerCfg[ActiveLayer].FBStartAdress + (2*(Ypos*BSP_LCD_GetXSize() + Xpos))) = (uint16_t)RGB_Code;

}

else

{ /* ARGB8888 format */

*(__IO uint32_t*) (hLtdcHandler.LayerCfg[ActiveLayer].FBStartAdress + (4*(Ypos*BSP_LCD_GetXSize() + Xpos))) = RGB_Code;

}

}

 

 

Tesla DeLorean
Guru
April 24, 2024

Hangs the system, or Hard Fault's ?

Have the HardFault_Handler() output some actionable data, rather than silent death in while(1). Similarly Error_Handler()

Hard Fault would suggest the SDRAM is not working or at wrong address. Check SDRAM, check pointers.

What does Cube say about PLL SAI settings for 33.33 MHz ? Also #define / #ifdef use different key word.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
Ciuffoly
CiuffolyAuthor
Senior
April 24, 2024

In the china example I have found this set for 33Mhz

 

#define LCD_CLK 33 // 33MHz

void LCD_Init(void)
{
u16 LCD_PLLSAIN = 0;
u8 LCD_PLLSAIR = 3;
u8 LCD_CLKDIV = 2;

LTDC_InitTypeDef LTDC_InitStruct;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_LTDC, ENABLE);
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_DMA2D, ENABLE);

LCD_GPIO_Config();

LCD_PLLSAIN = LCD_CLK * LCD_PLLSAIR * LCD_CLKDIV;
RCC_PLLSAIConfig(LCD_PLLSAIN,7,LCD_PLLSAIR);
RCC_LTDCCLKDivConfig(RCC_PLLSAIDivR_Div2)
RCC_PLLSAICmd(ENABLE);

so I have set

#define LCD_CLK 33

 

uint16_t LCD_PLLSAIN = 0;

uint8_t LCD_PLLSAIR = 3;

uint8_t LCD_CLKDIV = 2;

 

PeriphClkInitStruct.PLLSAI.PLLSAIN = LCD_CLK * LCD_PLLSAIR * LCD_CLKDIV;

PeriphClkInitStruct.PLLSAI.PLLSAIR = LCD_PLLSAIR;

PeriphClkInitStruct.PLLSAIDivR = RCC_PLLSAIDIVR_2;

 

but not work

 

 

 

Tesla DeLorean
Guru
April 24, 2024

>>but not work

Ok but your Cube project had HSE at 25 MHz, and the prescaler in the PLL as 15, so the comparison frequency is 1.6667 MHz

Your primary PLL multiplier is 144, getting the VCO to 240 MHz, and CPU at 120 MHz

Check what the LTDC clock is in your Cube Clock Tree, rather than lift codes from the other app with different expectations.

a) Confirm the 60 value relates to 25 MHz LTDC / PIXEL CLOCK

b) Confirm the 80 value relates to 33.33 MHz and doesn't violate any parameters Cube is checking.

 

#define KO2 --> NOT RUN, perhaps no clocking at all, as names different

#ifdef KO1

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
Ciuffoly
CiuffolyAuthor
Senior
April 24, 2024

Here we have:

void SystemClock_Config(void)

{

....

RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;

RCC_OscInitStruct.HSEState = RCC_HSE_ON;

RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;

RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;

RCC_OscInitStruct.PLL.PLLM = 15;

RCC_OscInitStruct.PLL.PLLN = 144;

RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;

RCC_OscInitStruct.PLL.PLLQ = 5;

...

PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_LTDC;

PeriphClkInitStruct.PLLSAI.PLLSAIN = 60;

PeriphClkInitStruct.PLLSAI.PLLSAIR = 2;

PeriphClkInitStruct.PLLSAIDivR = RCC_PLLSAIDIVR_2;

 

and here we have:

 

void HAL_LTDC_MspInit(LTDC_HandleTypeDef* hltdc)

{

...

PeriphClkInitStruct.PLLSAI.PLLSAIN = 60;

PeriphClkInitStruct.PLLSAI.PLLSAIR = 2;

PeriphClkInitStruct.PLLSAIDivR = RCC_PLLSAIDIVR_2;

 

but if I set the new parameters to have 33MHz I see only a black screen and no blue screen

 

void HAL_LTDC_MspInit(LTDC_HandleTypeDef* hltdc)

 

PeriphClkInitStruct.PLLSAI.PLLSAIN = 80; // 60=25MHz, 80=33.3MHz ??

PeriphClkInitStruct.PLLSAI.PLLSAIR = 2;

PeriphClkInitStruct.PLLSAIDivR = RCC_PLLSAIDIVR_2;

 

or

 

#define LCD_CLK 33

 

uint16_t LCD_PLLSAIN = 0;

uint8_t LCD_PLLSAIR = 3;

uint8_t LCD_CLKDIV = 2;

 

PeriphClkInitStruct.PLLSAI.PLLSAIN = LCD_CLK * LCD_PLLSAIR * LCD_CLKDIV;

PeriphClkInitStruct.PLLSAI.PLLSAIR = LCD_PLLSAIR;

PeriphClkInitStruct.PLLSAIDivR = RCC_PLLSAIDIVR_2;

 

 

 

 

 

 

Ciuffoly
CiuffolyAuthor
Senior
April 24, 2024

if (HAL_LTDC_Init(&hltdc) != HAL_OK)

{

Error_Handler();

}

pLayerCfg.WindowX0 = 0;

pLayerCfg.WindowX1 = 799;

pLayerCfg.WindowY0 = 0;

pLayerCfg.WindowY1 = 479;

pLayerCfg.PixelFormat = LTDC_PIXEL_FORMAT_ARGB8888;

pLayerCfg.Alpha = 255;

pLayerCfg.Alpha0 = 0;

pLayerCfg.BlendingFactor1 = LTDC_BLENDING_FACTOR1_CA;

pLayerCfg.BlendingFactor2 = LTDC_BLENDING_FACTOR2_CA;

pLayerCfg.FBStartAdress = 0x08000000 ; // x 0xD0000000

pLayerCfg.ImageWidth = 800;

pLayerCfg.ImageHeight = 480;

pLayerCfg.Backcolor.Blue = 0;

pLayerCfg.Backcolor.Green = 0;

pLayerCfg.Backcolor.Red = 0;

 

20240424_201933.jpg

 

 

Tesla DeLorean
Guru
April 24, 2024

Ok, so that's indicative that the LTDC is working, but the SDRAM at 0xD0000000 is NOT

Check the SDRAM / Hard Fault situation, you complained that writing the Frame Buffer "Hung" the board, probably Hard Faulted. Establish that is the case. Then make sure the SDRAM is initialized properly, and you can zero fill the Frame Buffer. That should be BLACK. Of fill with 0xFFFFFFFF which should be WHITE

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
MM..1
Super User
April 24, 2024

You write "I have found only one example that run but with Touchgfx"

Why you dont remove TGFX and use it.? Activate displays plus SDRAM plus many other setups isnt beginer job.

an4861-introduction-to-lcdtft-display-controller-ltdc-on-stm32-mcus-stmicroelectronics.pdf

 

Ciuffoly
CiuffolyAuthor
Senior
April 24, 2024

with 0xFFFFFFFF the same result of 0x00000000

Tesla DeLorean
Guru
April 24, 2024

?? Being Blue or Hanging?

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
Ciuffoly
CiuffolyAuthor
Senior
April 24, 2024

with 0xFFFFFFFF and with  0x00000000  I see the strange image post before

 

20240424_201933.jpg