Debugging BuyDisplay ILI9341 ER-TFT028-4 320x240 touchscreen

Status
Not open for further replies.

bboyes

Well-known member
On a current project we need a reliable source for a small color touchscreen to be used for maintenance and service purposes. Plug it in to see what the system is really doing. The public user interface is a 2x16 character LCD, so very limited, and we don't want to display diagnostic details on it. We did a custom board for one thing to work with a 24" cable from the main board (which is relatively inaccessible, so our design uses 74VHC125 buffers and the signals look good on a scope.) Our board will accomodate either the resistive or capacitive touch versions of the display.

We need initially a few hundred a year, possibly a few thousand if this idea gets used on a future project. Since the PJRC and eBay ILI9341 displays we tested have good screen quality and are inexpensive and reliable, and there is already a good support library from Adafruit (we bought displays from them too) and PJRC (ILI9341_t3) that seemed like a logical starting point. However the eBay displays are poorly packaged (recent order had 4/5 received with cracked screens) and gray-market vendors on eBay are never a reliable source for anything. Some searching led us to BuyDisplay and they appear to be a legitimate, good quality vendor. Their order arrived packaged very professionally. Other vendors include DisplayTech (DT028ATFT-TS) which also uses the ILI9341. Sadly there seem to be no standards for pinouts or tail length, so you can't easily make a board which works with a variety of vendors.

So I'm debugging a BuyDisplay ER-TFT028-4 2.8" color touchscreen with ILI9341 controller. But it does not act the same as the PJRC and eBay 2.8" touchscreens with ILI9341.

I am using ILI9341_t3, XPT2046_Touchscreen and SPI libraries with a Teensy 3.2 (48 MHz, Fast) and custom board. The BuyDisplay res touch does not have the XPT2046 built in so we have one on our board actually the ADS7843 which is supposed top be identical but may not be).

I am also testing one of the eBay ILI9341 displays with short test leads from our board header, just as a sanity check, and it works properly. So I expect the BuyDisplay to act the same... but no. It sometimes doesn't start up - blank white screen. Other times it will if I give it a pushbutton reset (how can this be different from the TyQt Teensy reset?).

My code drives a reset signal to the display (now mapped into the ILI9341_t3 constructor), and that signal looks good on a 'scope. All the signals look good on the BuyDisplay end of our buffered cable.

Slowing SPI SCK to 16 MHz (see this thread about that) makes the BuyDisplay much better behaved. I can't see the actual display driver chip on it, so it could be a different/slower version of the ILI9341.

Does anyone else have any experience with the BuyDisplay ILI9341 displays?
 
Last edited:
But it does not act the same as the PJRC and eBay 2.8" touchscreens with ILI9341.

The ILI9341 controller has pins which configure which interface mode it uses. On this display, it might be signals IM0 to IM3 on pins 6-9. You will need to connect those pins to configure the ILI9341 for "4 wire SPI" mode.

Have you tried asking BuyDisplay? It is their product, afterall. Yeah, I know the chances of useful support from these Chinese vendors is pretty much zero, but still I'm curious to hear how they answer, if they bother to reply at all.
 
Astonished by ILI9341 data sheet

Well there is more to this saga than meets the eye. Yes, the IMX pins are correct for 4-wire SPI. I can write to the display, just not reliably. I'm often one to say "RTFM", so I took my own advice -- imagine my astonishment to find that in the ILI9341 data sheet v1.10, page 238 (download here) (which BTW is annoyingly locked and pdfunlock.com has no effect so I can't highlight the pertinent data in the following image)
ILI9341_4WireSPITiming_2017-05-14_17-11-06.jpg the minimum read SPI clock period is 150 nsec, or 6.67 MHz! Writes are (oddly) faster at 10 MHz. Why should they differ so much? It's stranger than that: the (read cycle) high and low SCK are 60 nsec each so 60 + 60 = 120 but the min is 150 nsec. If this is to be believed then the eBay displays happen to be capable of much faster clocking. Which implies not all "ILI9341" are created equal.

There is also a very detailed and rather quirky (multiple 120 msec delays) initialization example so I have some work ahead before I can claim to understand this. The BuyDisplay site actually says the display controller is the ILI9341 "or equivalent" so they could be using a clone which isn't.

