Playing with a 2.8' TFT LCD

A place to document your own projects.

Playing with a 2.8' TFT LCD

Postby herpderp » Mon Aug 12, 2013 2:42 pm

Hi all,

I've worked on this « project » for weeks now, and I think that it's time to share.

In the beginning, I just wanted to play with these cheap TFT screens available on eBay (displaying some pictures & text, nothing more); step by step, I finally designed a PCB and a built a consequent software with many 2D basic functions and even a small GUI.

The board is based on a PIC32 and a 2.8' TFT with touchscreen (ILI9320 controller, using 16bits PMP). The PCB is 4.9 x 4.9 cm, 2 layers (=> $15 / 10 units at seeedfusion).

About the software: I've first tried to use some parts of code provided by Microchip, but their library looks like quite complex from my point of view (some files with more than 5k lines, with too much #ifdef.... ><"). As a result, I rewrote a new software, from scratch; this software is composed of 2 main parts:
P2D: 2D functions (drawing a line, put some texts & sprites, draw filled polygons, memory buffering...)
GUI: small GUI with some basic widgets (buttons, checkbox, graph, …). Each widget has generic attributes (disabled, notified, focused, …), can be grouped and linked to signals (e.g. emit a signal when the widget is pressed)

The project is under OSHW / GPL3.

A small video showing the GUI is available here
Another video showing the 2D functions only
Some explanations (in french :/) on my blog
Suggestions / advices / comments are welcomed.

Regards
Attachments
schematics.zip
(1.46 MiB) Downloaded 830 times
src.zip
(400.42 KiB) Downloaded 722 times
diy_smart_display.JPG
DSCF0883.JPG
smart_display_pcb.png
smart_display_schematics.png
User avatar
herpderp
Newbie
Newbie
 
Posts: 23
Joined: Tue Apr 02, 2013 12:21 pm

Re: Playing with a 2.8' TFT LCD

Postby sam512bb » Mon Aug 12, 2013 5:51 pm

Good day Herpderp,

Nicely done! You have done an excellent job!

Cheers,

Sam
sam512bb
Jr. Member
Jr. Member
 
Posts: 78
Joined: Tue Dec 18, 2012 12:24 pm

Re: Playing with a 2.8' TFT LCD

Postby neslekkim » Tue Aug 13, 2013 12:46 am

very nice!, so it's actually possible to get fast gui on these lcd's, all I have seen with arduinos so far have made me stay away from these thinking that the controller is slow..
Looks like an good writeup on the blog also, but I don't understand the french ;)
neslekkim
Sr. Member
Sr. Member
 
Posts: 349
Joined: Tue Sep 11, 2012 5:36 am
Location: Oslo, Norway

Re: Playing with a 2.8' TFT LCD

Postby herpderp » Tue Aug 13, 2013 1:51 am

Thanks for your support!

neslekkim wrote:very nice!, so it's actually possible to get fast gui on these lcd's, all I have seen with arduinos so far have made me stay away from these thinking that the controller is slow..

Well, we cannot compare the small 8bits MCU of the arduino plus its generic library to a overkilled 32bits programmed in C :p
Final goal (not completed yet) of this project is to make this display drivable through UART, allowing small MCUs to get fast GUI with tiny memory footprint (like a smart display module). Note that the GUI would be much faster (for the same price) by using a STM32F4 (210MIPs at nominal clock, instead of 120MIPs for the PIC32)

Regards
User avatar
herpderp
Newbie
Newbie
 
Posts: 23
Joined: Tue Apr 02, 2013 12:21 pm

Re: Playing with a 2.8' TFT LCD

Postby neslekkim » Tue Aug 13, 2013 2:39 am

true, but look at this video, around 1:30 (not fair to compare gui to pictures I think, but from 1:30 there are some text rendering)
http://www.youtube.com/watch?v=BWT7UGYaBIE
And this is an stm32..

Are you going to make these available on tindie?
neslekkim
Sr. Member
Sr. Member
 
Posts: 349
Joined: Tue Sep 11, 2012 5:36 am
Location: Oslo, Norway

Re: Playing with a 2.8' TFT LCD

Postby jaromir » Tue Aug 13, 2013 8:31 am

