Surenoo SAM0400A-320480 Series TFT LCD Module for Arduino Mega2560 User Manual
Surenoo SAM0400A-320480 Series TFT LCD Module for Arduino Mega2560

Bushiness
QR Code

WhatsAPP
QR Code
QR Code
QR Code

WeChat
QR Code

Product Description

The product is a 3.95-inch TFT LCD module with 480×320 resolution, 16BIT RGB 65K color display, internal drive IC ST7796S,ST7796S,  8-bit and 16-bit parallel port communication and 8-bit parallel port communication. The module includes LCD display, resistive touch screen, SD card slot and PCB backplane. It supports SD card expansion and can be directly plugged into the Arduino MEGA2560 development board. It can also be used on C51 and STM32 platforms

Product Features

  • 3.95-inch color screen, support 16BIT RGB 65K color display, display rich colors
  • 480×320 resolution for clear display
  • ILI9488: Supports 8-bit parallel bus transmission with fast transfer speed ST7796S: Supports 8-bit and 16-bit parallel bus transmission with fast transfer speed
  • On-board 5V/3.3V level-shifting IC compatible with 5V/3.3V operating voltage
  • Support Arduino Mage2560 for direct plug-in use
  • Support for touch function
  • Support SD card function extension
  • Provide Arduino libraries and rich sample programs
  • Available on C51 and STM32 platforms with 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 MAR3953
Screen Size 3.95(inch)
Type TFT

 

Driver IC ILI9488 / ST7796S
Resolution 480*320 (Pixel)
Module Interface ILI9488: 8Bit parallel interface ST7796S: 8Bit or 16Bit parallel interface
Active Area 83.52×55.68(mm)
Module PCB Size 61.54×105.69 (mm)
Back Light 6 chip HighLight white LEDs
Operating Temperature -10℃~60℃
Storage Temperature -20℃~70℃
Operating Voltage 3.3V / 5V
Power Consumption TBD
Product Weight TBD
Driver IC ILI9488 / ST7796S
Resolution 480*320 (Pixel)
Module Interface ILI9488: 8Bit parallel interface ST7796S: 8Bit or 16Bit parallel interface
Active Area 83.52×55.68(mm)
Module PCB Size 61.54×105.69 (mm)
Back Light 6 chip HighLight white LEDs
Operating Temperature -10℃~60℃
Storage Temperature -20℃~70℃
Operating Voltage 3.3V / 5V
Power Consumption TBD
Product Weight TBD
Driver IC ILI9488 / ST7796S
Resolution 480*320 (Pixel)
Module Interface ILI9488: 8Bit parallel interface ST7796S: 8Bit or 16Bit parallel interface
Active Area 83.52×55.68(mm)
Module PCB Size 61.54×105.69 (mm)
Back Light 6 chip HighLight white LEDs
Operating Temperature -10℃~60℃
Storage Temperature -20℃~70℃
Operating Voltage 3.3V / 5V
Power Consumption TBD
Product Weight TBD

Interface Description

Interface Description

Picture1. Module Pin silkscreen picture 

Note

  1. The module hardware supports 8-bit and 16-bit parallel port data bus mode switching (as shown by the blue box in Picture 1 above), as follows

A. Solder R5 with 0Ω resistor or short circuit directly, and disconnect R4: select 16-bit data bus mode (default), use DB0~DB15 data pin
B. Solder R4 with 0Ω resistor or short circuit directly, and disconnect R5: select 8-bit data bus mode, use DB0~DB7 data pin

Important Note: 

  1. The following pin numbers 1~30 refer to the module pin number of our company with PCB backplane. If you purchase a bare screen, please refer to the pin definition of the bare screen specification, refer to the wiring according to the signal type instead of directly Wire according to the following module pin numbers. For example: LCD_CS is 20 feet on our module, which may be x feet on different sizes of bare screen.
  2. About VCC supply voltage: If you purchase a module with PCB backplane, VCC/VDD power supply needs to be connected to 5V (module has integrated ultra low dropout 5V to 3.3V circuit), if you buy a bare screen LCD screen, remember to only connect 3.3V.
  3. About backlight voltage: Modules with PCB backplane are connected to 3.3V, no need to manually access. If you are buying a bare screen, the LEDA is connected to 3.0V-3.3V, and the LEDKx can be grounded.
