SPI - Hardware

Getting Started ›› Hardware ›› Protocol ››
Parent Previous Next

Hardware SPI Port


The Hardware SPI protocol (HW SPI) is slower than the parallel protocol but requires fewer pins and is still fast enough for most graphic applications.


Important Note! Although the TFT display can share an HW SPI port with other peripherals, using a shared port can reduce effective transfer rates significantly compared to a dedicated HW SPI port for the display. This difference occurs because there are two main ways to transfer pixel data to display chips:


Mode 1: An area of X * Y pixels on the screen is designated to be filled, and all required pixels (totaling X * Y) are sent sequentially as RGB color data only, without additional overhead. In this mode, data transfer cannot be interrupted, as keeping Chip Select (CS) low continuously means that any communication on the shared port will be interpreted as graphic data by the display IC. Therefore, this mode isn’t suitable for shared HW SPI ports.


Mode 2: Individual pixels are sent with both RGB color data and coordinate information, which requires additional commands for each pixel. Because each pixel’s position is specified, graphic data transfer can be paused and resumed, allowing the HW SPI port to be shared. However, this mode incurs significant data overhead and a speed penalty. To improve speed, a graphics buffer can be used, which is on my To-Do List.


Recommendation: For devices with multiple HW SPI ports, use a dedicated HW SPI port for the display, while other peripherals like the SD card or memory can use a second port or one with PPS (Peripheral Pin Select) pins.


Common Connections for TFT Displays with SPI Interfaces (from the MCU perspective):


VCC: Power - Connect to a 3.7–5V source if the display has a built-in 3.3V LDO/regulator; otherwise, connect to 3.3V VCC. Some displays include a bypass resistor to allow direct connection to the PCB VCC. Due to potentially high current draw, use the built-in regulator if available.

GND: Power - Ground connection.

CS: Output - TFT Chip Select.

RESET: Output - Hardware reset pin for the display IC.

RS/DC: Output - Data/Command control, indicating the type of data being sent.

MISO: Input - SPI communication input for the Graphic IC/Touch IC.

MOSI: Output - SPI communication output for the Graphic IC/Touch IC.

CLK: Output - SPI clock for the Graphic IC/Touch IC.

LED: Power - Back-light LED power; add a current-limiting resistor if needed.

T_CS: Output - Chip Select for the Touch IC. Not all TFT displays have touch support.

PEN/T_IRQ: Input - Interrupt request pin for the Touch IC.


Optional Connections (not all TFT displays have built-in SD Card slots):


SD_CS: Output - Chip Select for SD Card SPI communication. For maximum speed, use a second HW SPI port or Software SPI to avoid sharing pins with the Graphic IC.

SD_MISO: Input - SPI input for the SD Card IC. For maximum speed, use a second HW SPI port or Software SPI with separate pins.

SD_MOSI: Output - SPI output for the SD Card IC. For maximum speed, use a second HW SPI port or Software SPI with separate pins.

SD_CLK: Output - SPI clock for the SD Card. For maximum speed, use a second HW SPI port or Software SPI with separate pins.



TYPICAL 8b or 16b CONNECTION

BUILT-IN REGULATOR BYPASS RESISTOR





Created with the Personal Edition of HelpNDoc: Free Web Help generator