Lib for ILI9486 - 3.5 inch 480x320 touch TFT for RPi

Working libraries, libraries being ported and related hardware
fari
Posts: 23
Joined: Sun Feb 26, 2017 12:01 pm

Re: Lib for ILI9486 - 3.5 inch 480x320 touch TFT for RPi

Post by fari » Sun Feb 26, 2017 4:07 pm

Thanks Steve for your hint!

I have done the adjustment of the SPI clock down to 18MHz:
//SPI.beginTransaction(TFT_CS, SPISettings(36000000));
SPI.beginTransaction(TFT_CS, SPISettings(18000000));
The modification, as expected, slowed down the test:

************************************************
Without DMA:
************************************************
Benchmark Time (microseconds)
Screen fill 683415
Text 56114
Lines 609680
Horiz/Vert Lines 58171
Rectangles (outline) 34479
Rectangles (filled) 1666679
Circles (filled) 386663
Circles (outline) 477277
Triangles (outline) 126756
Triangles (filled) 591264
Rounded rects (outline) 155133
Rounded rects (filled) 1859289
Done!


Nevertheless the test pattern did show up on the screen an the flashing is the same as before :(
I have rechecked the wiring and it seems to be right.
Is the TFT display damaged? Do you have another hint?

stevestrong
Posts: 1813
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: Lib for ILI9486 - 3.5 inch 480x320 touch TFT for RPi

Post by stevestrong » Sun Feb 26, 2017 4:19 pm

Well, as I said, the controller my be different, not an ILI9486. In this case it is normal that you have a corrupted display.
You should somehow figure out which kind of controller it can be, and then use the appropriate init sequence to initialize it.

Additionally, you could go lower with the speed (4MHz), or even 1MHz. If the display is still flashing, then it must be a different controller.
In this case I cannot do much.
I would recommend to check different init sequences for different controllers (ILI9481, HX8375D, etc) available for example here. This was my source of inspiration, too.

fari
Posts: 23
Joined: Sun Feb 26, 2017 12:01 pm

Re: Lib for ILI9486 - 3.5 inch 480x320 touch TFT for RPi

Post by fari » Sun Feb 26, 2017 4:23 pm

Thanks Steve! I will try to find out the type of the controller and then come back!

stevestrong
Posts: 1813
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: Lib for ILI9486 - 3.5 inch 480x320 touch TFT for RPi

Post by stevestrong » Sun Feb 26, 2017 5:24 pm

I found here (step 5) an init sequence:

Code: Select all

init=-1,0xb0,0x0,-1,0x11,-2,250,-1,0x3A,0x55,-1,0xC2,0x44,-1,0xC5,0x00,0x00,0x00,0x00,-1,0xE0,0x0F,0x1F,0x1C,0x0C,0x0F,0x08,0x48,0x98,0x37,0x0A,0x13,0x04,0x11,0x0D,0x00,-1,0xE1,0x0F,0x32,0x2E,0x0B,0x0D,0x05,0x47,0x75,0x37,0x06,0x10,0x03,0x24,0x20,0x00,-1,0xE2,0x0F,0x32,0x2E,0x0B,0x0D,0x05,0x47,0x75,0x37,0x06,0x10,0x03,0x24,0x20,0x00,-1,0x36,0x28,-1,0x11,-1,0x29,-3
You could give it a try.

fari
Posts: 23
Joined: Sun Feb 26, 2017 12:01 pm

Re: Lib for ILI9486 - 3.5 inch 480x320 touch TFT for RPi

Post by fari » Tue Feb 28, 2017 12:01 am

Thanks Steve! I will give it a try!

palmerr
Posts: 58
Joined: Tue Jan 31, 2017 6:21 am
Location: Melbourne, Australia

Re: Lib for ILI9486 - 3.5 inch 480x320 touch TFT for RPi

Post by palmerr » Tue Feb 28, 2017 12:44 am

Here's the init code from my driver, which seems to work fine.

If your init-sequence parser routine doesn't handle DELAY lines, then the last few commands will need to be executed in the mainline code.

There are a few commented out lines in the middle, which were inherited from the RPi code. I haven't tested them. The entire code is on github: https://github.com/palmerr23/STM32F01-I ... RPi-Driver

I hope it helps.

Richard

Code: Select all

const uint8_t ili9486_init_sequence[] =
{
//	2, 0xb0, 0x0,	// Interface Mode Control
//	1, 0x11,		// Sleep OUT
//	DELAY, 150,
	2, 0x3A, 0x55,	// use 16 bits per pixel color
	2, 0x36, 0x48,	// MX, BGR == rotation 0
//	2, 0xC2, 0x44,	// Power Control 3
	// VCOM Control 1
//	5, 0xC5, 0x00, 0x00, 0x00, 0x00,
	// PGAMCTRL(Positive Gamma Control)
	16, 0xE0, 0x0F, 0x1F, 0x1C, 0x0C, 0x0F, 0x08, 0x48, 0x98,
	          0x37, 0x0A, 0x13, 0x04, 0x11, 0x0D, 0x00,
	// NGAMCTRL(Negative Gamma Control)
	16, 0xE1, 0x0F, 0x32, 0x2E, 0x0B, 0x0D, 0x05, 0x47, 0x75,
	          0x37, 0x06, 0x10, 0x03, 0x24, 0x20, 0x00,
	// Digital Gamma Control 1
	16, 0xE2, 0x0F, 0x32, 0x2E, 0x0B, 0x0D, 0x05, 0x47, 0x75,
	          0x37, 0x06, 0x10, 0x03, 0x24, 0x20, 0x00,
	1, 0x11,	// Sleep OUT
	DELAY, 150, 	// wait some time
	1, 0x29,	// Display ON
	0			// end marker
};

fari
Posts: 23
Joined: Sun Feb 26, 2017 12:01 pm

Re: Lib for ILI9486 - 3.5 inch 480x320 touch TFT for RPi

Post by fari » Tue Feb 28, 2017 9:54 am

Thanks for your help! I will try that, when I am back home.
Did this code work on your STM32F103?

fari
Posts: 23
Joined: Sun Feb 26, 2017 12:01 pm

Re: Lib for ILI9486 - 3.5 inch 480x320 touch TFT for RPi

Post by fari » Sat Mar 04, 2017 7:32 am

Hello Steve!

I have followed all the hints above, but I could not run any demo on this display. The device I have bought looks exactly the same as yours at the beginning of this post. I have tried your example with no positive results. Obviously there is a serial parallel converter on the board, that why it is a write only device. I have tried ILI9481 and ILI9486 . If the controller is not ILI9486, what might it be?
I will be thankful for any hint!
Pinout  RPi Display.jpg
Pinout RPi Display.jpg (106.42 KiB) Viewed 466 times
LCD 35Inch RPi A_.jpg
LCD 35Inch RPi A_.jpg (217.35 KiB) Viewed 466 times

stevestrong
Posts: 1813
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: Lib for ILI9486 - 3.5 inch 480x320 touch TFT for RPi

Post by stevestrong » Sun Mar 05, 2017 8:05 am

As I earlier posted, there could be one out of several other controllers, see this Adafruit github page.
Pick a "fb_*.c" file and extract the init sequence, replace the version from my lib with that one and build the project.
If it does not seem to work, take the next .c file.
Sorry, but this "trial and error" method seems the only way to figure out the real controller.

Additional init sequences you can find in David's repo: https://github.com/prenticedavid/MCUFRI ... ND_kbv.cpp, starting with line 824.

I maybe not mentioned before, but you should double check the connections, and be sure that the GPIOs toggle.

david.prentice
Posts: 112
Joined: Wed Nov 16, 2016 8:52 am

Re: Lib for ILI9486 - 3.5 inch 480x320 touch TFT for RPi

Post by david.prentice » Sun Mar 05, 2017 11:03 am

It looks as if your display was made by WaveShare. So there is probably a schematic. So it should be easy to guess how the hardware needs to be driven.

As Steve said, with a write-only display you can only use guesswork.

Most 320x480 controllers are MIPI compliant. And probably start up by themselves. Just Reset, Display Off, Wake up, Display On. (with some pauses)
Two typical Register arrangements:
ILI9481 with Power/VCOM in regs 0xD0..
ILI9486 with Power/VCOM in regs 0xC0..

Once you have determined which group, you can do some diagnosis by writing bits in Panel Control Registers, ...
Different Manufacturers have subtle differences.

It is important to know what controller is mounted.

David.

Post Reply