Great one!
I was always bad at those graphics things, hope I'll learn something from your sources.
my personal webpage - http://jaromir.xf.cz/ Update 05.06, project PIC500
jaromir
Newbie
Newbie
 
Posts: 37
Joined: Tue Jun 07, 2011 4:49 am
Location: Bratislava, Slovakia

Re: Playing with a 2.8' TFT LCD

Postby herpderp » Tue Aug 13, 2013 12:02 pm

neslekkim wrote:true, but look at this video, around 1:30 (not fair to compare gui to pictures I think, but from 1:30 there are some text rendering)
http://www.youtube.com/watch?v=BWT7UGYaBIE
And this is an stm32..


Yeah, it's a kind of endless debate :p
Processing speed depends on so many things here... The µC, the bus width, location of sprite & font (e.g. slower if on SD card, fastest if on program memory), compiler optimizations, used algorithms...
Each implementation has its advantages & drawbacks, and I think that any comparison would be unfair

neslekkim wrote:Are you going to make these available on tindie?

Hummm not yet... For example, I still don't know if the SD card is working, I've not tested it yet... The software is not complete too, it would take some additional weeks to get a "stable" version :/

neslekkim wrote:hope I'll learn something from your sources

I've done my best to make the source code readable (small function, meaningful names, some comments...) and easily portable (on another µC or TFT controller). Keep in mind that using a TFT may seem complex, but actually it's just like using a good old 2x16 display, with much more registers, and displaying pixels instead of glyphs.
User avatar
herpderp
Newbie
Newbie
 
Posts: 23
Joined: Tue Apr 02, 2013 12:21 pm

Re: Playing with a 2.8' TFT LCD

Postby herpderp » Fri Jan 03, 2014 8:23 pm

[UPDATE]

Even if it is not completed yet, I think that the current version of PCB/software is now "acceptable". I’m currently working on a kind of documentation / user manual, I hope to finish it quickly…
So here is a small video of the smart TFT
And source code / eagle files on github
I’m still planning to sell some boards on tindie ($35, including a 2GB µSD card)

Oh just one more thing: this is a 3.2" TFT display, not a 2.8" as described, sorry :|

New PCB version
- The SST25 (flash memory) has been removed to avoid concurrent access on the SPI bus with the µSD card.
- Some wirepads added
- Q1 changed (from 2N2222 to SI2302)