Number Module Pin Pin Description
1 5V Power pin
2 DB0      Data bus low 8-bit pin
3 DB1
4 DB2
5 DB3
6 DB4
7 DB5
8 DB6
9 DB7
10 DB8 Data bus high 8-bit pin If 8-bit mode, no connet
11 DB9
12 DB10
13 DB11
14 DB12
15 DB13
16 DB14
17 DB15
18 LCD_RS LCD register / data selection pin
19 LCD_WR LCD write control pin
20 LCD_CS LCD chip select control pin
21 LCD_RST LCD reset control pin
22 LCD_RD LCD read control pin
23 NC Undefined, reserved
24 TP_IRQ Touch screen interrupt control pin
25 SD_CS Extended reference: SD card select pin
26 MISO SPI bus input pin
27 MOSI SPI bus output pin
28 EX_CLK SPI bus clock pin
29 TP_CS Touch screen chip select pin
30 GND Power ground pin

Hardware Configuration

The LCD module hardware circuit comprises five parts: an LCD display control circuit, a level shift circuit, an SD card control circuit, a touch screen control circuit, and an 8-bit and 16-bit data bus mode switching circuit.

LCD display control circuit for controlling the pins of the LCD, including control pins and data transfer pins.

Level shifting circuit for 5V/3.3V conversion, making the module compatible with

3.3V/5V power supply. 

SD card control circuit is used for SD card function expansion, controlling SD card identification, reading and writing.

The touch screen control circuit is used to control touch screen interrupt acquisition, data sampling, AD conversion, data transmission, and the like.

The 8-bit and 16-bit data bus mode switching circuits are used to switch the data bus type (8-bit mode and 16-bit mode). For details, see the red box in Picture 1 above or refer to the module circuit schematic.

working principle

Introduction to ST7796S ILI9488 Controller

The ST7796S ILI9488 is a single-chip controller for 262 K color TFT-LCDs. It supports a maximum resolution of 320*480 and has a GRAM of 345600 bytes. 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 the supported resolution is relatively large and the amount of data transmitted is large, the parallel port transmission is adopted, and the transmission speed  is fast. also supports 65K, 262K, 16M RGB color display, display color is very n rich, while supporting rotating display and scroll display and video playback, display in a variety of ways.

The ST7796S ILI9488 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 ST7796S ILI9488 display method is performed by setting the address and hen setting the color value.

Introduction to parallel port communication

The parallel port communication write mode timing is as shown
Introduction

Figure 1: OBI Type B Write Cycle

Note: WAX is an unsynchronded signal that can be temunated when not being used

When the D:CX signal is driven 10 low level. the input data on the interlace is interpreted as command information. The DC% signal can also be pulled to high level when Me dela is RAM data or command parameter
Introduction

CSX is a chip select signal for enabling and disabling parallel port communication, active low RESX is an external reset signal, active low D/CX is the data or command selection signal, 1-write data or command parameters, 0-write command WRX is a write data control signal D[X:0] is a parallel port data bit, which has four types: 8-bit, 9-bit, 16-bit, and 18 bit.

When performing a write operation, on the basis of the reset, first set the data or command selection signal, then pull the chip select signal low, then input the content to be written from the host, and then pull the write data control signal low. When pulled high, data is written to the LCD control IC on the rising edge of the write control signal. Finally, the chip select signal is pulled high and a data write operation is completed.

Instructions for use

Arduino instructions

Wiring instructions:
See the interface description for pin assignments. This module can be directly inserted into the Arduino UNO and Mega2560, no need to manually wire, as shown below:
Wiring instructions

Mega2560 directly inserted picture 

Direct insertion instructions for Arduino MEGA2560 microcontroller test program pins
 Number   Module Pin Corresponding to MEGA2560 developmentboard direct plug pins
8-bit mode 16-bit mode
1 5V 5V
2 DB0 37
3 DB1 36
4 DB2 35
5 DB3 34
6 DB4 33
7 DB5 32
8 DB6 31
9 DB7 30
10 DB8       not used 22
11 DB9 23
12 DB10 24
13 DB11 25
14 DB12 26
15 DB13 27
16 DB14 28
17 DB15 29
18 LCD_RS 38
19 LCD_WR 39
20 LCD_CS 40
21 LCD_RST 41
22 LCD_RD 43
23 NC not used
24 TP_IRQ 44
25 SD_CS 48
26 MISO 50
27 MOSI 51
28 TP_CS 53
29 EX_CLK 52
30 GND GND

Operating Steps: 

A. Insert the LCD module directly into the Arduino MCU according to the above wiring instructions, and power on;
B. 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);
C. 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)
Operating Steps

D. 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

E. If the LCD module displays characters and graphics normally, the program runs Successfully;

C51 instructions

Wiring instructions:
See the interface description for pin assignments

