Surenoo SSP0220AA3-240320 SPI TFT LCD Module User Manual

June 10, 2024
Surenoo

Surenoo SSP0220AA3-240320 SPI TFT LCD Module

Surenoo-SSP0220AA3-240320-SPI-TFT-LCD-Module-product

Product Description

The LCD module uses a 4-wire SPI communication method with a driver IC of ILI9341 and a resolution of 240×320. The module contains an LCD display and backlight control circuitry.

Product Features

  • 2.2-inch color screen, supports 16-bit 65K color display, display rich colors
  • 240X320 resolution, clear display
  • Using the SPI serial bus, it only takes a few IOs to illuminate the display
  • Easy to expand the experiment with an SD card slot
  • Provide a rich sample program
  • Military-grade process standards, long-term stable work
  • Provide underlying driver technical support

Product Parameters

Name Description
Display Color RGB 65K color
SKU MSP2202
Screen Size 2.2(inch)
Type TFT
Driver IC ILI9341
Resolution 320*240 (Pixel)
Module Interface 4-wire SPI interface
Active Area 33.84×45.12 (mm)
Module PCB Size 40.10×67.20 (mm)
Angle of view >60°
Operating Temperature -20℃~70℃
Storage Temperature -30℃~80℃
--- ---
Operating Voltage 3.3V / 5V
Power Consumption About 90mA
Product Weight About 25(g)

Interface Description

Pin silkscreen picture

Number Module Pin Pin Description
1 VCC LCD power supply is positive (3.3V~5V)
2 GND LCD Power ground
3 CS LCD selection control signal
4 RESET LCD reset control signal
5 DC/RS LCD register / data selection control signal
6 SDI/MOSI LCD SPI bus write data signal
7 SCK LCD SPI bus clock signal
8 LED LCD backlight control signal (high level lighting,

if you do not need control, please connect 3.3V)

9| SDO/MISO| LCD SPI bus read data signal (can not be

connected if not needed)

Hardware Configuration
  • The LCD module hardware circuit comprises two parts: an LCD display control circuit  and a backlight control circuit.
  • The LCD display control circuit is used to control the pins of the LCD, including control pins and data transfer pins.
  • The backlight control circuit is used to control the backlight to be on and off. Of course, if the backlight is not required to be controlled, the backlight control pin can be directly connected to the 3.3V power supply without using the circuit.
working principle

Introduction to ILI9341 Controller

  • The ILI9341 controller supports a maximum resolution of 240*320 and a 172800-byte GRAM. It also supports 8-bit, 9-bit, 16-bit, and 18-bit parallel port data buses. It also supports 3-wire and 4-wire SPI serial ports. Since parallel control requires a large number of IO ports, the most common one is SPI serial port control. The ILI9341 also supports 65K, 262K RGB color display, display color is very rich, while supporting rotating display and scroll display and video playback, display in a variety of ways.
  • The ILI9341 controller uses 16bit (RGB565) to control a pixel display, so it can display up to 65K colors per pixel. The pixel address setting is performed in the order of rows and columns, and the incrementing and decreasing direction is determined by the scanning mode. The ILI9341 display method is performed by setting the address and then setting the color value.

Introduction to SPI communication protocol

  • The 4-wire SPI bus write mode timing is shown in the following figure:Surenoo-SSP0220AA3-240320-SPI-TFT-LCD-Module-fig-2
  • CSX is a slave chip select, and the chip is enabled only when CSX is low.
  • D/CX is the data/command control pin of the chip. When DCX is low, the command is written.
  • When it is high, the data is written.
  • SCL is the SPI bus clock, and each rising edge transmits 1 bit of data;
  • SDA is the data transmitted by SPI, and it transmits 8-bit data at a time.
  • The data format is as shown below:Surenoo-SSP0220AA3-240320-SPI-TFT-LCD-Module-fig-3
  • The high position is in front and transmitted first.
  • For SPI communication, the data has a transmission timing, that is, a combination of clock phase (CPHA) and clock polarity (CPOL):
  • The CPOL level determines the idle state level of the serial synchronous clock, CPOL = 0, which is low. CPOL does not have a lot of impact on the transport protocol;
  • The level of CPHA determines whether the serial synchronous clock is acquired on the first clock transition edge or the second clock transition edge.
  • When CPHL = 0, data acquisition is performed on the first edge of the transition;
  • The combination of the two becomes the four SPI communication methods. SPI0 is usually used in China, that is, CPHL = 0, CPOL = 0.

