The Design of Configurable TFT-LCD Controller Based on Nios II
Transcript of The Design of Configurable TFT-LCD Controller Based on Nios II
The Design of Configurable TFT-LCD Controller Based on Nios II
Xiujie Donga, Zhaoqian Guo b , Liang Zhang cand Kai Fud School of Electronics and Information,Zhongyuan University of TechnologyZhengzhou 450007,
China. [email protected], [email protected], [email protected],[email protected]
Keywords: TFT-LCD; FPGA; SOPC; Nios II; IP.
Abstract.To solve the problem that different types of LCD screen have different drivers,this paper puts forward a design method based on embedded software core. It constructs LCD controller IP core and Nios II embedded softcore processor on SOPC. It uses C language to realize video sync,the conversion, caching and transmission of pixel data and image display. The design method is simple, fast, and has strong portability and wide applicability. The results show that this design scheme of LCD controller is reasonable, the operation is stable and the pictures display clearly.
Introduction
As the characteristics of small size, flat-panel, no radiation, low power consumption and digital interfaces, LCD(Liquid Crystal Display) have been increasingly widely used in portable embedded products, which has a very broad market prospects. However, the standards are not uniform because there are many LCD screen manufacturers. What’s more, LCD screens of different manufacturers often can not connect with general LCD controller seamlessly. The prices of timing chips specially designed for LCD panel that the manufacturers recommend are high, and the external interface logic need to be redesigned. In order to maximize solve the above problems and achieve the design goal on single chip system, this paper uses Nios II embedded soft-core processor and LCD controller IP(Intellectual Property) core based on SOPC(System on Programmable Chip) technology, which finished the design of TFT-LCD(Thin Film Transistor Liquid Crystal Display) controller with high performance on FPGAdevice.[1]
System solution.The design uses cyclone II device family EP2C35F484C8N produced by Altera Company. This chip has 3,326 configurable logic cells and 475 user pins,which not only meets the design’s requirements and also has great headroom.We uses AT070TN83, a type of TFT-LCD, which s produced by Taiwan's Chi Mei Electronics Company.The resolution is 800 × 480. It has 18 bits of color signal (each of R, G, B is 6 bits). It has four control signals: hsync, vsync, enable and the scan clock.
The purpose of this design is to display image on the TFT-LCD. Building SOPC hardware system on FPGA chip, including FLASH controller, SDRAM controller, TFT-LCD controller, SG-DMA module and the FIFO module. The flash is used to store hardware configuration, implementation program, and image data. At first, hewing out image frame buffer in the SDRAM, then storing an image data into the buffer, and at last using Scatter-Gather DMA to send image data from SDRAM to TFT-LCD Controller and display it. The diagram of this scheme design is shown in Fig.1.
Fig.1 Systemdesign
On-chip Controller Design.SOPC is a flexible and efficient solution.It integrates many functional modules required in system design such as processors, memory, I/O port, custom peripherals into a
5th International Conference on Computer Sciences and Automation Engineering (ICCSAE 2015)
© 2016. The authors - Published by Atlantis Press 895
FPGA chiprogrammathat has spe
TFT-LCconverter cpixel data sequence. Ysynchronizthat video s
The parand customoutput 8 birequiremen
TFT-LCof SOPC, wAvalon-ST
SG-DMtransmissiostored in nFIFO is use
Pixel dareceive is converter lsystem mo
ip to form able logic". ecific functi
CD Controlcore in SOPstream in
You can cozation timingsync genera
rameters of Vm color depits at three tnts of TFT-LCD Controllwhich is sh
T Timing Ad
MA (Scatteron between non-contiguoed as bufferata of image3 bytes of cd_pixel_co
odule in Qua
a programThe users c
ions and is eller PrincipPC Builder,RGB form
onfigure theg sequencesator requires
Fig.2 TFT-Video Syncpth mode, atimes and itLCD, the timler Implemehown in Figdapter, Pixe
F-Gather Ditwo SOPC ous addressr for pixel de buffer is 4
RGB. So, onverter.AftartusII,whic
mmable syscan easily aeasily confi
ple.Altera p, which are
mat,and outpe core to sups. The pixel s.[3]
LCD Contrc Generator and supportt can also beming sequenentation.Theg.4. The conel Converter
Fig. 4Hardwirect Memocomponents
s space to cdata.
bytes , that it is necess
fter buildingh is shown
stem on chadd IP core igured and eprovides the
shown in Fput them topport differl converter c
rollerFig.3 TCore can bet monitors we output 24 nce uses thee design builntroller inclr and Video
ware structuory Access)s. It is differ
contiguous a
is 0, R, G, Bsary to rem
g the SOPC sin Fig. 5.
hip. It usein the syste
expanded.[2e video synFig.2. The vo the off-chrent TFT-LCcan transfer
TFT-LCD tie configuredwith differebits at one
e format of olds TFT-LCludes ScatteSync Gene
ure of system) Core is urent from Daddress spac
B, but the pmove unusedsystem, com
s frameworem to realiz2] nc generatovideo sync hip display CD with difpixel data a
ming sequed to supportent resolutiotime. In ordoutput whic
CD controlleer-Gather Drator.
m used to ach
DMA that SGce, and vice
ixel data thad byte of p
mpile it and t
rk "micropze the system
or core andgenerator cin appropr
fferent resoaccording to
ence t multiple pions. Pixel dder to adaptch is shown er by calling
DMA Contro
hieve high-G-DMA cane versa. Asy
at video synper pixel dathen generat
processor +m on a chip
d the pixelcore receiveriate timingolutions ando the format
ixel formatsdata can bet the designin Fig.3.
g the IP coreoller, FIFO,
-speed datan move dataynchronous
nc generatorata by pixelte hardware
+ p
l e g d t
s e n
e ,
a a s
r l e
896
Fig .5 Hardware system moduleFig.6 The program flow chart
Procedure Design.Nios II embedded soft-core processor is a SOPC solution provided by Altera. Nios II is a general RISC (Refined Instruction Set Computer) using pipeline technique and harvard architecture,and it is configurable.It combines a wealth of peripherals, special instructions and hardware acceleration units which can provide extremely flexible and powerful, low cost SOPC system. The developers need to integrate them according to their practical needs.The LCD driver combining with Nios II, you can get an extensible, general purpose IP cores,which can solve the problems of different drivers among different types of LCD.[4]The program flow chart of this design is shown in Fig.6.
Pixel Data Format Conversion.The format of pixel data extracted by software is3-byte RGB, while per data that SG-DMA reads is 32 bits. So, at first, the original pixel data should be transformed into 32-bit, that is 0, R, G, B format in order to prevent dislocation when reading.The conversion procedure is as follows:
s_row = s;d_row = d;
for(r = 0 ; r < a_hgt ; r++ ) {
s_row = s;d_row = d; for(c = 0 ; c < a_wd ; c ++ )
{ *(unsigned char *)(d_row + 2) = *(unsigned char *)(s_row); s_row += 1;d_row += 1; *(unsigned char *)(d_row) = *(unsigned char *)(s_row); s_row += 1; d_row += 1; *(unsigned char *)(d_row - 2) = *(unsigned char *)(s_row); s_row += 1;d_row += 1; *(unsigned char *)(d_row) = 0x00; d_row += 1; } s+= s_incr;d += d_incr; Open up image storing buffer.Calling for system functionmemset(),which is included in header file
string.h.
memset( (void*)(display->buffer_ptrs[display->buffer _written]->buffer), 0x00, display->bytes _frame );
Copy Image Data to Buffer.o copy 32-bit pixel data into the display buffer of SDRAM, theprocedure is as follows:
int copy ( char* d, char* s, int wid _d, int wid _s, int hgt_s ) { int z; for ( z = 0; y < hgt_s; z++ )
897
{
} }
Pixel DTFT-LCD
Image Dnot need to
Debug simulation second geobserving tin Fig. 7.
Conclusio
This papercontroller bdifferent typrocessor,udisplay. Ththrough coand resolutin hardwa
Reference
[1] Gan MSDRA
[2] WangHJourna
[3] Altera[4] Liu M
Techn[5] Yang J
memcpy( ds += (wi _sd += (wid _
ata Transmcontroller.C
Display.Theo be controlland Simuland test. T
neration sythe interacti
n
r presents based on SOypes of LCDuses C langhe design m
onfiguring ption,which eare testing.
e
Mang, Qi GuAM,Journal Haixia,Wu al of Liquid a Company.Q
Min,Dai Shugnology.26( 2Jun, SOPC
d, s, (wid _ss * 4 ); _d * 4 );
mission.OpenCorrespondie TFT-LCD led by cpu olation.This The full namystem levelion between
a software OPC BuildeD drivers,buuage, to rea
method is siarameters oenhance fle
uibao, Chenof Jilin UniYi,DesignaCrystals an
Quartus II Hguang,Imple2011)98-101Practice Gu
s * 4 ));
ning the SGing programcontroller is
of Nios II emdesign use
me of Signl debuggingn hardware a
Fig.
and hardwer and Niosuilds up Lalize video simple, fast,
of IP core in xibility and
n Jie,Designiversity.31(2and Implemend Display.2Handbook Vementation 1. uide Based
G-DMA andm is slightly.
s constructembedded soes Quartus nalTap II isg tool that and softwar
. 7 Simulati
ware combis II of FPGALCD controlsync, pixel portable, a
n SOPC Build portability
n of Highly 2013)192-1entation of 27(2012)15Version 9.0,of LCD Di
on FPGA, B
d configurin. ed by hardwoft core systII embeddeSignalTapcan captu
re of system
ion result
nation desiA. It solves ller IP core data conver
and widely lder,it can m
y of this desi
Efficient Co
195. LCD Modu2-154. , Volume 5:splay with I
Beijing,201
ng it, it will
ware logic ceem.
ed logic anaII Logic A
ure and dis.[5]The sim
ign methodthe problemand Nios
rsion, cacheapplicable.
meet displayign.The resu
ontroller Ba
ule Based on
:Embedded IP-Based SO
0.
transfer im
ells of FPGA
alyzer SignAnalyzer, wsplay real-ti
mulation resu
d to designm of differeII embedde
e,data transmThe results
ys with diffeult has been
ased On FPG
n SOPC,Ch
PeripheralsOPC
mage data to
A, so it does
nalTap II towhich is theime signal,ult is shown
TFT-LCDence amonged soft-coremission ands show thaterent timingn completed
GA and
hinese
s, 2014
o
s
o e ,
n
D g e d t g d
898