STC89C52RC microcontroller test program wiring instructions
Number Module Pin Corresponding to STC89 development board wiring pin
8-bit mode 16-bit mode
1 5V 5V
2 DB0 P30
3 DB1 P31
4 DB2 P32
5 DB3 P33
6 DB4 P34
7 DB5 P35
8 DB6 P36
9 DB7 P37
10 DB8

no need to connect

P20
11 DB9 P21
12 DB10 P22
13 DB11 P23
14 DB12 P24
15 DB13 P25
16 DB14 P26
17 DB15 P27
18 LCD_RS P12
19 LCD_WR P11
20 LCD_CS P13
21 LCD_RST P14
22 LCD_RD P10
23 NC no need to connect
24 TP_IRQ no need to connect (cannot test touch)
25 SD_CS no need to connect
26 MISO no need to connect (cannot test touch)
27 MOSI no need to connect (cannot test touch)
28 TP_CS no need to connect (cannot test touch)
29 EX_CLK no need to connect (cannot test touch)
30 GND GND

 

STC12C5A60S2 microcontroller test program wiring instructions
Number Module Pin Corresponding to STC12 development board wiring pin
8-bit mode 16-bit mode
1 5V 5V
2 DB0 P00
3 DB1 P01
4 DB2 P02
5 DB3 P03
6 DB4 P04
7 DB5 P05
8 DB6 P06
9 DB7 P07
10 DB8

no need to connect

P20
11 DB9 P21
12 DB10 P22
13 DB11 P23
14 DB12 P24
15 DB13 P25
16 DB14 P26
17 DB15 P27
18 LCD_RS P12
19 LCD_WR P11
20 LCD_CS P13
21 LCD_RST P33
22 LCD_RD P10
23 NC no need to connect
24 TP_IRQ P40
25 SD_CS no need to connect
26 MISO P35
27 MOSI P34
28 TP_CS P37
29 EX_CLK P36
30 GND GND

Operating Steps:

A. Connect the LCD module and the C51 MCU according to the above wiring
instructions, and power on;
B. Open the directory where the C51 test program is located and select the example to be tested, as shown below:

(Please refer to the test program description document for test program description)
Operating Steps

C. Open the selected test program project, compile and download; 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%26stcisp_Use_Illustration_EN.pdf

D. If the LCD module displays characters and graphics normally, the program runs successfully

STM32 instructions

See the interface description for pin assignments.

STM32F103RCT6 microcontroller test program wiring instructions
Number Module Pin Corresponding to MiniSTM32 development board wiring pin
8-bit mode 16-bit mode
1 5V 5V
2 DB0 PB0
3 DB1 PB1
4 DB2 PB2
5 DB3 PB3
6 DB4 PB4
7 DB5 PB5
8 DB6 PB6
9 DB7 PB7
10 DB8

no need to connect

PB8
11 DB9 PB9
12 DB10 PB10
13 DB11 PB11
14 DB12 PB12
15 DB13 PB13
16 DB14 PB14
17 DB15 PB15
18 LCD_RS PC8
19 LCD_WR PC7
20 LCD_CS PC9
21 LCD_RST PC10
22 LCD_RD PC6
23 NC no need to connect
24 TP_IRQ PC1
25 SD_CS no need to connect
26 MISO PC2
27 MOSI PC3
28 TP_CS PC13
29 EX_CLK PC0
30 GND GND

 

STM32F429IGT6STM32F767IGT6STM32H743IIT6 microcontroller test program wiring instructions
Number Module Pin Corresponding to Apollo STM32F4/F7 developmentboard wiring pin
8-bit mode 16-bit mode
1 5V 5V
2 DB0/NC PE0
3 DB1/NC PE1
4 DB2/NC PE2
5 DB3/NC PE3
6 DB4/NC PE4
7 DB5/NC PE5
8 DB6/NC PE6
9 DB7/NC PE7
10 DB8

no need to connect

PE8
11 DB9 PE9
12 DB10 PE10
13 DB11 PE11
14 DB12 PE12
15 DB13 PE13
16 DB14 PE14
17 DB15 PE15
18 LCD_RS PC8
19 LCD_WR PC7
20 LCD_CS PC9
21 LCD_RST PC10
22 LCD_RD PC6
23 NC no need to connect
24 TP_IRQ PH10
25 SD_CS no need to connect
26 MISO PH11
27 MOSI PH12
28 TP_CS PH13
29 EX_CLK PH9
30 GND GND

Operating Steps

A. Connect the LCD module and the STM32 MCU according to the above wiring
instructions, and power on;
B. Open the directory where the STM32 test program is located and select the example to be tested, as shown below: (Please refer to the test program description document for test program description)
Operating Steps

C. Open the selected test program project, compile and download; 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, theprogram runs successfully;

Software Description

Code Architecture 