New software version
- The SD card is now supported (integration of FAT FS, following thread http://www.microchip.com/forums/m563218.aspx)
- The smart TFT now is drivable through UART (for drawing both simple geometrics and GUI objects)
- New widgets: text area (text with automatic line feed), rotary encoder, flexible list (with by-category sorting), editable entry
- New built-in "macro": AZERTY / QWERTY / numeric keyboard with insert / cut / copy / paste features, a file browser (linked with FAT FS), popups
- Integration of ~ 150 16x16 icons (from http://openiconlibrary.sourceforge.net/), 5 AA fonts (4 bpp, ASCII 32-255). 27% of the flash memory remain free.
- Setup menu: built-in menus for touchscreen calibration, gamma adjustment, or P2D/GUI demonstration. Resulting parameters are stored on the µSD card
- Minor bug fixes

Happy New Year!
Attachments
schema.png
pcb.png
screenshots.png
arch.png
tindie.png
nexttimecheckmechanicaldimension.png
User avatar
herpderp
Newbie
Newbie
 
Posts: 23
Joined: Tue Apr 02, 2013 12:21 pm

Re: Playing with a 2.8' TFT LCD

Postby neslekkim » Sat Jan 04, 2014 8:24 am

herpderp wrote:I’m still planning to sell some boards on tindie ($35, including a 2GB µSD card)


Complete with the tft?

herpderp wrote:- The SST25 (flash memory) has been removed to avoid concurrent access on the SPI bus with the µSD card.

Isn't it 4 spi's on this?, or do they interfere with each other?

btw, no icsp connector? (or what it's called for pickit)
neslekkim
Sr. Member
Sr. Member
 
Posts: 349
Joined: Tue Sep 11, 2012 5:36 am
Location: Oslo, Norway

Re: Playing with a 2.8' TFT LCD

Postby herpderp » Sat Jan 04, 2014 12:46 pm

neslekkim wrote:Complete with the tft?

Yes. A fully operational & tested board (not including shipment fees).

neslekkim wrote:Isn't it 4 spi's on this?, or do they interfere with each other?

The 4 SPI are independant... but shared with other I/O functions: SPI#3 shares its pins with UART#1 and I2C#3, SPI#1 is shared with PMP16... You have to choose which functionnality you want wisely, the PIC32 does not simultaneously provide 6UART, 4SPI and so on as suggested in their product description...
On this board, most available I/O pins are wired to external connectors (see attached picture). At the end, only one SPI is easily routable to the µSD slot; and since the µSD is now supported (up to 2GB at least), I don't really need a small flash memory anymore (the SST25 has 16MB max).

neslekkim wrote:btw, no icsp connector? (or what it's called for pickit)

It is present, but not soldered. For now, I program these boards thanks to a DIY probe (with some cheap POGO pins from ebay). I would like to implement a bootloader (boot from µSD), but I didn't found a free & functional one after some googling.
Attachments
pickit.png
pin.jpg
User avatar
herpderp
Newbie
Newbie
 
Posts: 23
Joined: Tue Apr 02, 2013 12:21 pm

Re: Playing with a 2.8' TFT LCD

Postby neslekkim » Sat Jan 04, 2014 1:30 pm

aha, similar to this pogo adapter I bought earlier: http://www.ebay.com/itm/111110927300
Looking forward to find it on Tindie (or some other place to buy it)
neslekkim
Sr. Member
Sr. Member
 
Posts: 349
Joined: Tue Sep 11, 2012 5:36 am
Location: Oslo, Norway

Re: Playing with a 2.8' TFT LCD

Postby Pieter » Sun Jan 05, 2014 11:16 am

Very nice! Also looking forward to get my hands on one of these...
User avatar
Pieter
Newbie
Newbie
 
Posts: 20
Joined: Mon Dec 02, 2013 11:08 am
Location: Netherlands

Re: Playing with a 2.8' TFT LCD

Postby Rubi » Tue Jan 07, 2014 4:10 am

Hi

Thank you very much for this project, I built one of these yesterday because I need a good display for my home control project.
I had to update your initialization code, so I can use the ILI9325 and ILI9328 displays.

The next step I need to implement is a sleep mode, the display consumes 130mA and the ILI9325_8 displays need a different sleep/wake up routine.

Thank you very much for this great project!

Cheers
Rubi
Rubi
Newbie
Newbie
 
Posts: 46
Joined: Mon Dec 21, 2009 7:02 am

Re: Playing with a 2.8' TFT LCD

Postby herpderp » Tue Jan 07, 2014 12:53 pm

Rubi wrote:Hi

Thank you very much for this project, I built one of these yesterday because I need a good display for my home control project.
I had to update your initialization code, so I can use the ILI9325 and ILI9328 displays.

The next step I need to implement is a sleep mode, the display consumes 130mA and the ILI9325_8 displays need a different sleep/wake up routine.

Thank you very much for this great project!

Cheers
Rubi


You're welcome; If you get something that works on an ILI9328, please share your source code :p

Btw, I think that an implementation example of the sleep mode is available in the application note of ILI932x (Yeah there is an understandable & exploitable application note of the ILI, unlike trying to code something by using the datasheet only; I used this application note for the power-on sequence)

Regards
User avatar
herpderp
Newbie
Newbie
 
Posts: 23
Joined: Tue Apr 02, 2013 12:21 pm

Re: Playing with a 2.8' TFT LCD

Postby Rubi » Wed Jan 08, 2014 9:27 am

Hi Herpderp

Her is my ini routine for the ILI9325_8 displays:

static const uint16_t ili9325_cfg[] = {

/*
* Configuration & power sequence
*/

/*osc & Vcore setting*/
0x00E7, 0x0010, /*??*/
0x0000, 0x0001, /*0x0000: Start Oscillator*/
T_WAIT, 12, /*§8.2.3. "Wait at least 10ms to let the frequency of oscillator stable" */
0x0001, 0x0000, /*0x0001: Driver Output Control 1 [SM;SS]*/
0x0002, 0x0600, /*0x0002: LCD Driving Wave Control [B/C;EOR]*/
0x0003, 0x0038, /*0x0003: Entry Mode [TRI;DFM;BGR;HWM;ORG;I/D1;I/D0;AM]*/
0x0004, 0x0000, /*0x0004: Resize Control [RCV1-0;RCH1-0;RSZ1-0]*/
0x0007, 0x0000, /*0x0007: Display Control 1 [PTDE1-0;BASEE;GON;DTE;CL;D1;D0]*/
0x0008, 0x0404, /*0x0008: Display Control 2 [FP3-0;BP3-0]*/
0x0009, 0x0000, /*0x0009: Display Control 3 [PTS2-0;PTG1-0;ISC3-0]*/
0x000A, 0x0000, /*0x000A: Display Control 4 [FMARKOE;FMI2-0]*/
0x000C, 0x0000, /*0x000C: RGB Display Interface Control 1 [ENC2-0;RM;DM1-0;RIM1-0]*/
0x000D, 0x0000, /*0x000D: Frame Marker Position [FMP8-0]*/
0x000F, 0x0000, /*0x000F: RGB Display Interface Control 2 [VSPL;HSPL;EPL;DPL]*/

/*power supply setting*/
0x0010, 0x0000, /*0x0010: Power Control 1: clear*/
0x0011, 0x0004, /*0x0011: Power Control 2: set VC2-0*/
0x0012, 0x0000, /*0x0012: Power Control 3: clear*/
0x0013, 0x0000, /*0x0013: Power Control 4: clear*/
T_WAIT, 200,

0x0010, 0x14F0, /*0x0010: Power Control 1*/
0x0011, 0x0004, /*0x0011: Power Control 2*/
T_WAIT, 50,

0x0012, 0x008A, /*0x0012: Power Control 3*/ // Int Ref
T_WAIT, 50,

0x0013, 0x0F00, /*0x0013: Power Control 4*/
0x0029, 0x001F, /*0x0029: Power Control 7*/
0x002B, 0x000D, /*Frame Rate 90hz*/
T_WAIT, 50,

0x0020, 0x0000, /**/
0x0021, 0x0000, /**/
T_WAIT, 50,

0x0030, 0x0007, /*Gamma Controll */
0x0031, 0x0707, /**/
0x0032, 0x0006, /**/
0x0035, 0x0704, /**/
0x0036, 0x1F04, /**/
0x0037, 0x0004, /**/
0x0038, 0x0000, /**/
0x0039, 0x0706, /**/
0x003C, 0x0701, /**/
0x003D, 0x000F, /**/
T_WAIT, 50,


/** other registers setting**/

0x0060, 0xA700, /*0x0060: Driver Output Control 2 [GS;NL5-0;SCN5-0]*/
0x0061, 0x0003, /*0x0061: Base Image Display Control [NDL;VLE;REV]*/
0x006A, 0x0000, /*0x006A: Vertical Scroll Control [VL8-0]*/
0x0090, 0x0010, /*0x0090: Panel Interface Control 1 [DIVI1-0;RTNI4-0]*/
0x0092, 0x0000, /*0x0092: Panel Interface Control 2 [NOWI2-0]*/
0x0093, 0x0003, /*0x0093: Panel Interface Control 3 [MCPI2-0]*/
0x0095, 0x0110, /*0x0095: Panel Interface Control 4 [DIVE1-0;RTNE5-0]*/
0x0097, 0x0000, /*0x0097: Panel Interface Control 5 [NOWE3-0]*/
0x0098, 0x0000, /*0x0098: Panel Interface Control 6 [MCPE2-0]*/
T_WAIT, 50,

/** Display ON sequence **/
0x0007, 0x0133, /*0x0007: Display Control 1 [PTDE1-0;BASEE;GON;DTE;CL;D1;D0] -- FINAL TURN ON*/
0x0020, 0x0000, /**/
0x0021, 0x0000, /**/

CFGEND, CFGEND /*end*/
};

Next step is the sleep wake up routine I am currently working on.
Unfortunately it is different to the ILI9320 and a bit more complex.
But I already hat to study the datasheet so I don't worry too much.
Thank you for the hint, I will try to get my hands on the app note!

Again thank you for this awesome project.

Cheers
Rubi
Rubi
Newbie
Newbie
 
Posts: 46
Joined: Mon Dec 21, 2009 7:02 am

Next

Return to Project logs

cron