Skip to content
Subscribe Free
Sunday, Vol. VII · Issue 31 Today's Weather in Publishing: Clear skies, with a chance of long reads.
Essay

How to use a 2.8 inch capacitive TFT display module with LVDS?

Using a 2.8 inch capacitive TFT display module with LVDS (Low-Voltage Differential Signaling) might sound like a mismatch at first glance, because most 2.8-inch TFTs in the market, especially those with capacitive touch, rely on parallel RGB or SPI interfaces. But here’s the reality: some advanced modules, particularly those designed for embedded systems with higher resolution requirements or longer cable runs, do incorporate LVDS to reduce noise and improve signal integrity. The key is to ensure your specific module actually supports LVDS—many 2.8-inch capacitive TFT displays, like the 2.8 inch capacitive tft display module from DisplayModule, use SPI or I2C, not LVDS. But if you have a genuine LVDS variant, here’s how to get it up and running: you need to connect the LVDS differential pairs (typically 4 data lanes plus a clock lane) to your host controller’s LVDS transmitter, configure the display’s timing parameters via its internal registers (often through an I2C or SPI backchannel), and supply the correct power rails (3.3V for logic, and a separate backlight voltage around 3.0V to 3.3V for the LED strings). The capacitive touch controller, usually a separate chip like FT6236 or GT911, communicates over I2C, with its own interrupt pin. You’ll also need to set the correct display resolution in your software—240x320 pixels for most 2.8-inch panels—and ensure the pixel clock frequency matches the LVDS data rate, which is typically around 9 MHz to 12 MHz for this size. Let’s break down the specifics.

Understanding the LVDS Interface on a 2.8-Inch Capacitive TFT

LVDS is a serial interface standard that transmits data over twisted-pair differential signals, offering high noise immunity and lower electromagnetic interference compared to single-ended protocols like parallel RGB. On a 2.8-inch display, LVDS is uncommon because the resolution (240x320) is low enough for parallel RGB at 8-bit or 16-bit width without signal degradation over short distances. However, if your module uses LVDS, it’s likely because the manufacturer designed it for industrial applications where cables exceed 10 cm, or to simplify board layout by reducing the number of traces. The LVDS interface on a 2.8-inch panel typically uses 4 data lanes (each lane carries 7 bits of RGB data in a 28-bit format) plus a clock lane, resulting in a total of 10 pins for the LVDS portion. The data format is usually JEIDA or VESA standard, which determines how the 24-bit RGB color data is mapped across the lanes. For example, in VESA mapping, Lane 0 carries bits R0-R6, Lane 1 carries G0-G6, Lane 2 carries B0-B6, and Lane 3 carries R7, G7, B7, and sync signals. You’ll need to check your module’s datasheet for the exact pinout—some Chinese manufacturers use non-standard mappings, so don’t assume it’s JEIDA. The capacitive touch overlay adds another layer: the touch controller (e.g., FT6236) outputs I2C data at 400 kHz, with a 3.3V logic level. The touch panel’s resolution is typically 240x320, matching the display, but the touch coordinates are reported in a 12-bit format, so you’ll need to scale them in firmware.

Hardware Connections: Power, LVDS, and Touch

Start with the power supply. A 2.8-inch LVDS TFT module usually requires two separate voltages: VDD for the logic (2.8V to 3.3V, typical 3.3V) and VLED for the backlight (3.0V to 3.3V, with a current limit of 20 mA per LED string, usually 4 LEDs in series). The total backlight power is around 80 mW (3.3V * 20 mA * 4 strings, but many modules use a single string with 4 LEDs in series, so 3.3V * 20 mA = 66 mW). The logic power draw is about 15 mA at 3.3V, so total power is under 100 mW. For the LVDS interface, connect the differential pairs: CLK+ and CLK- for the clock, and D0+ through D3+ along with their complements. The termination resistors are usually built into the display’s receiver, but if not, you’ll need 100-ohm resistors across each differential pair at the receiver side. The transmitter side on your host (e.g., an STM32MP1 or i.MX6ULL with an LVDS transmitter like the SN65LVDS93) outputs these signals. The capacitive touch controller uses I2C: SDA and SCL lines, with pull-up resistors to 3.3V (typically 4.7 kΩ). The INT pin from the touch controller goes to a GPIO on your microcontroller for interrupt-driven touch detection. The RST pin for the touch controller is often tied to the same reset line as the display, but check the datasheet—some modules require a separate reset sequence. Here’s a typical pinout table for a 2.8-inch LVDS capacitive TFT module (check your specific module’s datasheet, as pin assignments vary):

