3.5 TFT ili9327 lcd shield problem

anyone ever tryed 3.5 inch spi(four-wire) iic(two-wire) interface tftlcd for arduino uno and mega2560 (same to raspberry pi ) from http://www.mcufriend.com/ some images: http://www.mcufriend.com/pic/pi/spi35-2.jpg http://www.mcufriend.com/pic/pi/spi35-1.jpg

I was trying to figure it out for more then 1 week and no sucess, all I could find was dead links. @HP its says its using ili9327 drivers.

I have tryed few libraries on the net and no luck.

anyone have any more info on this LCD?

It is a fairly common display controller and not at all difficult to get working. The complete ili9327 datasheet can be found here.

If you are trying to use either the Uno or a Mega to drive this display, did you provide the necessary level translators? If not, you may have let the smoke out (destroyed the device) since the display is a strictly 3.3 volt device on all pins - which means it is not pin to pin compatible with the 5 volt I/O levels of the Uno and Mega boards. Only the Due and the 8mhz pro mini have 3.3 volt I/O.

I dont think its common ILI9327 lcd shields, since its spi 4 wire(MISO,MOSI,SCK,SS), acording to image http://www.mcufriend.com/pic/pi/spi35-2.jpg there is no level translators, itd pin to pin configuration. on Shield there is MCP23s17 port expander.

if you think its fairly common display, could you please direct me to some example? thanks

Good observation with regard to no level translators.

I say the the ili9327 is common since it is supported by the most commonly used tft lcd library out there, UTFT by Henning Karlsen. Just gogle it, download the most current version and use the AVR serial 240x400 example.

UTFT by Henning Karlsen library was first library that i tryed. Its not my first LCD Shield from china, but its first spi 4 wire LCD, and was hoping to get it working.

avr_fred in new version there is no 240x400 example for serial, but even so I have tryed with ILI9327 lcd driver and no luck.

Digidon, sorry the the bad information. I thought UTFT was able to support the 9327 in serial mode, and as you discovered, it cannot.

I have some experience with the ili9327 in parallel mode on a Mcufriend Mega shield. What I found there many months ago was that UTFT did not handle 8 bit mode correctly and several modifications were needed to remove extraneous writes to the device to get the library to function. I had forgotten that I had also purchased one of the serial version 3.5 inch displays at the same time and once I had the parallel shield version working, I put the serial device in the "I'll get to it pile".

Your last post plus some free time last night had me digging the serial version lcd out for some investigation...

My first thought was to use the AVR's native SPI mode to push an initialization string to the device but after reading through the ili9327 datasheet, it was obvious that would not work as the LCD required a 9 bit word since the command/data input was not available. So, it was time to look at hacking UTFT.

The first thing I found was that UTFT uses a clock negative edge data valid scheme and the 9327 expected a positive. Marking that change still did not wake up the display so out came the logic analyzer. Everything looks right but I still have a dead screen.

I'll be able to spend a bit more time on it tonight. If I have any joy, I'll post what I find. Otherwise, no news is bad news...

avr_fred thanks, thats good news in bad news :) you said, that parallel lcd shild from mcufriend is working with UTFT lib? could you post your code/fix on forum?

The Mega shield version is on my Google drive: Ili9327 8 bit UTFT The changes were minimal, UTFT was writing a spurious zero on each low level write call. I just hacked the code with conditional compile code to eliminate the unneeded writes. I also added the display type ILI93278_8. The AVR 400x240 demo file was modified to reflect the shield configuration so it should run as-is if you have the shield and a Mega. I also removed all the non-applicable demo files just to avoid confusion with the modified version.

You may need/want to delete all files in your temp build directory if you had previously installed UTFT and have built a program with it. I don't know the rules that the IDE uses when deciding when to re-build/compile libraries but it does not appear to be the normal source file verses object file time/date compare. I spent many frustrating hours early on with learning about building libraries in Arduino and have found it safer to simply wipe my temp directory clean when editing/changing libraries to force a re-build of all code.

ok I got working code, for this shield from manufactuer but refresh rate is slow, 1 frame per minute if not less on mega.

avr_fred can you incorporate this code to UTFT library?

MCP23S17_9327_35_spi_2.zip (2.94 KB)

Wow, that has to be the slowest display draw I've ever seen... and while they include the SPI Arduino library, they never use it and the code just bit bang things in a rather incredibly crude manner. Yuck.