Instructions for use

Arduino instructions

Wiring instructions:

Arduino UNO microcontroller test program wiring

Number| ****

Module Pin

| Corresponding to UNO development

board wiring pins

1| SDO/MISO| 12
2| LED| A0
3| SCK| 13
4| SDI/MOSI| 11
5| DC/RS| A3
6| RESET| A4
7| CS| A5
8| GND| GND
9| VCC| 5V/3.3V
Arduino MEGA2560 microcontroller test program wiring

Number| ****

Module Pin

| Corresponding to MEGA2560

development board wiring pins

1| SDO/MISO| 50
2| LED| A0
3| SCK| 52
4| SDI/MOSI| 51
5| DC/RS| A3
6| RESET| A4
7| CS| A5
8| GND| GND
9| VCC| 5V/3.3V

Operating Steps

  • A. First refer to the method of running the SPI module on the Arduino. The specific method is as follows:

  • http://www.lcdwiki.com/Run_Arduino_Demo_in_spi_model

  • B. Connect the LCD module and the Arduino MCU according to the above wiring instructions, and power on;

  • C. Copy the dependent libraries in the Install libraries directory of the test package to the libraries folder of the Arduino project directory (if you do not need to depend on the libraries, you do not need to copy them);

  • D. Open the directory where the Arduino test program is located and select the example you want to test, as shown below:
    (Please refer to the test program description document in the test package for the test program description)Surenoo-SSP0220AA3-240320-SPI-TFT-LCD-Module-
fig-4

  • E. Open the selected sample project, compile and download.

  • The specific operation methods for the Arduino test program relying on library copy, compile and download are as follows:

  • http://www.lcdwiki.com/res/PublicFile/Arduino_IDE_Use_Illustration_EN.pdf

  • F. If the LCD module displays characters and graphics normally, the program runs successfully;

C51 instructions

Wiring instructions:

STC89C52RC and STC12C5A60S2 microcontroller test program wiring instructions

Number| ****

Module Pin

| Corresponding to STC89/STC12

development board wiring pin

1| VCC| 5V/3.3V
2| GND| GND
3| CS| P13
4| RESET| P33
5| DC/RS| P12
6| SDI/MOSI| P15
7| SCK| P17
8| LED| P32
9| SDO/MISO| P16

Operating Steps

  • A. Connect the LCD module and the C51 MCU according to the above wiring instructions, and power on;
  • B. Select the C51 test program to be tested, as shown below: (Please refer to the test program description document in the test package for the test program description)Surenoo-SSP0220AA3-240320-SPI-TFT-LCD-Module-fig-5
  • C. Open the selected test program project, compile, and download; a detailed description of the C51 test program compilation and download can be found in the following document: http://www.lcdwiki.com/res/PublicFile/C51_Keil%26stc-isp_Use_Illustration_EN.pdf
  • D. If the LCD module displays characters and graphics normally, the program runs successfully

STM32 instructions

Wiring instructions:

Because the pin positions of different development boards are different, and the external pins are reserved differently (some development boards do not have externally required pins). In order to facilitate wiring, the wiring pins of each development board are inconsistent.

STM32F103RCT6 microcontroller test program wiring instructions

Number|

Module Pin

| Corresponding to MiniSTM32

development board wiring pin

1| VCC| 5V/3.3V
2| GND| GND
3| CS| PB11
4| RESET| PB12
5| DC/RS| PB10
6| SDI/MOSI| PB15
7| SCK| PB13
8| LED| PB9
9| SDO/MISO| PB14
STM32F103ZET6 microcontroller test program wiring instructions