A. Arduino code architecture description

The code architecture is shown below
Software Description

Arduino’s test program code consists of two parts: the LCDWIKI library and application code. The LCDWIKI library contains three parts: LCDWIKI_KBV library, LCDWIKI_GUI library, and LCDWIKI_TOUCH library. The application contains several test examples, each with different test content;

LCDWIKI_KBV 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, display mode configuration, etc;

LCDWIKI_GUI is the middle layer library, which is responsible for drawing graphics and displaying characters using the API provided by the underlying library;

LCDWIKI_TOUCH is the underlying library of touch screens, mainly responsible for touch interrupt detection, touch data sampling and AD conversion, and touch data transmission.

The application is to use the API provided by the LCDWIKI library to write some test examples and implement Some aspect of the test function;

C51 and STM32 code architecture description

The code architecture is shown below:
Software Description

The Demo API code for the main program runtime is included in the test code;

LCD initialization and related bin parallel port write data 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;

Touch screen related operations are included in the touch 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;

GPIO definition description 

A. Arduino test program GPIO definition description
The module is plugged into the Arduino Mage2560, so it is not allowed to modify the GPIO port definition.

B. C51 test program GPIO definition description
The C51 test program GPIO definition is placed in the lcd.h file as shown below(Take the STC12C5A60S2 microcontroller test program as an example):
Software Description

Parallel pin definition needs to select the whole set of GPIO port groups, such as P0, P2, etc., so that when transferring data, the operation is convenient. Other pins can be defined as any free GPIO.

The touch screen GPIO port definition is placed in touch.h, as shown below (only 12C5A60S2 can test touch)
Software Description

The GPIO definition of the touch screen can be modified and can be defined as any other free GPIO.

If the microcontroller does not have a P4 GPIO group, you can define penirq as another GPIO.

STM32 test program GPIO definition description 

STM32 IO simulation test program lcd screen GPIO definition is placed in thelcd. file, as shown below (take STM32F103RCT6 test program as an example
Software Description

Data parallel port pin definition needs to select a complete set of GPIO port groups, such as PB, when transferring data, it is convenient to operate.

Other pins can be defined as any free GPIO.

The touch screen GPIO port is defined in the touch.h file as shown below (take the

(STM32F103RCT6 test program as an example)
Software Description

If you use the IO simulation test program, you can modify the values in the parentheses. All pin definitions can be modified and can be defined as any other free GPIO.

Parallel port communication code implementation

A. Arduino test program parallel port communication code implementation

If the 8-bit mode related code is used in the mcu_8bit_magic.h file of the LCDWIKI_KBV library, as shown below:
Software Description

If the 16-bit mode related code is used in the mcu_16bit_magic.h file of the

LCDWIKI_KBV library, as shown below:
Software Description

B. C51 test program parallel port communication code implementation

The relevant code is implemented in the LCD.c file as shown below:
Software Description

Implemented 8-bit and 16-bit commands and 8-bit and 16-bit data write and read

C. STM32 test program parallel port communication code implementation

The STM32 test program parallel port communication code is implemented in the

LCD. file.The IO simulation test program is implemented as shown below:
Software Description

Both 8 and 16-bit commands and 8, 16-bit data transfers are implemented.

4. touch screen calibration instructions

A. Arduino test program touch screen calibration instructions
Arduino touch screen calibration needs to run the touch_ screen_ calibration program first, and then calibrate according to the prompts. After the calibration is passed, the calibration parameters displayed on the screen need to be written into the cali_ para.h file of the LCDWIKI_TOUCH library, as shown below:
Calibration instructions

B. C51 test program touch screen calibration instructions
The C51 touch screen calibration needs to execute the Touch_ Adjust test item (only available in the STC12C5A60S2 test program), as shown below:
Calibration instructions

After the touch calibration is passed, you need to save the calibration parameters
displayed on the screen in the touch.c file, as shown below:
Calibration instructions

C. STM32 test program touch screen calibration instructions
The STM32 touch screen calibration program automatically recognizes whether calibration is required or manually enters calibration by pressing a button.

It is included in the touch screen test item. The calibration mark and calibration parameters are saved in the AT24C02 flash. If necessary, read from the flash. The calibration process is as shown below:
Calibration instructions

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 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:
Common software

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 SAM0400A-320480 Series TFT LCD Module for Arduino Mega2560 [pdf] User Manual
SAM0400A-320480, SAM0400A-320480 Series TFT LCD Module for Arduino Mega2560, TFT LCD Module for Arduino Mega2560, LCD Module for Arduino Mega2560, Module for Arduino Mega2560

References

Leave a comment

Your email address will not be published. Required fields are marked *