cancel
Showing results for 
Search instead for 
Did you mean: 

Synchronizing LCD output with Tearing-Pin information?

MLa.3
Associate II

Hi,

I am using the ST32F412G discovery board, which has a 240x240 LCD attached to the controller using the FSMC interface. At the moment I am using the driver from the board support package and drawing works fine.

I will be drawing moving shapes to the LCD and therefore I need to update the LCD continuously.

At the moment all the write commands to the LCD are not synchronized to anything (roughly every 20ms all the drawing instructions are sent to the LCD, based on a scheduler in the main loop).

Because sending the commands and the LCD scan are not synchronized, I see half-updated frames on the screen. I read the manual for the LCD driver (ST7789H2) and found that there is a Tearing-Effect Pin which can provides synchonization pulses to the MCU.

I could think of two solutions to this problem:

Solution 1: Keep a frame buffer in the internal ram (only 256k on ST32F412G) and then wait for the Tearing-PIN to show that the display is not beein updated and then copy pixel for pixel from the frame buffer to the LCD driver.

Solution 2: Wait for the Tearing-PIN to show that the display is not beeing updated and then send out all the drawing commands. This would save me the framebuffer in the local ram.

Two questions:

  1. How do I know if my data transmission (either frambuffer copy or individual drawing commands) can be completed before the next frame is drawn by the lcd?
  2. What would be the best way to implement the synchronization to the Tearing-PIN (e.g. do something after you see a rising/falling edge on this pin)?

Best regards!

1 REPLY 1

> How do I know if my data transmission (either frambuffer copy or individual drawing commands) can be completed before the next frame is drawn by the lcd?

Benchmark (i.e. test). This is entirely your program, nobody can tell this for you.

> What would be the best way to implement the synchronization to the Tearing-PIN (e.g. do something after you see a rising/falling edge on this pin)?

Again, this is your program. The simplest way is

while(1) {
  while(tearing_pin_is_not_set) {};
  draw_everything();
}

JW