Pin Number Signal Name Description Voltage Level
1 VDD Logic power supply 3.3V
2 GND Ground 0V
3 CLK+ LVDS clock positive 1.2V common mode
4 CLK- LVDS clock negative 1.2V common mode
5 D0+ LVDS data lane 0 positive 1.2V common mode
6 D0- LVDS data lane 0 negative 1.2V common mode
7 D1+ LVDS data lane 1 positive 1.2V common mode
8 D1- LVDS data lane 1 negative 1.2V common mode
9 D2+ LVDS data lane 2 positive 1.2V common mode
10 D2- LVDS data lane 2 negative 1.2V common mode
11 D3+ LVDS data lane 3 positive 1.2V common mode
12 D3- LVDS data lane 3 negative 1.2V common mode
13 VLED+ Backlight anode 3.0-3.3V
14 VLED- Backlight cathode GND
15 SDA Touch I2C data 3.3V (open-drain)
16 SCL Touch I2C clock 3.3V (open-drain)
17 INT Touch interrupt output 3.3V
18 RST Touch reset (active low) 3.3V

This table assumes a 18-pin FPC connector, which is common for 2.8-inch modules. If your module uses a different pin count, adjust accordingly. The LVDS signals require careful PCB layout: keep the differential pairs closely coupled (2-3 mil spacing) and match the trace lengths to within 5 mm to avoid skew. The common-mode voltage of LVDS is around 1.2V, so your host transmitter must be compatible—most LVDS transmitters like the DS90C383 or SN65LVDS93 work with 3.3V supplies and produce the correct swing.

Configuring the Display Timing and Initialization

Even though the display uses LVDS, the internal timing controller (often a HX8257 or similar) still needs to be configured via a separate SPI or I2C interface. Most 2.8-inch LVDS modules have a dedicated configuration bus—check the datasheet for the initialization sequence. For a typical 240x320 panel, the horizontal timing parameters are: horizontal back porch (HBP) of 8 pixels, horizontal front porch (HFP) of 8 pixels, horizontal sync pulse width (HSPW) of 4 pixels, and a total horizontal period of 260 pixels (240 + 8 + 8 + 4). Vertical timing: vertical back porch (VBP) of 2 lines, vertical front porch (VFP) of 4 lines, vertical sync pulse width (VSPW) of 2 lines, and total vertical period of 328 lines (320 + 2 + 4 + 2). The pixel clock frequency is calculated as: (total horizontal pixels * total vertical lines * refresh rate) / 1e6. For a 60 Hz refresh, that’s (260 * 328 * 60) / 1e6 = 5.12 MHz, but many LVDS modules require a higher clock due to the serialization overhead. In LVDS, each lane transmits 7 bits per clock cycle, so for 24-bit RGB data, you need 4 lanes (28 bits total, with 4 bits unused). The effective pixel clock is the same as the LVDS clock, so you’ll set the LVDS transmitter to output a 5.12 MHz clock. However, some modules expect a higher clock because they use a different mapping—check the datasheet for the exact pixel clock range, which is often 6-12 MHz. If you’re using a microcontroller like the STM32F4 with an LTDC peripheral, you can generate the LVDS signals via a parallel RGB to LVDS converter chip. Alternatively, a dedicated LVDS transmitter like the TI SN65LVDS93 takes a 28-bit parallel input (24-bit RGB plus 4 control bits) and serializes it. The control bits are HSYNC, VSYNC, DE (data enable), and a reserved bit. The DE signal must be high only during active pixel data, which is 240 pixels per line and 320 lines per frame. You’ll need to generate these signals in your microcontroller’s timing controller or use a display controller like the RA8876 that outputs LVDS directly. For the capacitive touch, initialize the FT6236 controller by sending a software reset command (0x00) via I2C, then read the touch points from registers 0x02 to 0x06. The touch data is reported as a 12-bit value for X and Y, but you’ll need to scale it to 240x320 by dividing by 4096 and multiplying by the display dimensions. For example, if X_raw = 2048, then X = (2048 * 240) / 4096 = 120 pixels. The touch controller supports up to 5 simultaneous touches, but most 2.8-inch panels only report 1 or 2 points.