Also the "compatible" ADS7843 we used and the XPT2046 on the eBay displays are very different. So "compatible" here does not mean "runs given XPT2046 code with the same result". I ordered some real XPT2046 on eBay (couldn't find a US distrib), in the meantime we pulled one off a cracked eBay display.
 
Yes - I know in the ili9341_t3 and variant drivers, that we pass a slower speed in the beginTransaction call for read operations, like read pixel.

I always love the or equivalent... Might be a completely different chip set...
 
Measured SPICLOCK values

I have a scope set up triggering on the display CS and here is what I see for different SPICLOCK settings in ILI9341_t3.cpp:
Code:
// Teensy 3.1 can only generate 30 MHz SPI when running at 120 MHz (overclock)
// At all other speeds, SPI.beginTransaction() will use the fastest available clock
//  6600000 gives 6 Mhz SCK
// 10000000 gives 9.6 MHz SCK
// 30000000 gives 24 MHz Teensy 3.2, 48 MHz, Fast << default
#define SPICLOCK 6600000

The default SPICLOCK tries to drive the ILI9341 way faster than it is rated. Triggering the scope multiple times I don't see it ever running slower than 24 MHz. On some displays (eBay and PJRC) it works all the time, on others, not so much. Mostly the problems I see are at startup: colored bands across the screen when it should be cleared to black. Or it starts up as blank white and nothing ever appears, implying failed initialization. Interestingly, the touch controller SPI is fixed at 2 MHz. I don't see any significant difference in SCK when D/C is high or low. Even at 6.6 MHz SCK, the BuyDisplay LCD doesn't always initialize. Usually a pushbutton reset brings it around (something else to look investigate).

The ILI9341 datasheet at Adafruit is even older, 1.02, so 1.10 may be the current version and SPI clock has not changed across those versions.

Next steps: try the recommended intialization code.
 
With 3.3V power, every ILI9341 we've ever tested works well (with 24 MHz SPI clock). Every ILI941 display we sell gets tested. I'm pretty sure we're in the thousands now...
 
With 3.3V power, every ILI9341 we've ever tested works well (with 24 MHz SPI clock). Every ILI941 display we sell gets tested. I'm pretty sure we're in the thousands now...

We've never seen an issue with the ones from you or eBay at 24 Mhz. What sort of reject rate do you get from testing? Or shipping damage?

It's weird how these BuyDisplay are the "same" but different. I'll get to the bottom of this, this week, if other priorities allow.
 
What sort of reject rate do you get from testing? Or shipping damage?

Typically a few pieces per 100 are rejected. Occasionally we get a defect-free batch, but occasionally a batch will be much worse. For Teensy boards we make, Robin collects very detailed info about every failure. She does analysis against which batches of PCBs, which builds by the contract manufacturer, and even which buys of most of the components were used. But for stuff we buy, test and resell like these displays, not much info gets collected.

A good number of defects are obviously damaged from handling, like scratched or cracked screens (which I suspect occurs before shipping). Some rejects have perfectly fine display but the touchscreen doesn't work. We've even found a few with backwards touchscreens. A good number just simply don't work, usually with the screen completely black or completely white.

Would you like to further diagnose these displays? Turns out we've been saving the rejects for quite some time. There's a pretty good number, feels like at least 8 pounds of them in a box. If you really will do tests on them and post the results, I could send you some or all of the rejects.
 
Would you like to further diagnose these displays? Turns out we've been saving the rejects for quite some time. There's a pretty good number, feels like at least 8 pounds of them in a box. If you really will do tests on them and post the results, I could send you some or all of the rejects.

Interesting offer, maybe in a few weeks once this product is shipping and my analysis code is a lot better.
 
Some breakthrough! BuyDisplay touchscreen working as it should.

Finally tonight we have a BuyDisplay touchscreen, on the end of a 36" ribbon cable (!), working properly, with our custom board. There are still some open questions, which I will present (along with findings) here, but for now I just wanted to announce that the hardware seems to be working. This is with a SPI clock of 10 MHz for writes and 6.7 MHz for reads, and the stock ILI9341_t3 library with just the SPI clock changes. The touchscreen is also behaving.

Also BuyDisplay tech support did respond to emails, so that is a result much in their favor.
 
Wow, that's a very long cable for fast SPI.

Are you using series resistors to sort-of impedance match to driving the cable? Have you used a scope to look at the signal quality at both ends? It's possible to get ringing, overshoot, crosstalk, and all sorts of other signal quality problems when coupling TTL level signals to such long wires.
 
Wow, that's a very long cable for fast SPI.

Are you using series resistors to sort-of impedance match to driving the cable? Have you used a scope to look at the signal quality at both ends? It's possible to get ringing, overshoot, crosstalk, and all sorts of other signal quality problems when coupling TTL level signals to such long wires.

Yes to all the above. The signals look good. As long as all the signals meet setup and hold with SCK, it should work. This cable is a design requirement so we did try to consider all that in the design. I wish we had gone to a bigger cable with grounds between every signal. We might do that in future rev.
 
It's working: Buy Display ILI9341 2.8" touchscreen over 36" of ribbon cable

Update on this: it's working reliably. Over 36" of 100-mil ribbon cable. There turned out to be a couple of issues. We used a fast cable buffer with short rise and fall times: 74VHC125. This turned out to be too fast. The touch interrupt signal was coupling into adjacent wires and causing issues. Plus the clock frequency of the library was higher than the data sheet of the display says it can run. So what we did by hacking the board we have is
  1. Change to a slower buffer with lower edge rates: 74HCT125
  2. Change ribbon cable signal assignment so there are more isolating grounds between signals
  3. Change to a 20c cable (from 16) so there can be more grounds
  4. Series impedance matching resistors at source of all drivers vs just clock and data
  5. Use the real XPT2046 resistive touch ADC, it's not the same as the ADS7843, though it claims to be. Probably something minor there we could find and patch.
  6. Slow SPI clock down to meet the max data sheet values for the XPT2046 and the ILI9341
We spun a new board with these changes and are assembling it now.
 
Status
Not open for further replies.
Back
Top