Application Note Fan4213
Application Note Fan4213
Application Note Fan4213
com
1 www.FocusLCDs.com
FAN4213
3 Wire SPI + Parallel RGB Interface
The 3-wire Serial Peripheral Interface (SPI) and the 16/18/24-bit RGB parallel interface are used in a
sequence to communicate data to the display. The SPI interface is first used to initialize the display
parameters through command registers. Once initialized, the display can receive data over the RGB
parallel interface at a higher speed. This data can be sent in segments of 16, 18 or 24-bit lengths
depending on what is specified by the SPI initialization commands.
The display used in this application note is a 3” TFT with 854x480 pixels. This display has high resolution
and high color which requires a faster interface so the pixel clock can maintain a 60Hz frame rate. The
part number for this display is E30RA-FW400-N. Details of this display are described below.
2 www.FocusLCDs.com
FAN4213
Connecting the Display
The display is connected to a graphics controller over a 24 parallel data bus and the display’s signaling
pins. A graphics controller is used in addition to a microcontroller to provide the high-speed clock signal
required to support this resolution and color depth. The connections to the graphics controller in the
following table can be changed to connect to a single microcontroller, if the device has RGB parallel
dedicated pins. The minimum requirement of RAM reserved for the frame buffer is calculated as (480
pixels x 854 pixels x 24bits/pp) 1.23 MB which will need to be provided by the microcontroller, graphics
controller or external memory.
There are 45 pins that are required to be connected to the graphics controller. This includes the 3-wire
SPI interface pins and the 24-bit parallel RGB data pins. This display is operated at a low voltage of 3.3V
which can be provided by the microcontroller. The display has an additional feature of IPS view, and a
bright backlight operated at 19.2V. The backlight voltage will need to be provided externally to the
display. Below are the pin functions and connections between the display and the controller.
3 www.FocusLCDs.com
FAN4213
42 NC Not connected Not connected
43 LEDK Cathode pin of the backlight External backlight power GND
44 NC Not connected Not connected
45 LEDA Anode pin of the backlight External backlight voltage 19.2V, 20mA
The DCLK signal is determined by the resolution, porch settings of the HSYNC and VSYNC signals and the
frame rate of the display. The frame rate is standard at 60Hz, which is the minimum frequency to
maintain an image. The timing parameters of the HSYNC and VSYNC signals are specified by the
controller. Below are the timing parameters specified in the ST7701S datasheet and the displays
datasheet.
Horizontal Front Porch Start position of the HSYNC pulse signal 2 10 - DCLK
Horizontal Pulse Width Number of DCLKs in one HSYNC pulse signal 2 2 255 DCLK
Vertical Back Porch Start position of the vertical active area 2 30 254 line
Vertical Front Porch Start position on the VSYNC pulse signal 2 10 - line
Vertical Pulse Width Number of lines in the VSYNC signal 2 2 254 line
Vertical Total Total number of HSYNC pulses in one frame 2 896 - line
The total HSYNC period for this display is calculated as the total time in DCLKs for one line, including the
time where the pixels are not active. In this example, this value is calculated to be 480+50+10+2=542
DCLKs. The total VSYNC period for one frame of pixels to be displayed is calculated in the number of
lines. The total time it takes for one frame of pixels is 854+30+10+2=896 lines.
The dot clock (DCLK) signal is determined by these two totals and the frame rate in order to maintain
the image at 60Hz. The calculation of the DCLK signal is as follows: 542 x 896 x 60 = 29Mhz. This is a high
clock speed for the RGB interface. The maximum clock speed for the RGB parallel interface with this
controller is 33MHz. Certain steps should be taken to reduce noise on this signal to ensure reliability of
the data transmitted.
4 www.FocusLCDs.com
FAN4213
Initializing the Display Through SPI
The 3-wire SPI interface is used to send 8-bit commands and data to initialize the display. Each of these
commands can be found in the specification sheet for the display’s embedded controller IC ST7701S.
These commands specify the selection of color format, resolution, timing parameters and power
control. There are a few ways to send these commands to the display.
Most microcontrollers offer dedicated SPI interface pins for the SPI protocol. There are many code
repositories available for the SPI interface so there are many options for sending these commands and
data. In this application, the SCL clock signal is set at 2MHz. This lower frequency was chosen over a
maximum frequency of 15MHz to ensure proper signal timing and to avoid noise. Since the SPI interface
is used for a brief initialization period, high speed is not required.
Another way is to use any digital pins available and “bit-bang” the information. This is when the clock
and data pins are signaled on and off in the right sequence to communicate the data. This is done when
there are not specific SPI pins available. This is common with the 8051 microcontrollers where most
ARM and AVR microcontrollers have an SPI interface. This option has the benefit of control over
whether the data is set at the rising or falling edge of the clock signal. This can be different for each
display that uses the SPI interface for initialization, so it is important to confirm in the data sheet.
Below are SPI initialization commands for the 24-bit parallel RGB interface. These commands set many
functions of the display such as: timing constraints for the RGB interface, color depth, resolution, and
voltage control.
write_command(0x01);
delay_ms(200);
write_command(0x11);
delay_ms(150);
write_command(0x13);
write_command(0x26);
write_data(0x01);
write_command(0x36);
write_data(0x00);
write_command(0x3a);
Initializing the Graphics Controller
write_data(0x50);
This application uses a graphics controller to increase the clock speed and provide memory. If the
microcontroller is providing the RGB function to the display, then this step can be skipped. The graphics
write_command(0xff);
controller used in this application is SSD1963. This graphics controller provides the memory for the
write_data(0x77);
frame buffer of the display. The DCLK signal is also generated by this controller to an RGB PLL setting of
write_data(0x01);
29MHz.
write_data(0x00);
write_data(0x10); //bk0
write_command(0xb0); 5 www.FocusLCDs.com
write_data(0x0D);
FAN4213
The RGB interface pins are connected to the graphics controller in parallel. This application uses the 24-
bit interface so all 24 data bus pins must be connected to the controller. The HSYNC, VSYNC, DE and
DCLK pins are also connected to this controller. The graphics controller is controlled by commands over
a 16-bit parallel MCU interface. These pins will need to be connected to the microcontroller to send the
initialization commands as well as the data that will be projected on the display.
The initialization of the graphics controller will specify the desired DCLK speed that is needed for the
RGB interface. These commands are sent by the microcontroller in sequences of 8-bits. Because the
commands are 8-bits, it is possible to send the data over an 8-bit parallel interface. The commands that
are used to initialize the graphics controller are reviewed in the data sheet of the IC SSD1963. Below are
the commands that were used to initialize the graphics controller.
LCD_WR_DATA(0x03);
FAN4213
Below is the example used to write to RAM stored on the SSD1963 controller. This process is done using
the command “memory write” (0x2c) of the graphics controller for each of the pixels on the display. The
colors can be sent in 6-digit, 24-bit sequences and decoded or as three 8-bit sequences representing one
for each of the red, green, and blue components of the color. Below the color will be sent as
components of the RGB color in three steps on eight bits to the graphics controller. The image above
shows how the 24-bit data is sent to the graphics controller in sequences of 16-bits.
void display_color(unsigned char red, unsigned char green, unsigned char blue)
{
word i,j;
LCD_WR_REG(0x2c);
for(i=0;i<854;i++)
for(j=0;j<480;j++)
{
LCD_WR_DATA(red, green, blue);
}
}
DISCLAIMER
Buyers and others who are developing systems that incorporate FocusLCDs products (collectively, “Designers”)
understand and agree that Designers remain responsible for using their independent analysis, evaluation and
judgment in designing their applications and that Designers have full and exclusive responsibility to assure the safety
of Designers' applications and compliance of their applications (and of all FocusLCDs products used in or for
Designers’ applications) with all applicable regulations, laws and other applicable requirements.
Designer represents that, with respect to their applications, Designer has all the necessary expertise to create and
implement safeguards that:
7 www.FocusLCDs.com
FAN4213
(3) lessen the likelihood of failures that might cause harm and take appropriate actions.
Designer agrees that prior to using or distributing any applications that include FocusLCDs products, Designer will
thoroughly test such applications and the functionality of such FocusLCDs products as used in such applications.
8 www.FocusLCDs.com