Software Integration and Driver Development

Writing a driver for an LVDS-based 2.8-inch capacitive TFT involves three layers: the LVDS transmitter initialization, the display timing configuration, and the touch input handling. On a Linux system, you’d use the DRM (Direct Rendering Manager) subsystem with a panel driver that specifies the timing parameters. For example, in the device tree, you’d define the panel as a simple-panel with the LVDS interface, setting the timing as hactive = 240, vactive = 320, hback-porch = 8, hfront-porch = 8, hsync-len = 4, vback-porch = 2, vfront-porch = 4, vsync-len = 2, clock-frequency = 5120000. The LVDS transmitter driver (e.g., sn65lvds93) would be configured to enable the output and set the data mapping to VESA or JEIDA based on your panel. For the capacitive touch, you’d use an I2C input device driver like the ft6236 driver, which registers as a touchscreen and reports events via the input subsystem. On a bare-metal microcontroller like the ESP32, you’d need to manually generate the LVDS signals using a parallel interface and an external LVDS transmitter chip. The ESP32’s LCD_CAM peripheral can output parallel RGB data at up to 40 MHz, which you can feed into the SN65LVDS93. The timing is set via the LCD_CAM registers: set the horizontal and vertical pulse widths, back porch, and front porch. The pixel clock is generated by the LCD_CAM’s PLL, which you can configure to output 5.12 MHz. For the touch, use the ESP32’s I2C master to poll the FT6236 at 100 Hz, or use the interrupt pin to trigger a read. The touch data is processed in the main loop, and you’ll need to implement a calibration routine—most capacitive touch panels come pre-calibrated, but you can fine-tune by reading the raw values and adjusting the scaling factor. Here’s a code snippet for initializing the LVDS transmitter on an STM32H7 using the LTDC and an external SN65LVDS93:

// Assume LTDC is configured for 240x320 RGB565 (16-bit, but we'll pad to 24-bit)
// SN65LVDS93 mapping: 24-bit RGB + 4 control bits
// Set LTDC timing: HBP=8, HFP=8, HSYNC=4, VBP=2, VFP=4, VSYNC=2
// Pixel clock = 5.12 MHz
// Enable LVDS transmitter via GPIO
HAL_GPIO_WritePin(LVDS_EN_GPIO_Port, LVDS_EN_Pin, GPIO_PIN_SET);
// Configure LTDC
LTDC_HandleTypeDef hltdc;
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 = 4;
hltdc.Init.VerticalSync = 2;
hltdc.Init.AccumulatedHBP = 8;
hltdc.Init.AccumulatedVBP = 2;
hltdc.Init.AccumulatedActiveW = 248; // 240 + 8
hltdc.Init.AccumulatedActiveH = 322; // 320 + 2
hltdc.Init.TotalWidth = 260;
hltdc.Init.TotalHeigh = 328;
hltdc.Init.Backcolor.Blue = 0;
hltdc.Init.Backcolor.Green = 0;
hltdc.Init.Backcolor.Red = 0;
HAL_LTDC_Init(&hltdc);
// After initialization, the LVDS transmitter outputs the serialized data

This code assumes the SN65LVDS93 is already powered and its control pins are set. The key is that the LTDC’s parallel RGB output must match the input format of the LVDS transmitter. Most transmitters expect 24-bit RGB (8 bits per channel) plus DE, HSYNC, VSYNC, and a reserved bit. If your LTDC is set to 16-bit RGB565, you’ll need to convert to 24-bit by duplicating the MSBs, or use a 24-bit mode. The capacitive touch initialization is simpler: send a reset pulse (low for 10 ms), then read the touch controller’s ID register (0x00) to confirm it’s responding. The FT6236 returns 0x11 for version 1. Then set the interrupt mode to polling or edge-triggered. The touch data is

admin

Contributor at Earshot Online. Writes on culture, technology, and the future of work.

More from admin →