Number|

Module Pin

| Corresponding to Elite STM32

development board wiring pin

1| VCC| 5V/3.3V
2| GND| GND
---|---|---
3| CS| PB11
4| RESET| PB12
5| DC/RS| PB10
6| SDI/MOSI| PB15
7| SCK| PB13
8| LED| PB9
9| SDO/MISO| PB14
STM32F407ZGT6 microcontroller test program wiring instructions

Number|

Module Pin

| Corresponding to Explorer STM32F4

development board wiring pin

1| VCC| 5V/3.3V
2| GND| GND
3| CS| PB15
4| RESET| PB12
5| DC/RS| PB14
6| SDI/MOSI| PB5
7| SCK| PB3
8| LED| PB13
9| SDO/MISO| PB4
STM32F429IGT6 microcontroller test program wiring instructions

Number|

Module Pin

| Corresponding to Apollo STM32F4/F7

development board wiring pin

1| VCC| 5V/3.3V
2| GND| GND
---|---|---
3| CS| PD11
4| RESET| PD12
5| DC/RS| PD5
6| SDI/MOSI| PF9
7| SCK| PF7
8| LED| PD6
9| SDO/MISO| PF8

Operating Steps

  • A. Connect the LCD module and the STM32 MCU according to the above wiring instructions, and power on;
  • B. Select the test example according to the model of the microcontroller, as shown in the following figure: (Please refer to the test program description document in the test package for the test program description)Surenoo-SSP0220AA3-240320-SPI-TFT-LCD-Module-fig-6
  • C. Open the selected test program project, compile, and download; a detailed description of the STM32 test program compilation and download can be found in the following document: http://www.lcdwiki.com/res/PublicFile/STM32_Keil_Use_Illustration_EN.pdf
  • D. If the LCD module displays characters and graphics normally, the program runs successfully

