SPI

Getting Started ›› Hardware ›› TFT Interfaces ››
Parent Previous Next

SPI (Serial Peripheral Interface)



There are two SPI interface options available for connecting a TFT module: software SPI and hardware SPI. Software SPI uses bit-banging implemented in software, while hardware SPI uses the microcontroller’s dedicated SPI peripheral. Although some modern PIC microcontrollers provide multiple SPI modules, TFT Graphic Library uses only SPI1 or SPI2 when operating in hardware SPI mode.


Some TFT displays use a single bidirectional data line in SPI mode. This behavior is fully supported by the library. When such a display is used and hardware SPI mode is selected, the library transmits data using hardware SPI. When data must be read from the display, the data pin is temporarily reconfigured as an input and the read operation is performed in software SPI mode. After the read completes, the library automatically switches back to hardware SPI output to maintain optimal data transfer speed.


Recommended Design: Whether using Software or Hardware SPI, dedicate the SPI lines to the TFT display whenever possible. Sharing SPI lines with external memory or an SD card significantly reduces the transfer rate between the memory/SD card and the TFT module.


SPI Interface Signal Lines:

    • CS - Output - TFT chip select.
    • RESET - Output - Hardware reset for the display controller.
    • RS/DC - Output - Data/command select, indicating the type of data being transmitted.
    • SDO/MISO - Input - SPI data input for the graphics controller or touch controller.(Note1)
    • SDI/MOSI - Output - SPI data output for the graphics controller or touch controller.(Note1)
    • CLK - Output - SPI clock for the graphics controller or touch controller.

(1) Note: Some displays support TFT GRAM pixel readback only via a single data line. Although a MISO pin may be present, it is often not internally connected. In such cases, GRAM readback must be performed in single-line (bidirectional) mode using the MOSI pin. Configure the MISO pin to the same physical pin as MOSI.

 





Additional Power and Control Lines (Non-SPI):

    • VCC - Power - Connect to a 3.7–5 V supply if the display includes an onboard 3.3 V LDO or regulator; otherwise, connect directly to a 3.3 V supply. Some modules include a bypass resistor allowing direct connection to the PCB VCC. Because TFT displays may draw significant current, using the onboard regulator is recommended when available.
    • GND - Power - Ground connection.
    • LED - Power - Backlight LED supply. A current-limiting resistor may be required.

Created with the Personal Edition of HelpNDoc: Create iPhone web-based documentation