cancel
Showing results for 
Search instead for 
Did you mean: 

LCD-TFT Display: Getting Black Screen (w/ Initial Screen Flicker) - Internal RAM

KMew
Senior III

Hello,

I am trying to use an LCD display on my custom board. I am utilizing the Rocktech RK043FN66HS-CTG display with the STM32H7B3IIT6 MCU. When I first initialize the firmware (in debugging mode), the screen flickers once or twice (showing signs of life), but then immediately goes to a black screen and stays like that.

High Level Configuration Details:

  • Utilizing LTDC interface with DMA2D acceleration
  • Internal RAM (I have the footprint for External RAM, but I wanted to try and get it to work with the Internal RAM. I have sufficient RAM space internally)
  • 480 x 272 RGB565 display (hardware can handle up to RGB888, but to reduce RAM size, I am only using RGB565).
  • Using FreeRTOS to do the TouchGFX task

I used this video as a general guide to make sure I got the right idea, but there are differences. However, he has the same issue during debugging that I am seeing. The screen flickers then goes black.

https://www.youtube.com/watch?v=SRQD8JMeg_k

In that video, he notes that it was due to improper initialization of the RAM that caused that issue, so I am looking there to see if something is wrong.

I am doing a single buffer strategy and the buffer location is By Address, starting at 0x24040000 (AXI SRAM2), which can handle 393.216kByte according to the reference manual.

0693W00000bhEUOQA2.png 

I enabled the MPU region for that region base (SRAM 1, 2 & 3) in the CORTEX_M7.

0693W00000bhEUiQAM.png 

Using the TouchGFX 4.20.0 software package in the CubeMX, I configured it as follows:

0693W00000bhEUxQAM.png 

LTDC Configuration:

0693W00000bhEV7QAM.png0693W00000bhEVCQA2.png 

I am using the enable signal on the display (Pin 31) and the LCD backlight dimming functionality, which I enable at start-up with a base functionality:

HAL_GPIO_WritePin(LCD_EN_GPIO_Port, LCD_EN_Pin, GPIO_PIN_SET);
  uhLCD_PWM = LCD_PULSE_STARTUP;
  TIM12->CCR1 = LCD_PULSE_STARTUP;

(TIM12-CH1 = PB14)

(LCD_Enable is set to PE2)

I verified that the PWM signal from TIM12-CH1 is correct, as well as the voltage level from the enable.

Schematic of my display setup is below.

0693W00000bhEVgQAM.png 

With this setup, I get a screen flicker on start-up, then a black screen after that.

Does anyone know what would cause this?

1 ACCEPTED SOLUTION

Accepted Solutions

Hello MM,

An update. You were right! The DCLK signal was completely distorted and it was due to those 10nF capacitors. I took the design from the STM32H7B3I-EVAL evaluation board, but I made a mistake. In their design, they used a 10pF capacitor and I put a 10nF by accident.

Dumb mistake! :)

Thank you for helping me diagnose it MM!

View solution in original post

13 REPLIES 13
Romain DIELEMAN
ST Employee

Even before enabling TouchGFX I would try this test to be 100% sure it comes from the configuration.

/Romain

Hello Romain,

Thank you for the suggestion. I will try this this morning and see if it works

Hello Romain,

I prepared the setup as per the instructions and the results are the same. I get a screen flicker when I first initialize it, but then it goes black.

I used the same configuration as above (clock frequencies, LTDC parameter/layer settings, etc.).

My LTDC clock is set to 9 MHz, as recommended by the datasheet of the display. The only part I'm questioning is the Data Enable Polarity, but I tried both Active High and Active Low, neither worked.

0693W00000bhIKIQA2.png 

0693W00000bhIKNQA2.png 

Additionally, I looked at the frame buffer's internal RAM address and they are within AXI SRAM1 and with (albeit tightly) within SRAM1.

0693W00000bhIKrQAM.png 

Do you have any suggestions?

MM..1
Chief II

On your config images you need LTDC mode RGB888 if your wires on STM is connected RGB888

Layer FB and TGFX then can use RGB565.

And LCD need first work without TouchGFX.

Hello MM.

Thank you for the reply!

I did not know this. Thank you for letting me know!

I changed it to RGB888 and verified the LTDC pins are configured correctly. I get the same result. Screen flickers then goes black.

Ok on same screen Layer settings, how address you setup for layer?

You test with TouchGFX or without ?

show main code

TGFX by address cant place framebuffer into RAM, you need modify linker script ...

Try start test By Allocation

Hello MM,

As recommended by Romain, I am attempting to get it working without TouchGFX. I am trying to run this test:

https://support.touchgfx.com/4.21/docs/development/board-bring-up/how-to/03-display-internal#checking-the-display-colors

Main.c

/* USER CODE BEGIN PV */
uint16_t framebuffer[480*272];  //16 bpp framebuffer
/* USER CODE END PV */
 
................................
 
int main(void)
{
  /* USER CODE BEGIN 1 */
 
  /* USER CODE END 1 */
 
  /* MCU Configuration--------------------------------------------------------*/
 
  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();
 
  /* USER CODE BEGIN Init */
 
  /* USER CODE END Init */
 
  /* Configure the system clock */
  SystemClock_Config();
 
  /* USER CODE BEGIN SysInit */
 
  /* USER CODE END SysInit */
 
  /* Initialize all configured peripherals */
  MX_GPIO_Init();
  MX_LTDC_Init();
  /* USER CODE BEGIN 2 */
  HAL_LTDC_SetAddress(&hltdc, (uint32_t)framebuffer, LTDC_LAYER_1);
  HAL_GPIO_WritePin(GPIOE , GPIO_PIN_2 , GPIO_PIN_SET);
  HAL_GPIO_WritePin(GPIOB, GPIO_PIN_14, GPIO_PIN_SET);
 
  uint8_t r    = 0xff, g = 0x00, b = 0x00;             // Solid red
  uint16_t col = ((r>>3)<<11) | ((g>>2)<<5) | (b>>3);  // Convert colors to RGB565
  // Put colors into the framebuffer
  for(int i = 0; i < 480*272; i++)
  {
    framebuffer[i] = col;
  }
  /* USER CODE END 2 */
 
  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
    /* USER CODE END WHILE */
 
    /* USER CODE BEGIN 3 */
  }
  /* USER CODE END 3 */
}

stm32h7xx_it.c

void LTDC_IRQHandler(void)
{
  /* USER CODE BEGIN LTDC_IRQn 0 */
 
  /* USER CODE END LTDC_IRQn 0 */
  HAL_LTDC_IRQHandler(&hltdc);
  /* USER CODE BEGIN LTDC_IRQn 1 */
  HAL_LTDC_ProgramLineEvent(&hltdc,0);
  /* USER CODE END LTDC_IRQn 1 */
}

Check your DCLK pin 30 LCD signal with scope. HSYNC VSYNC too.

Hello MM,

I will do that! What should I be looking for, specifically?