I've got a couple of free nights to spend on it, I'll see what I can do. Stay tuned.

hi i'm new in this forum and i have too this lcd i don't know how i can control it with arduino mega if you have any explain or any book about it pleas send to mee thanks

this is how you connect:


above code works, I manage to make it faster but still not enaught...

Here is a cleaned up version of the demo code. It is still unacceptably slow so I still have some work to do before I would attempt to integrate it into UTFT.

I removed all of the software bit-banging and implemented it with the hardware SPI of the atmega at a 8 mhz clock rate which is as fast as I can run it with a 16mhz processor. Since the the MCP23S17 SPI I/O expander has a max clock rate of 10mhz, I’m not going to do anything further in hardware, I’ll look at software for any further improvements. Also removed were unreferenced symbols and routines which just added to the clutter when you’re just trying to see the structure and flow of the program.

Overall, I’m thinking it will not be a screamer, throughput wise no matter what - since the I/O expander forces a minimum byte count of three to write one data byte. This is based on the need to write the device address, then a register address, the data and finally a toggle of the LCD WR line to write one byte to the LCD.

MCP23S17_9327_35_spi_8.zip (1.62 KB)

Thank you for posting that code!

I just received five of these ili9327 mcp23s17 3.5" 400x240 displays - without any documentation of course, not even silk screen labling of the four pin J2 and the three pin J1. I should have asked for docs before buying.

Could you do me a favour and post the pin definitions?

I can figure out the pin assignments on the other side of the MCP23S17 from your code, but I need to be able to connect it.

i have some codes.it maybe help you.

UTFT-master-2.zip (1.1 MB)

Where can I find a good tutorial for ILI9327

Unfortunately I also I have a problem like that. How do I download?

Hi everyone, at first - sorry for my poor english, i got ILI9327 SPI display few days ago from http://www.aliexpress.com/item/Free-shipping-LCD-module-Pi-TFT-3-5-Inch-3-6-inch-TFT-LCD-400x240-Spi/32247107330.html I start to search for working library, and after testing lot of other libraries without success, i decide to modify linux version, seler send to my Raspbery (linux) drivers, after few long nights i modified linux library and got working sketch, default linux library use software SPI and is wery slow due to 2 things, one of them - digitalWrite, i changed digitalWrite to direct port access, the result - about 2-3 times faster speed, but its not enought, other - software SPI, now i am trying to change sketch to work with hardware SPI, its easy, i do this later and post there, sketch have few errors in line draw and rectangle draw, now i am working on SPI, later do screen rotate function, maybe my sketch help someone,

updated sketch with hardware SPI you can find there:


I can figure out the pin assignments on the other side of the MCP23S17 from your code, but I need to be able to connect it.

It’s work fine with My raspberry pi.

// [Pin connection]
// TFT Rpi(pin)
// ------------------------
// 3V3-------------3.3V( 1)
// -------------
// GND-------------0V ( 6)
// SS--------------CS0 (24) LOW = 0 = Chip Select
// SCK-------------SCLK(23)
// MOSI------------MOSI(19)
// MISO------------MISO(21)
// ------------------------

// [TFT Internal Pin connection]
// This module include MCP23S17 I/O Expander
// Rpi MCP23S17 ILI9327
// -------------------------------
// GPB0--------DB[0]
// GPB1--------DB[1]
// GPB2--------DB[2]
// GPB3--------DB[3]
// GPB4--------DB[4]
// GPB5--------DB[5]
// GPB6--------DB[6]
// GPB7--------DB[7]
// 3V3 --------VDD --------VCC
// GND --------VSS --------VSS
// SS --------CS --------N/C
// SCK --------SCK --------N/C
// MOSI--------SI --------N/C
// MISO--------SO --------N/C
// GPA7--------CSX(??)
// GPA6--------D/CX
// GPA5--------WRX
// GPA4--------RDX(??)
// GPA3--------RESET
// GPA2--------N/C
// GPA1--------N/C
// GPA0--------N/C
// INTA--------N/C
// INTB--------N/C
// RESET-------N/C
// A2 -------GND
// A1 -------GND
// A0 -------GND

You can download source code from here.

You can download a hardware specification from here. http://nopnop2002.webcrow.jp/TFT/ILI9327-Spec.pdf