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

Working libraries, libraries being ported and related hardware
User avatar
martinayotte
Posts: 1171
Joined: Mon Apr 27, 2015 1:45 pm

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

Post by martinayotte » Wed Jan 11, 2017 2:26 pm

RogerClark wrote: What does the part of the circuit with 3 inverters in series do ?
The ring oscillator (3 invertors in loop) there did 150MHz freq.

stevestrong
Posts: 1137
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 » Wed Jan 11, 2017 6:29 pm

Back to the original topic ;)

Here is the working version of the serial->parallel converter:
3.5 inch TFT serial to parallel converter.jpg
3.5 inch TFT serial to parallel converter.jpg (135.46 KiB) Viewed 435 times
I only added the two pairs of inverters at the top, no supply voltage hack was required at the end.

And here the benchmark for SPI clock = 36 MHz [CPU at 72 MHz, flash wait state = 1, no DMA]

Code: Select all

Benchmark                Time (microseconds)
Screen fill              342010
Text                     33387
Lines                    343988
Horiz/Vert Lines         29240
Rectangles (outline)     17440
Rectangles (filled)      834136
Circles (filled)         203794
Circles (outline)        280142
Triangles (outline)      69080
Triangles (filled)       316971
Rounded rects (outline)  89333
Rounded rects (filled)   933526
and with DMA ("set and forget") in selective mode - only for data lenght >64 (customizable)

Code: Select all

Benchmark                Time (microseconds)
Screen fill              331403
Text                     44321
Lines                    363852
Horiz/Vert Lines         39088
Rectangles (outline)     27382
Rectangles (filled)      334826
Circles (filled)         218763
Circles (outline)        289145
Triangles (outline)      80770
Triangles (filled)       325125
Rounded rects (outline)  101777
Rounded rects (filled)   942529
I have realized one additional issue with using DMA: it is sharing the same data bus to memory with the CPU, so if the CPU has many memory accesses while DMA is running in the background, the CPU is then slowed down by DMA.

User avatar
Pito
Posts: 1109
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 » Wed Jan 11, 2017 6:54 pm

RogerClark wrote:@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 ?
There is an XC9572XL board for $15
https://www.seeedstudio.com/XC9572XL-CP ... p-799.html
and CoolRunner too
https://www.seeedstudio.com/XC2C64A-Coo ... p-800.html

The ring oscillator - in that design you can switch between local oscillator - the ring one, and the external oscillator. As the ring one does around 150MHz, you can measure periods with 6ns resolution. There are a few config options, so you can first measure the ring freq against millis() for example - like calibration. And then you may use calibrated ring oscillator for other measurements.
So the talented people may play. It was meant a toy for talented arduinists interested. Based on above seeed's 9572 board.
For experiments and study I recommend at least the 72 as it is bigger and you can place a lot of stuff inside.
36 is good when you have something ready - like the tft interface for example. But it is an additional level of effort most duinists avoid :)
PS: for $30 you can get a board with Spartan6 FPGA. So, indeed, the above CPLD boards shall cost something like $0.002 then :D
As a pure breakout board without buttons, leds and regulator: 9536=$1, capacitors=$0.20, board from itead=$1.50, all single quantity - that is all :)
Last edited by Pito on Wed Jan 11, 2017 7:06 pm, edited 1 time in total.
Pukao Hats Cleaning Services Ltd.

User avatar
RogerClark
Posts: 5912
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 » Wed Jan 11, 2017 7:06 pm

Pito

Perhaps we should start another thread for this FPGA / CPLD stuff.

stevestrong
Posts: 1137
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 » Wed Jan 11, 2017 9:05 pm

Thanks, Roger.
Just wanted to show 2 pics, how easy is to make the board run at 36MHz.
20170111_211409_1.jpg
20170111_211409_1.jpg (159.92 KiB) Viewed 425 times
There is one wire more than necessary, because I cut one trace which I shouldn't have to.

And here the pill on the back of the board.
20170111_211443_1.jpg
20170111_211443_1.jpg (153.04 KiB) Viewed 425 times
and a youtube video.
Last edited by stevestrong on Fri Jan 13, 2017 9:17 am, edited 1 time in total.

User avatar
Squonk42
Posts: 59
Joined: Thu Dec 29, 2016 9:25 am
Location: Bordeaux, France

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

Post by Squonk42 » Thu Jan 12, 2017 10:05 pm

Anyway, the STM32F103x8 / STM32F103xB datasheet specifies a maximum SPI clock frequency of 18 MHz at ambient temperature.

Of course, you may overclock the SPI and achieve higher speeds, but you take your chances then...

User avatar
RogerClark
Posts: 5912
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 » Thu Jan 12, 2017 11:12 pm

@stevestrong

Looks good. Things are often not to difficult to implement once you have worked out what to do. However its the R&D to work out what to do thats the difficult and time consuming thing.

@Squonk42

Luckily the STM32 SPI speed (and most other parts of the MCU) are operate well beyond its published spec.
Virtually everyone using the ILI9341 display (probably 100+ people) run the SPI at 36Mhz with no problem at all.

I've even accidental run the whole MCU on 5V for several days and it didn't do it any harm !

The general consensus is that the STM32F103 is pretty robust ;-)

victor_pv
Posts: 1258
Joined: Mon Apr 27, 2015 12:12 pm

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

Post by victor_pv » Fri Jan 13, 2017 2:42 am

stevestrong wrote: I have realized one additional issue with using DMA: it is sharing the same data bus to memory with the CPU, so if the CPU has many memory accesses while DMA is running in the background, the CPU is then slowed down by DMA.
That's true, but the whole idea is to use DMA for big transfers that would otherwise take 100% cpu time until complete, so even if the cpu slows down to 50% for heavy RAM access, you still gain 50% cpu time to do other things ;)

Now, for the display, except for drawing blocks, it's proving to be no big advantage and instead a penalty most of the time.
Has anyone posted results of the ILI9143 displays after your changes to the SPI functions?

stevestrong
Posts: 1137
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 » Fri Jan 13, 2017 9:25 am

I did not check in my local version yet (which contains the non-blocking DMA), but I will do it in the next days. The optimized gap-less SPI clock version is already available in my repo, and as a PR for the official repo. Don't know whether Roger managed to work in that.
I am still thinking where should the SPI initialization take place: outside the ILI9486 driver, in setup phase, before or within the driver begin() function?

@Squonk42
Regarding SPI speed, I don't know where you get the information from about the max. 18 MHz.
On page 691 of the RM0008 is written:
" 8 master mode baud rate prescalers (fPCLK/2 max.)"
Meaning, if fPCLK is 72 MHz, which is a "normal" frequency, then obviously we are talking about 36MHz "normal" SPI_1 speed. The max. 18 MHz is valid for SPI_2 only.
Of course, with overclocking one can achieve even higher speeds, which are then outside of specification, but still working, as Roger talked about the robustness of the chip.
Last edited by stevestrong on Fri Jan 13, 2017 9:34 am, edited 1 time in total.

User avatar
Pito
Posts: 1109
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 » Fri Jan 13, 2017 9:34 am

103xx datasheet, DocID14611 Rev 12, p.99
SPI 103.JPG
SPI 103.JPG (83.85 KiB) Viewed 376 times
Pukao Hats Cleaning Services Ltd.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest