TFT Colour LCD controllers with SPI interface

Go To Last Post
68 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have been playing with a very nice 320x240 display on an Arduino shield. It uses a ILI9320 controller and its 8-bit interface. Other displays use 16-bit i/f have a 20x2 pin header that requires an adapter shield for a Mega.

Since any display for an Arduino tends to have its pins split over PORTs, any write functions become a little complex.

So I was wondering about using the SPI i/f of the ILI932x controllers. A 16-bit SPI transfer will take 32 cycles. Whereas a 16-bit PORTx, PORTy transfer could be 4 cycles, a UNO 8-bit split version will be 24 cycles. Some libraries are VERY inefficient, and take 100s cycles per 16-bit.

Most TFT displays on Ebay are designed for parallel 8-bit or 16-bit. Has anyone found one that uses the SPI i/f ? Or even a 16-bit one that can change the mode bits for SPI ?

Most importantly, has anyone experience of using SPI mode on the larger displays? If it works ok, they would make very attractive Arduino shields. And still leave plenty of spare GPIO.

I have ordered a ST7735 160x128 module, but I would prefer a 320x240 display.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you can't find a suitable display could you not just bolt a "slave" AVR onto the back of one to offer an SPI interface? I believe the common term is "back pack".

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Seems like the datasheet for a lot of those controllers shows the controller can be jumpered for parallel, i2c, spi, etc, but the pcboard mfgr selects a mode and straps it for spi and sells it as an spi board. It helps if you have the sch for the board. I have the seeedstudio 320x240 bd that is 8 bit parallel. Need to stuff two bytes into it for 565 rgb. But 6 bits are in one port and 2 bits are in another port. Oh well.

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The "Display Xplained Hardware User's Guide - Atmel Corporation" AVR1909
www.atmel.com/Images/8297.pdf

sez it is 240x320 with SPI interface...

Quote:
3.1 The LCD Module
The LCD module is produced by EDT (Emerging Display Technologies Corp), and is called ET024006DHU. It will be replaced with a new version called ET024008DHU in mid 2010 that have the same outline dimension and same electronics and optical specification.

The LCD module embeds a graphical controller/driver from Himax called HX8347-A. This controller provides several communication interfaces like 8/16bit parallel MCU interface, 16/18bit RGB, and 4-wire serial SPI interface. On the Display Xplained module this has been hardwired to use serial SPI interface.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

A small one
http://www.sainsmart.com/sainsma...

This thread hints at what you requested:
https://www.avrfreaks.net/index.p...

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I played with a 2.4" spi i/f device recently. I got mine from iteadstudio, but it seems they have discontinued it. I found the redraw of the screen a bit slow on the Arduino, so i ported the code to a lpc1769 and cranked the spi up to 25MHz. Much quicker, but still slow for anything reasonably dynamic. Larger resolutions would be slower still i expect.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It takes me 1.2 sec to fill the screen... 76800/1.2-> 64K pix/sec (16Mhz uno)

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

@Bob,

My ILI9320 fills a screen in 90 milliseconds ! I use a modified Adafruit_TFTLCD library. (my pins are arranged differently and I added 9320 to their 9325 and 9328 support)

It is dramatic how slow or fast some of these libraries are.

@Lee,

I have ordered the 1.8" 160x128 serial display. I should be able to compare speed with the larger 320x240 8-bit display.
I looked at the Atmel kit. It seems to be massively overpriced compared to the 8-bit or 16-bit modules.

@kartman,

I have looked at Sparkfun, Adafruit, IteadStudio, Ebay ...
This looks the nearest, but is out of stock. And is only 2.2" 220x176.

Although there are many bare modules with tiny flex connectors, none of them seem to have the IM0, IM1, IM2, IM3 pins available.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Check farnell/element14. They have a kentec qvga display that has the mode selection pins available on the flat cable. I don't know the part number off the top of my head.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

David, is this meeting your requirements: http://www.elecfreaks.com/store/...

A GIF is worth a thousend words   She is called Sylvia (2018), lives at Mint18.3 https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Nard,

Unfortunately, all of those modules use 8-bit or 16-bit interface. Even the raw flex ribbon versions only support 8/16-bit.

As far as I can see, the only modules that use SPI are the 1.8" and 2.2" modules mentioned in earlier posts.

