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

Working libraries, libraries being ported and related hardware
stevestrong
Posts: 1835
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 » Tue Jan 10, 2017 9:10 am

There are two different cases:

1. the window address setting for the following data
I do this in single 8 bit accesses, wherein I optimized the CS and Control/data pin setting within one BSRR register access. This optimization I had to remove, because the WR strobe signal will be either generated at the 16th CLK pulse or at the rising edge of the CS (this will master reset the 4040 counter and thus all output pins will be immediately set to 0). So if the WR rising edge (CS idle) comes after the Control/data has been changed (due to propagation delay), the controller gets the wrong Control/data selection. I just added extra delay after CS idle and before control/data setting to overcome the delay issue. This will of course negatively influence the overall speed performance.

2. continuous 16 bit color data writing
In this case I don't have much influence, it must be assured on the HW side that the 4040 counter output pulse comes at the correct time right after the 16th SCK bit. And exactly this is what at the moment is critical. I hope I'll solve this with the extra delays for SCK and MOSI, as mentioned before.
Using RC I see it a bit critical because the delays must be identical for both signals.

bianchifan
Posts: 82
Joined: Sun Oct 18, 2015 1:27 pm
Location: W'tal, Germany

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

Post by bianchifan » Tue Jan 10, 2017 10:01 am

stevestrong wrote:So if I really want to speed up more the display, I have to drive it pure parallel, direct from BP (over PB0..15).
Otherwise stick to 24MHz.

Or dismount the display and drive directly the ILI SPI pins...
I fear, it doesn't gets faster, datasheet tells a minimum serial clock cycle of 66 ns (15MHZ) in SPI modes.
Maybe that's the reason for adding shift registers.

Last weekend I found another variant on ebay UK which I ordered, I found some useful stuff in an RPI forum:
Kedai 3.5" TFT
Alternative layout with HC595 and SPI touch
RPI TFT Kedei schematic.jpg
RPI TFT Kedei schematic.jpg (253.05 KiB) Viewed 457 times
The original vendor seems to offer two version on taobao:
RPI only - 32 MHZ SPI
alternative PIs - 25 MHz SPI

stevestrong
Posts: 1835
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 » Tue Jan 10, 2017 10:28 am

This schematic generates the Command/data and WR pulses directly from the SPI data, meaning that one can handle all control and data communication through SPI + DMA, no need for separate GPIO toggling. The only drawback: you need one (or maybe 2) additional SPI byte(s) for the control bits, so even if you drive the SPI interface at 32 MHz, it will only give you an equivalent of 24MHz (16MHz) data throughput. And you have to prepare the data stream in beforehand to interlace the control byte(s) with data bytes.

But what I have found more interesting is that the shifters (HC595) are supplied with 3.8V (!), which is inline with my observation (and the spec) that those chips need higher supply voltage in order to support higher speeds (above 24 MHz).

Thanks, @bianchifan, this brings me to the same idea to try out such a higher supply voltage in my case, too. Maybe I can compensate the remaining propagation delay with this increased supply voltage, without involving extra inverter gates.

User avatar
Pito
Posts: 1628
Joined: Sat Mar 26, 2016 3:26 pm
Location: Rapa Nui

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

Post by Pito » Tue Jan 10, 2017 12:26 pm

Put it all inside an XC9536XL, it is 3.3V and 80MHz fine. Morever it is 100% routable so you may change the pin layout as you wish (34 pins can be used). Also 5V tolerant inputs.
Pukao Hats Cleaning Services Ltd.

stevestrong
Posts: 1835
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 » Tue Jan 10, 2017 12:45 pm

I think the XC9536XL would be an overkill for my purposes, to drive it from the pill...Even overclocked to 96MHz, the SPI would run at 48MHz, which I maybe can get it to work with my small changes, using fixed signal delays at a specific supply voltage (5V would be too much, but 3.8V .. 4.2V may be feasible).

User avatar
RogerClark
Posts: 7494
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

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