Software Description

  1. Code Architecture

    • A. Arduino code architecture description The code architecture is shown below:Surenoo-SSP0220AA3-240320-SPI-TFT-LCD-Module-fig-8
    • Arduino’s test program code consists of two parts: the LCDWIKI library and application code. The LCDWIKI library consists of two parts: the LCDWIKI_SPI library and the
    • LCDWIKI_GUI library. The application contains several test examples, each of which contains different test content. LCDWIKI_SPI is the underlying library, which is associated with hardware. It is mainly responsible for operating registers, including hardware module initialization, data and command transmission, pixel coordinates and color settings, and display mode configuration. LCDWIKI_GUI is a middle-tier library, which is responsible for drawing graphics and displaying characters using the API provided by the underlying library.
    • The application uses the API provided by the LCDWIKI library to write some test examples to implement some aspects of the test function.
    • B. C51 and STM32 code architecture description
    • The code architecture is shown below:Surenoo-SSP0220AA3-240320-SPI-TFT-LCD-Module-fig-8
    • The Demo API code of the main program runtime is included in the test code; LCD initialization and related operations are included in the LCD code; Drawing points, lines, graphics, and Chinese and English character display-related operations are included in the GUI code; The main function implements the application to run; Platform code varies by platform; SPI initialization and configuration related operations are included in the SPI code; The key processing related code is included in the key code (the C51 platform does not have a button processing code); The code related to the led configuration operation is included in the led code;
  2. software SPI and hardware SPI description

    • The LCD module provides software SPI and hardware SPI sample code (except STC89C52RC because it does not have hardware SPI function), the two sample code does not make any difference in the display content, but the following aspects are
      different:

    • A. display speed The hardware SPI is significantly faster than the software SPI, which is determined by the hardware.

    • B. GPIO definition

    • The software SPI all control pins must be defined, any idle pin can be used, the hardware SPI data and clock signal pins are fixed (depending on the platform), other control pins should be defined by themselves, or any idle reference can be used. foot.

    • C. initialization

    • When the software SPI is initialized, only the GPIO for pin definition needs to be initialized (not required by the C51 platform). When the hardware SPI is initialized, the relevant control registers and data registers need to be initialized.

  3. GPIO definition description

    • A. Arduino test program GPIO definition description
    • The GPIO definitions of the Arduino test program are placed separately in each application, This means that each application can flexibly define GPIOs as needed. As shown below:Surenoo-SSP0220AA3-240320-SPI-TFT-LCD-Module-fig-9
    • B. C51 test program GPIO definition description C51 test program GPIO definition is placed in the lcd.h file, as shown below:Surenoo-SSP0220AA3-240320-SPI-TFT-LCD-Module-fig-10
    • If the software SPI is used, all pin definitions can be modified and can be defined as any other free GPIO.  definitions can be modified and can be defined as any other free GPIO. LCD_CLK and LCD_SDI do not need to be defined.
    • C. STM32 test program GPIO definition description
    • The STM32’s LCD non-SPI GPIO definition is placed in lcd.h as shown below:Surenoo-SSP0220AA3-240320-SPI-TFT-LCD-Module-fig-11
    • If the software SPI is used, all pin definitions can be modified and can be defined as any other free GPIO.
    • If hardware SPI is used, these pins do not need to be defined. At the same time, the SCLK, MISO, and MOSI pins need to be initialized and removed in the LCD_GPIOInit function in the LCD. c file, as shown in the following figure: Surenoo-SSP0220AA3-240320-SPI-TFT-LCD-Module-fig-12
    • The contents of the red circle must be removed.
  4. SPI communication code implementation

    • A. Arduino test program SPI communication code implementationSurenoo-SSP0220AA3-240320-SPI-TFT-LCD-Module-fig-13
    • Hardware SPI communication is implemented by the system. We only need to operate the register and call the relevant function. For details, please refer to the  MCU related documentation.
    • The software SPI communication code is implemented in the LCDWIKI_SPI.cpp file of the LCDWIKI_SPI library, as shown below: Surenoo-SSP0220AA3-240320-SPI-TFT-LCD-Module-fig-14
    • If the transmitted data bit is 1, the SPI data pin is pulled high. When it is 0, the SPI data pin is pulled low, one byte of data is transferred each time, the upper bit is first, and one bit of data is transmitted on each rising edge of the clock.
    • B. C51 and STM32 test program SPI communication code implementation
    • Hardware SPI communication is implemented by the system. We only need to operate the register and call the relevant function. For details, please refer to the MCU-related documentation. The software SPI communication code is implemented in lcd.c and spi.c respectively, and the software SPI implementation method is the same, as shown in the following figure:
    • If the transmitted data bit is 1, the SPI data pin is pulled high. When it is 0, the SPI data pin is pulled low, one byte of data is transferred each time, the upper bit is
      first, and one bit of data is transmitted on each rising edge of the clock.

Common software

  • This set of test examples requires the display of Chinese and English, symbols and pictures, so the modulo software is used. There are two types of modulo software: Image2Lcd and PCtoLCD2002. Here is only the setting of the Modulo software for the test program.
  • The PCtoLCD2002 modulo software settings are as follows:
  • Dot matrix format select Dark to code the modulo mode select the progressive mode
  • Take the model to choose the direction (high position first)
  • Output number system selects hexadecimal number Custom format selection C51 format
  • The specific setting method is as follows: http://www.lcdwiki.com/Chinese_and_English_display_modulo_settings
  • Image2Lcd modulo software settings are shown below:Surenoo-SSP0220AA3-240320-SPI-TFT-LCD-Module-fig-16
  • The Image2Lcd software needs to be set to horizontal, left to right, top to bottom, and low position to the front scan mode.
  • www.surenoo.com

Documents / Resources

| Surenoo SSP0220AA3-240320 SPI TFT LCD Module [pdf] User Manual
SSP0220AA3-240320 SPI TFT LCD Module, SSP0220AA3-240320, SPI TFT LCD Module, TFT LCD Module, LCD Module
---|---

References

Read User Manual Online (PDF format)

Read User Manual Online (PDF format)  >>

Download This Manual (PDF format)

Download this manual  >>

Related Manuals