The reason for my 'enquiries' is that an Arduino shield that uses SPI for SD card, TFT display, Touch screen would only use about 3 control lines + 3 SPI pins + 3 chip-selects. i.e. 9 pins.

An enterprising Chinese module maker could sell 320x240 SPI modules to a large market. An enterprising shield maker could produce a shield that works with both UNO and Mega. (and Due, M*crochip clones, ...)

OTOH, the cheap TFT modules seem to conform to a standard 40-pin header. You can use a UNO or Mega adapter shield to enable Arduino 'convenience'. Not as practical as a single shield, and of course uses most of your GPIO.

Kartman has suggested that SPI is noticeably slower on the Arduino than LPC. A lot depends on the library used. When my 1.8" SPI module arrives, I can see for myself. (is China Post going to be 9 days or 35 day wait ?)

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Fantastic displays, very fast, all the interfaces you could want, graphic primitives/fonts/.jpgs/etc onboard ....very expensive

http://www.mmselectronics.co.uk/...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

David wrote:

Quote:
is China Post going to be 9 days or 35 day wait ?
Undefined :( The fast deliveries were within 2 weeks, but the last shipment took 6 weeks. So, .... it depends.

I also wonder if the combination of an AVR and such a large display is a good choice: a 16bit deep picture takes, using SPI @ 4MHz, 300ms, and that's just for the data-transfer between AVR and display.

Nard

A GIF is worth a thousend words   She is called Sylvia (2018), lives at Mint18.3 https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have been pondering on this a while, David. How SPI could be implemented.
After a while I realised that a $35 Mega 2560 Freaduino, plus $28 for TFT 400x240, plus a $ 7.50 shield, provides a fast interface, an AVR with plenty Flash and Ram, touch and SDslot. And still plenty pins left.
Now consider Cliff's suggestion: an AVR backpack, which provides SPI interfacing to a host. $42.50 ($35 + $7.50) would be the max. price for such an AVR backpack. I don't see how that could be done, considering the need for a pretty large AVR. And when done, you still need a host board. I think I would go for above mentioned combo, and make that work as a backpack, in case I would like to connect it to some host board.

Cheers

Nard

A GIF is worth a thousend words   She is called Sylvia (2018), lives at Mint18.3 https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This one from Farnell http://au.element14.com/kentec-e... has SPI interface. (don't worry about the description saying parallel, get the data sheet)

I thought I had posted a video on Vimeo of the SPI mode but can't find it anymore. :roll:

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

@John,

Thanks for the link. This K320QVG model has a 60-way flex ribbon. Unfortunately it is only U.S. stocked and 'out of stock'. It is also fairly expensive for a bare module.

Yes, it appears that most module manufacturers only provide 38-way flex ribbon and hence miss out the SPI lines.

@Nard,

My point was that whereas the chip makers provide several interfaces, the module makers only bring out the parallel lines to a 38-way ribbon. Surely they could bring out all 60 lines? Or possibly just 10 odd lines for SPI. When my 1.8" board arrives, I will see what size ribbon was used. (I hope)

I am sceptical about the backpack idea. I might try it all the same. e.g. a pair of 74HC595s.
Since the driver chips already have SPI option, it seems cack-handed to add SPI to the parallel externally.
OTOH, the parallel bare modules are cheap and available. The 'full-monty' bare modules are rare, expensive and unavailable.

If the idea works, then you would end up with an Arduino shield that is effectively a 320x240 version of the 1.8" 160x128 module. A bare parallel module is $12 and a shield with a couple of shift registers, level shifters, 3V3 regulator would not cost much. I am looking at this from a Chinese point of view. Is the Arduino market worth a special or do they stick with the 40pin header + adapter?

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Have a look at Electronic Assembly

This one is about €60 or €75 with touch.
Looks like a terminal replacement, and gives 8 extra in/outputs as well, plus a beeper. All kinds of serial interfaces. Seems easy programmable.
Datasheet http://www.lcd-module.com/fileadmin/eng/pdf/grafik/edip128-6e.pdf

They have several Color alternatives available.
http://www.lcd-module.com/products.html

MartinM57 wrote:
Fantastic displays, very fast, all the interfaces you could want, graphic primitives/fonts/.jpgs/etc onboard ....very expensive
http://www.mmselectronics.co.uk/...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Precision Design Associates (PDA) TM2800
Displaytech QVGA TFT display.
ILI9320 via SPI.
Atmel maXTouch capacitive touch.
Module mates with an XMEGA Xplained.
PDA also has a module with an XMEGA256A3BU in it (TM2801).
Edit: corrected MCU.

"Dare to be naïve." - Buckminster Fuller

Last Edited: Fri. Mar 15, 2013 - 02:59 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Mouser has this Displaytech SDT028ATFT module that appears to have the SPI pins on its 44-way flex ribbon.

Yes, it appears that the SPI-aware modules are rarer and more expensive.

And there is a market for MCU + display that can provide a fancy user-interface. The intelligent display can use a simple electrical interface to the main system. e.g. SPI

If the hard display work is done by an onboard MCU, it really does not need a fast interface.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ezLCD is one (16 and 32-bit on-board MCUs).
Another are some series from 4D Systems; they have some Arduino shields and such on a 16-bit MCU (IIRC).
Crystalfontz uses a mega2561 in their demonstration boards (with source code IIRC).
Ref.
Crystalfontz, Graphic Display Modules; note - some have SPI.

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

ezLCD is one (16 and 32-bit on-board MCUs).

Three is clearly money to be made here. You take a $20 LCD:

http://www.ebay.com/itm/3-2-QVGA...

stick a $5-$10 micro circuit on the back and get to charge $130. Nice work if you can get it!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

David,

Actually I was just mooching around ebay and found this:

http://www.ebay.co.uk/itm/2-4-in...

I'd not heard of ILI9325 so went Googling and found this:

http://www.adafruit.com/datashee...

Not only is it interesting that it's on the Adafruit website in the first place but most interesting is that the controller (with 176KB of onboard SRAM!) has several power on selectable modes of operation and one of those is SPI!

While 2.4" sounds a bit small I bet if you search ILI9325 at ebay you may find other panels that use that controller.

And it's £4.68!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It gets better by the minute :)
Thanks Cliff

A GIF is worth a thousend words   She is called Sylvia (2018), lives at Mint18.3 https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The ILI932x controllers seem to work very well.

And the Adafruit libraries are massively better written than other offerings. e.g. 10x to 20x faster than UTFT library (and less bugs)

I have purchased the display from your Ebay link. I will let you know how it works. (in a month's time)

Note that many of these modules are not 5V compatible, but my Seeeduino boards are 3.3V / 5V switchable.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Just to note in case anyone's interested that there are "mini stm32" boards that have one of those display and an STM32F103 board bolted on the back:

http://www.ebay.co.uk/itm/MINI-S...

That also looks like quite an interesting combination of things (there's even some AT45 dataflash, a micro SD/MMC socket on there and the STM is a USB device)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
Unfortunately it is only U.S. stocked and 'out of stock'
?? Huh? There is
Quote:
154 in stock for same/next working day delivery
445 deliver in 6 - 7 working days from our Singapore warehouse
for Farnell Australia and you can buy them directly from Kentec (ex AVRFreaks "spammer") maybe a lot cheaper http://www.kentec.com.hk.

They are used widely in security systems here by one company and I helped a colleague designing them into a few of his products.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I may have mentioned this before, but I haven't yet found a cheap TFT module that brings the VSync line out to the connector. This is a bit of a pain if you want to have tear-free screen re-writes. In fact even a register bit that could be polled would probably be good enough.

Four legs good, two legs bad, three legs stable.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If by TFT you also mean colour then the following is not a match (it's monochrome) but does state "It also eliminates sweeping images or "ghosting," because only the part of the image that requires updating needs to be changed."
Updates are entire rows of pixels.
SPI interface.
Sharp Memory LCD, About.

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes. I probably meant "LED backlit colour LCD".
Mea culpa.

Four legs good, two legs bad, three legs stable.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
David,

Actually I was just mooching around ebay and found this:

http://www.ebay.co.uk/itm/2-4-in...

I'd not heard of ILI9325 so went Googling and found this:

http://www.adafruit.com/datashee...

Not only is it interesting that it's on the Adafruit website in the first place but most interesting is that the controller (with 176KB of onboard SRAM!) has several power on selectable modes of operation and one of those is SPI!

While 2.4" sounds a bit small I bet if you search ILI9325 at ebay you may find other panels that use that controller.

And it's £4.68!

But he won't sell it in USA

Free the toes!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

But he won't sell it in USA

http://www.ebay.com/itm/2-8-TFT-...

Same eBay seller ID, with 250k feedback and quite positive.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

But he won't sell it in USA

That's not what the page on ebay says?

Anyway when I search "ILI9325" on ebay.com (the US site) I appear to get lots of potential hits.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

That's not what the page on ebay says?

???
Quote:

Item location: Hong Kong, Hong Kong
Postage to: Americas, Europe, Asia, Australia
Excludes: Central America and Caribbean, South America, Albania, Andorra, Bosnia and Herzegovina, Gibraltar, Guernsey, Iceland, Italy, Jersey, Liechtenstein, Luxembourg, Macedonia, Malta, Moldova, Monaco, Montenegro, San Marino, Serbia, Svalbard and Jan Mayen, Vatican City State, Algeria, Angola, Benin, Botswana, Burkina Faso, Burundi, Cameroon, Cape Verde Islands, Central African Republic, Chad, Comoros, Congo, Democratic Republic of the, Congo, Republic of the, Côte d'Ivoire (Ivory Coast), Djibouti, Egypt, Equatorial Guinea, Eritrea, Ethiopia, Gabon Republic, Gambia, Ghana, Guinea, Guinea-Bissau, Kenya, Lesotho, Liberia, Libya, Madagascar, Malawi, Mali, Mauritania, Mauritius, Mayotte, Morocco, Mozambique, Namibia, Niger, Nigeria, Reunion, Rwanda, Saint Helena, Senegal, Seychelles, Sierra Leone, Somalia, Swaziland, Tanzania, Togo, Tunisia, Uganda, Western Sahara, Zambia, Zimbabwe, Brunei Darussalam, Cambodia, Hong Kong, Laos, Macau, Taiwan, Vietnam, Afghanistan, Armenia, Bangladesh, Bhutan, China, Georgia, India, Japan, Kyrgyzstan, Maldives, Mongolia, Nepal, Pakistan, Tajikistan, Turkmenistan, Uzbekistan, Bahrain, Iraq, Jordan, Kuwait, Lebanon, Oman, Qatar, United Arab Emirates, Yemen, American Samoa, Cook Islands, Fiji, French Polynesia, Guam, Kiribati, Marshall Islands, Micronesia, Nauru, New Caledonia, Niue, Palau, Papua New Guinea, Solomon Islands, Tonga, Tuvalu, Vanuatu, Wallis and Futuna, Western Samoa, Bermuda, Greenland, Mexico, Saint Pierre and Miquelon, United States

It appears you need to ship to Canada as the only part of "Americas" not excluded. :twisted:

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ah, different link. Something is a little "odd" then because the page includes this:

which mentions "Italy" yet Italy is apparently on the exclusion list too?!?

I've never known any HK/China supplier who wasn't willing to ship anywhere as long as it would make them a buck so I'd email the supplier to verify the US situation.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok, I am a wimp. I wanted an SPI display with proper header pins e.g. uses 2mm headers

This cost me $14 and arrived this morning ! (ordered 10 days ago)

I am sure that they will deliver to any country that takes ChinaPost. I never understand the strange Ebay conditions. (you generally find the same item from the same supplier with no conditions)

David.

p.s. I will report back with the SPI speed after I have made a few alterations. Currently it looks rather slow on a 8MHz mega32.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It let me order the other one.

I paid for the faster shipping.

Adafruit libraries: You mean this one?
https://github.com/adafruit/TFTL...

Free the toes!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
Italy is apparently on the exclusion list too?!?
We need to bring this to the attention of Mr Berlusconi....

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Perhaps he only wants orders from countries where the people can pay for it

Free the toes!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

where the people can pay for it

If that were the case I imagine Cyprus would have been top of the exclusion list ;-)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Torby wrote:
It let me order the other one.

I paid for the faster shipping.

Adafruit libraries: You mean this one?
https://github.com/adafruit/TFTL...

Yes, I have been playing with this library. It currently just supports ILI9325 8-bit and HX8347G SPI as used in Adafruit products.

It is dramatically better/faster than UTFT or TFTLCD libraries.

I have added ILI9320 8-bit and ILI9320 SPI (and an iffy SSD1289 8-bit). It flies with a 32MHz Xmega !

Although the 9320 SPI version is slower than an Arduino 8-bit shield version, you only use 4 SPI pins (and a reset). So does not steal all your Arduino Digital and Analog pins !

David.

p.s. Has anyone got good experience with the SSD1289?
I have everything plotting in the correct position on the screen. However I see snow and 'horizontal flyback' lines occasionally. The ILI9320 is steady as a rock.
I presume that I have not got the DisplayControl registers quite right. It only happens after a setAddressWindow() call to fill an area with colour.

The data sheet is fairly daunting !

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Beware, David, I have one of these and some MEGA's coming. Many silly questions will soon follow

Free the toes!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Info about modifying FMark LCD to provide Frame Flyback signal split to separate thread here:

https://www.avrfreaks.net/index.p...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Got one! Now to figure out what to do with it

Lots of pins. Wonder which one's which.

But I'm having a dread fear that it doesn't have the ILI9325 on it.

Attachment(s): 

Free the toes!

Last Edited: Tue. Apr 9, 2013 - 06:28 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Good Luck.

I have always gone for modules with real life header pins.

If you have access to the mode signals, you can choose SPI. Otherwise you need to do a lot of soldering to a lot of GPIO pins.

Is it an ILI932x controller?
Or a SST1289 type?

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I think it's just like this one at Sparkfun. The controler seems to be 9325. Yea, I liked the 4 pound one better too, but he wouldn't sell to USA.

https://www.sparkfun.com/datashe...

Free the toes!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Pretty confident now as the back light LED's are right where the pdf says to find them.

Free the toes!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Torby,

Some high res photos of the FPC and we might be able to work out if that vendors unit can break out any hidden signals :D

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Rez? Oh, we got rez! Not sure what it'll do for you 'cause the chip seems to be inside where you can't see it.

andrewm1973 wrote:
Torby,

Some high res photos of the FPC and we might be able to work out if that vendors unit can break out any hidden signals :D

Attachment(s): 

Free the toes!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Torby,

You can't see where copper hits the die. But you can see what order they go towards it.

That is how I worked out FMark.

Shown is a close up of unknown connection at resistor R3. I have marked in photoshop the known bits of copper. (from tracing from the 37 pin connector)

Also shown is a cut out from page-15 of the ILI9328 data sheet showing the order of the bumps on the die.

Was not rocket science to work out that FMark was the likely suspect. It either had to be FMark or a test pin that the data sheet said should be left open in production.

You can also work out that this display from coldtears has nill hope of having SPI connection as there is no copper anywhere near SDI/SDO.

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Like this one: https://www.sparkfun.com/datashe... ... 320ATP.pdf

Free the toes!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Woa! Mystery!

I guess I better figure out how to make it work with SPI, or solve this mystery:

Where are DB0 and DB9?

The pins are listed twice in the datasheet, and both lists are missing db0 and db9. :roll:

Attachment(s): 

Free the toes!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

treat

1..8 as 0..7

and

10..17 as 8..15

You'll be fine :)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

BTW - I note pin 21 is listed as N/C as usual.

If you give some nice high res photos of both sides of the FPC (like >5 Mpixel and clear) we can work out what the hidden pins are.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Please DO NOT attach a ">5 Mpixel" photo here. Some folks will be bankrupted by it! If you must ... provide a link to it so those who don't mind its size can examine it.

Cheers,

Ross

Ross McKenzie ValuSoft Melbourne Australia

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Oh. Mystery solved. In 16 bit mode, you don't use DB0 or DB9.

If I make a big photo, I'll upload it somewhere, not attach it.

Attachment(s): 

Free the toes!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Dave, I've pirated your thread. Sorry.

And don't order this one, it's not SPI, but it looks like I can use it.

Free the toes!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That is no problem. I got a ILI9320 running in SPI mode quite nicely. It is obviously slower than native 8-bit or 16-bit mode. However it is faster than some Arduino TFT 16-bit libraries!

I would never bother with 16-bit unless I was using a 16-bit (or 32-bit) chip. 8-bit only costs you a SBI,CBI sequence. --- 4 cycles.

Have you got everything working now?

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I layed out a board to connect my display to a Mega 1284. I arranged it for 16 bit. Now, I either etch one here and hand connect many jumpers on the bottom side, or send out. Laying it out was beyond my 1 sided home etching abilities. I included a connector for a NRF24L01, a power supply to run from 2 AA batteries and a boost converter to run the backlight LEDs.

Maybe I'll read again on 8 bit. Perhaps that will simplify the board enough I can make one here. That would also free up some pins on my 1284.

Wonder what it takes to use the touch sensor. It has X+, Y+, X- and Y- connections.

Pretty impressed with what 10 bucks got.

Attachment(s): 

Free the toes!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
Wonder what it takes to use the touch sensor. It has X+, Y+, X- and Y- connections.
Very little. Massage as required by your setup.
#define T_YU PE7	// Pin 37 can be a digital pin
#define T_XL PE6	// Pin 38 can be a digital pin
#define T_YD PF3	// Pin 39 must be an analog pin, use "An" notation!
#define T_XR PF2	// Pin 40 must be an analog pin, use "An" notation!
.
.
void readTouch(void) 
	{
	//Do X
	ADMUX=(1<<REFS0 | ADC_2);	//Conversion on channel 2, AVCC reference,
	PORTE |= (1<<T_YU);		// YU High (V+ YU)
	DDRE |= (1<<T_YU);		// YU output
	PORTF &= ~ (1<<T_YD);	// YD Low (gnd YD)
	DDRF |= (1<<T_YD);		// YD output
	PORTE &= ~ (1<<T_XL);	// XL low (no pull up)
	DDRE &= ~ (1<<T_XL);	// XL input (disconnected)
	PORTF &= ~ (1<<T_XR);	// XR low (no pull up)
	DDRF &= ~ (1<<T_XR);	// XR input (ADC 2 read)
	_delay_ms(1);
	ADCSRA |= (1<<ADSC);					//Start conversion
	loop_until_bit_is_clear (ADCSRA, ADSC);	//Wait for conversion complete
	p_x =  ADCW;

//Do Y
	ADMUX=(1<<REFS0 | ADC_3);	//Conversion on channel 3, AVCC reference,
	PORTE |= (1<<T_XL);		// XL High (V+ XL)
	DDRE |= (1<<T_XL);		// YU output
	PORTF &= ~ (1<<T_XR);	// XR Low (gnd XR)
	DDRF |= (1<<T_XR);		// XR output
	PORTE &= ~ (1<<T_YU);	// YU low (no pull up)
	DDRE &= ~ (1<<T_YU);	// YU input (disconnected)
	PORTF &= ~ (1<<T_YD);	// YD low (no pull up)
	DDRF &= ~ (1<<T_YD);	// YD input (ADC 3 read)
	_delay_ms(1);
	ADCSRA |= (1<<ADSC);					//Start conversion
	loop_until_bit_is_clear (ADCSRA, ADSC);	//Wait for conversion complete
	p_y =  ADCW;
}

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Oh. So you just read it with the A/D. That's handy.

#define T_YU PE7   // Pin 37 can be a digital pin 
 #define T_XL PE6   // Pin 38 can be a digital pin 
 #define T_YD PF3   // Pin 39 must be an analog pin, use "An" notation! 
 #define T_XR PF2   // Pin 40 must be an analog pin, use "An" notation!

Can you interpret T_YU, T_XL, T_YD and T_XR for me? These are where you connected the Y+, X-, Y- and X+ lines?

Free the toes!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

david.prentice wrote:
I would never bother with 16-bit unless I was using a 16-bit (or 32-bit) chip. 8-bit only costs you a SBI,CBI sequence. --- 4 cycles.

David, You are obv. not a lunatic like I am. I am chasing every clock-tick I can :D

I can now clear 320x240 pixels in 10mS and I can draw (diagonal) lines with Bresenham at an average of about 40 ticks per pixel.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
These are where you connected the Y+, X-, Y- and X+ lines?
Correct, the touch panel becomes just 2 "pots" one vertical and the other horizontal.

You supply power to 2 legs and read the "wiper", then do the same for the other "pot".

By the way should we split the thread away from the original SPI version?

David may want to comment on this too.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
I can now clear 320x240 pixels in 10mS and I can draw (diagonal) lines with Bresenham at an average of about 40 ticks per pixel.

That IS impressive. I have the Adafruit library doing a fillscreen() in 52ms and drawing a diagonal line in 172us. - with a SST1289 8-bit on an UNO.

Mind you, I removed a fillscreen optimisation for some reason or other. I might put it back and see the difference.

David.

p.s. I removed the optimisation because it does not work with SPI. The theoretical best time for fillscreen() would be 9.6ms. You achieving 10ms is really good! The theoretical best with SPI is 76.8ms.

Anyway, I don't see fillscreen() as the most important benchmark. Blitting real data from a bitmap or JPEG is more useful test. After all, how useful is a uniformly coloured blank screen?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
Anyway, I don't see fillscreen() as the most important benchmark. Blitting real data from a bitmap or JPEG is more useful test. After all, how useful is a uniformly coloured blank screen?

Well - I am waiting for frame flyback, clearing the screen and then drawing a scene once every 1/30 of a second. So in my application that doesn't show JPGs clear screen is pretty important :D.

Quote:
That IS impressive. I have the Adafruit library doing a fillscreen() in 52ms and drawing a diagonal line in 172us. - with a SST1289 8-bit on an UNO.

Is 172uS a typo? A diagonal line across the screen (0,0,319,239) is 400 pixles long. That only works out at 7 clocks per pixel at 16Mhz.

Mine takes 692uS for a full diagonal line (avg 28 clocks/pixel) using Bresenham. I did experiment with run length line algos, but most of my lines are short and the DIV kills RLL. Even still I don't think I would get down to sub 7 clocks.

Edit: Oops that 692uS was with some other things happening. It's 608uS at 25clk/pixel. Still a long way from 7.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have tested three SPI solutions that seems to correspond to your problem.
The first one can be faster than parallel mode, and the 2 others are compatible with a restricted budget :

1) A $16.99 Sainsmart 3.2" 16-bit touch screen with a SSD1289 controller.

I have used a MCP23S17 I/O expander to provide a SPI connection with an atmega328.

There's a great benefit with the I/O expander : you don't have to send again the 16 bits of data when it remains the same.
For a fillscreen (or fill windows), you simply have to send the color data onece and then to toggle CS for each pixel.

An unoptimized fillscreen takes 9.6ms. And with a 30 levels loop unrolling optimization a fillscreen takes 5,2 ms.

2) A $14 Thaoyu Electronics 2.8" SPI touch screen (model HY28A LCDB)

It's based on a ILI9320 controller. Performance is low due to SPI limitations but yon can improve it by using your own SPI implementation.

Standard implementation relies on such a transfer function :

  /// Transfers one byte over the SPI bus and receives one byte from slave
  /// @param[in] data to send
  /// @return received data
  static uint8_t Transfer(uint8_t data)
  {
    DataRegister::Assign(data);
    while (!TransferCompleted()) {}
    return DataRegister::Get();
  }
  
  /// Tests if the last transfer is complete
  /// @return true if last transfer is complete
  static bool TransferCompleted()
  {
    return (StatusRegister::TestBits(1<<SPIF));
  }

Defining a simpler asynchronous function :

 /// Transfers one byte over the SPI bus without waiting for completion
  /// @param[in] data to send
  static void TransferAsync(uint8_t data)
  {
    DataRegister::Assign(data);
  }

gives a good opportunity to perform graphics computations during the SPI transfer completion.

3) A $6.99 EastRising 2.8" SPI LCD Module
This module is based on a ILI9341 controller.

It's a very affordable solution but with it's tiny FPC-connector, I had a lot of difficulties to connect it and to make it work reliably.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The ILI9341 is a lovely controller. It handles rotation seamlessly.
With the ILI9320, ILI9325 you have to transform your X, Y coordinates in software.

Have you looked at the http://www.ebay.co.uk/itm/1PC-2-2-Inch-SPI-TFT-LCD-Serial-Port-Module-Display-ILI9341-5V-3-3V-New-/380708838265?pt=UK_BOI_Electrical_Components_Supplies_ET&hash=item58a403db79 modules?

Ok, there is no touchscreen but you get a SD Card socket.

As far as I can see, all makes of TFT controller have multiple interface types. However, you can't always get at the IM# configuration pins.

I can't see any point in using a SPI bus-expander when you could use native SPI on the controller in the first place !

But yes, you can do the "fillScreen" optimisation if you can provide the colour on a 16-bit parallel bus.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

david.prentice wrote:

Have you looked at the ... modules?

Yes, I have one of these modules but I have paid twice your price !

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have two of those modules. I paid more for the first one. (but not 2x)

David.