Post by RogerClark » Tue Jan 10, 2017 9:06 pm

Pito wrote:Put it all inside an XC9536XL, it is 3.3V and 80MHz fine. Morever it is 100% routable so you may change the pin layout as you wish (34 pins can be used). Also 5V tolerant inputs.
That does look like overkill, but perhaps one of the CoolRunner series of FPGA e.g XC2C64A may be sufficient.
XC2C64A are less than $5 on Aliexpress

User avatar
Pito
Posts: 1628
Joined: Sat Mar 26, 2016 3:26 pm
Location: Rapa Nui

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

Post by Pito » Tue Jan 10, 2017 9:25 pm

XC9536XL is the half in size of that CoolR, CoolR needs a voltage regulator for the core, XC95 does not, Coolr has 1 user pin less. XC9536XL cost $1 2y back.
Of course there is an additional effort needed - Xil ISE 14.7, verilog or schematic capture, programmer.
CoolR was an attempt of Xilinx to produce CPLD with "lower power" so they took XC9572XL and decreased the core voltage to 1.2V afaik, so you need an additional regulator for core and it cost you 1 pin. Otherwise they are equal even I think you can place more logic in XC9572XL.
Last edited by Pito on Tue Jan 10, 2017 9:37 pm, edited 1 time in total.
Pukao Hats Cleaning Services Ltd.

User avatar
RogerClark
Posts: 7494
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

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

Post by RogerClark » Tue Jan 10, 2017 9:35 pm

Pito wrote:Those two are equal in size, CoolR needs a voltage regulator for the core, XC95 does not, Coolr has 1 user pin less. XC9536XL cost $1 2y back.
Of course there is an additional effort needed - Xil ISE 14.7, verilog or schematic capture, programmer.
OK.

Looking on AliExpress , XC2C64A boards like this one
https://www.aliexpress.com/item/XILINX- ... 05bd4a3417

Are much cheaper than XC9536XL boards (which seem to be over $10) e.g.
https://www.aliexpress.com/item/Xilinx- ... eb2891c49d

I can't find any cheap XC9536XL boards

User avatar
Pito
Posts: 1628
Joined: Sat Mar 26, 2016 3:26 pm
Location: Rapa Nui

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

Post by Pito » Tue Jan 10, 2017 9:38 pm

XC9536XL is half of the CoolR you advertise, the chip cost around $1. So it cannot be an overkill :)
The chip works >150MHz internally, when routed you can mess with counters, shift registers and whatever logic you want at 80-90Mhz sure. The logic guys need is about 10 lines of verilog, or, with schematic capture the same schematics as above, as the library includes dozens components like those the guys use now for the tft (almost all ttl/cmos standard chips people mess with).
The trick is when you want to change something in the schematics - wiring or add a component or invert a signal, or fully change your design, you do it on the screen and then just flash - the same process as with arduino. The XC9536XL family has got flash memory for the wiring, programmble via jtag.The dev cycle is about 1-2minutes to change and run. And the chip is 100% routable so you can connect your tft to whatever pins you want - it always fits your new design/schematics to existing pin layout on the pcb (or in other words - your design can be always routed to any i/o pin setup you want).
Here is a 32bit freqmeter/periodmeter/counter in an XC9572XL I did 5y back for arduino forum as an example. It includes 2x16bit counters and 2x16bit shift registers and some logic (arduino had read the freq measured off the chip serially, only 7 pins used). The ring oscillator (3 invertors in loop) there did 150MHz freq.
32bit counter arduino.jpg
32bit counter arduino.jpg (38.59 KiB) Viewed 420 times
Pukao Hats Cleaning Services Ltd.

User avatar
RogerClark
Posts: 7494
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

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

Post by RogerClark » Tue Jan 10, 2017 11:03 pm

@pito

Its a shame no one makes a cheap board with the XC9536XL on it, as for most people is not practical to solder SMD


PS.
What does the part of the circuit with 3 inverters in series do ?

Post Reply