Highly optimized ILI9341 (320x240 TFT color display) library

Hi @mjs513 - I've got family here for a few days, but after that I'll take a look :) I have a fix for the speed that will make it actually faster than the standard non ant-aliased font rendering, and I'll also debug the scrolling. I realised that I haven't published the script to create anti-aliased fonts either, so I'll do that too!

@KurtE - fantastic, thank you :) In my libraries I typedef ILI9341_t3_font_t as packedbdf_t so that it isn't named after a display. What do you think of this strategy going forward?
 
Scripts and instructions to create packed BDF anti-aliased fonts here:
https://github.com/projectitis/packedbdf

Full description of packedbdf_t data type also in the repo. Many thanks to Paul, spook and others for their initial work on all this material!
note: packedbdf_t and ILI9341_t3_font_t are the same thing.
 
I incorporated the changes into my copy of the ILI9341_t3 library and the fonts do look nice - but as you said does take a bit longer but the quality is nicer especially for the larger fonts. I did test with the scrolltest.ino sketch but the fonts didn't seem to work as well but I don't have time to debug right now maybe later. But it does work.

@mjs513 I have updated my branch of Paul's ILI9341_t3 library with more efficient anti-alias rendering. Its about 25% faster than the standard non-anti-aliased rendering!
Normal rendering: 14971
Anti-aliased rendering: 11551

I'll take a look at what's happening with scrolltest now (on KurtE's t3n version).

EDIT: Have made a new example in my version of _t3n. I just had to change the call to setTextColor to also specify the background color.

It still looks slightly wrong when the text is printed on the green bar at the bottom of the white box - the text that extends into the white box still has a green background color behind it. Since I'm not entirely sure what your intention is with scrolltest, I'll leave it at that for now and let you look into it if it's a problem?
 
Last edited:
Wow. 4/24/19 was the last update on this thread?

What about T4 and ili9341_t3? Is there an ILI9341_t4 I'm missing somewhere?
 
HI All,
I'm relatively new here, just tried this library on the T4 but just getting a white screen. If I use the adafruit library with the same wiring and pin assignments it works fine.
Has anybody had this working with a t4 yet?

thanks in advance
Tony
 
HI All,
I'm relatively new here, just tried this library on the T4 but just getting a white screen. If I use the adafruit library with the same wiring and pin assignments it works fine.
Has anybody had this working with a t4 yet?

thanks in advance
Tony

Yes I have it working...

It would help if you maybe gave a little more details, like, what version of Arduino and Teensyduino you are using? Platform maybe although maybe not so much in this case.

But more importantly more details on how you have it wired in? Which display are you using...
Which sketch and how is it configured? i.e. does your wiring match for MOSI, MISO, SCL as well as DC and CS? Do you have RST connected to a pin? If so do you specify it in the constructor and does it match your wiring
 
I can also confirm it definitely does work.

If I use the adafruit library with the same wiring and pin assignments it works fine.

Adafruit's libraries support more pin combinations. Many of their libs support almost any pins, using slow GPIO access to the pins rather than hardware SPI. So one possible explanation is you may have used a pin assignment that's not supported by the optimized library, but works with Adafruit's lib because of their support for slow access using any pins. But really, that's just a blind guess, since I can't see your hardware & wiring, can't see your code or screen.
 
I also have it working but my setup on SPI0 required 100 ohm series resistors on MOSI, MISO and SCK at the Teensy end. I also share SPI0 with touch (XPT2046) and SD card through the same resistors, all working properly.
 
I cannot even compile ILI9341_t3 graphicstest example.
Isn't it compatible with T4 (or teensyduino 1.51)?

Am i missing something?

PS: Adafruit GFX library is installed. BTW using Adafruit ILI9341.h and their own graphicstest example compiles and works just fine.

Code:
C:\Users\Thanos\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h: In member function 'void ILI9341_t3::waitFifoNotFull()':

C:\Users\Thanos\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h:178:9: error: 'KINETISK_SPI0' was not declared in this scope

    sr = KINETISK_SPI0.SR;

         ^

C:\Users\Thanos\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h: In member function 'void ILI9341_t3::waitFifoEmpty()':

C:\Users\Thanos\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h:187:9: error: 'KINETISK_SPI0' was not declared in this scope

    sr = KINETISK_SPI0.SR;

         ^

C:\Users\Thanos\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h: In member function 'void ILI9341_t3::waitTransmitComplete()':

C:\Users\Thanos\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h:193:12: error: 'KINETISK_SPI0' was not declared in this scope

   while (!(KINETISK_SPI0.SR & SPI_SR_TCF)) ; // wait until final output done

            ^

C:\Users\Thanos\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h:193:31: error: 'SPI_SR_TCF' was not declared in this scope

   while (!(KINETISK_SPI0.SR & SPI_SR_TCF)) ; // wait until final output done

                               ^

C:\Users\Thanos\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h:194:9: error: 'KINETISK_SPI0' was not declared in this scope

   tmp = KINETISK_SPI0.POPR;                  // drain the final RX FIFO word

         ^

C:\Users\Thanos\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h: In member function 'void ILI9341_t3::writecommand_cont(uint8_t)':

C:\Users\Thanos\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h:197:3: error: 'KINETISK_SPI0' was not declared in this scope

   KINETISK_SPI0.PUSHR = c | (pcs_command << 16) | SPI_PUSHR_CTAS(0) | SPI_PUSHR_CONT;

   ^

C:\Users\Thanos\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h:197:67: error: 'SPI_PUSHR_CTAS' was not declared in this scope

   KINETISK_SPI0.PUSHR = c | (pcs_command << 16) | SPI_PUSHR_CTAS(0) | SPI_PUSHR_CONT;

                                                                   ^

C:\Users\Thanos\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h:197:71: error: 'SPI_PUSHR_CONT' was not declared in this scope

   KINETISK_SPI0.PUSHR = c | (pcs_command << 16) | SPI_PUSHR_CTAS(0) | SPI_PUSHR_CONT;

                                                                       ^

C:\Users\Thanos\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h: In member function 'void ILI9341_t3::writedata8_cont(uint8_t)':

C:\Users\Thanos\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h:201:3: error: 'KINETISK_SPI0' was not declared in this scope

   KINETISK_SPI0.PUSHR = c | (pcs_data << 16) | SPI_PUSHR_CTAS(0) | SPI_PUSHR_CONT;

   ^

C:\Users\Thanos\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h:201:64: error: 'SPI_PUSHR_CTAS' was not declared in this scope

   KINETISK_SPI0.PUSHR = c | (pcs_data << 16) | SPI_PUSHR_CTAS(0) | SPI_PUSHR_CONT;

                                                                ^

C:\Users\Thanos\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h:201:68: error: 'SPI_PUSHR_CONT' was not declared in this scope

   KINETISK_SPI0.PUSHR = c | (pcs_data << 16) | SPI_PUSHR_CTAS(0) | SPI_PUSHR_CONT;

                                                                    ^

C:\Users\Thanos\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h: In member function 'void ILI9341_t3::writedata16_cont(uint16_t)':

C:\Users\Thanos\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h:205:3: error: 'KINETISK_SPI0' was not declared in this scope

   KINETISK_SPI0.PUSHR = d | (pcs_data << 16) | SPI_PUSHR_CTAS(1) | SPI_PUSHR_CONT;

   ^

C:\Users\Thanos\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h:205:64: error: 'SPI_PUSHR_CTAS' was not declared in this scope

   KINETISK_SPI0.PUSHR = d | (pcs_data << 16) | SPI_PUSHR_CTAS(1) | SPI_PUSHR_CONT;

                                                                ^

C:\Users\Thanos\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h:205:68: error: 'SPI_PUSHR_CONT' was not declared in this scope

   KINETISK_SPI0.PUSHR = d | (pcs_data << 16) | SPI_PUSHR_CTAS(1) | SPI_PUSHR_CONT;

                                                                    ^

C:\Users\Thanos\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h: In member function 'void ILI9341_t3::writecommand_last(uint8_t)':

C:\Users\Thanos\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h:210:3: error: 'KINETISK_SPI0' was not declared in this scope

   KINETISK_SPI0.SR = SPI_SR_TCF;

   ^

C:\Users\Thanos\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h:210:22: error: 'SPI_SR_TCF' was not declared in this scope

   KINETISK_SPI0.SR = SPI_SR_TCF;

                      ^

C:\Users\Thanos\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h:211:67: error: 'SPI_PUSHR_CTAS' was not declared in this scope

   KINETISK_SPI0.PUSHR = c | (pcs_command << 16) | SPI_PUSHR_CTAS(0);

                                                                   ^

C:\Users\Thanos\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h: In member function 'void ILI9341_t3::writedata8_last(uint8_t)':

C:\Users\Thanos\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h:216:3: error: 'KINETISK_SPI0' was not declared in this scope

   KINETISK_SPI0.SR = SPI_SR_TCF;

   ^

C:\Users\Thanos\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h:216:22: error: 'SPI_SR_TCF' was not declared in this scope

   KINETISK_SPI0.SR = SPI_SR_TCF;

                      ^

C:\Users\Thanos\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h:217:64: error: 'SPI_PUSHR_CTAS' was not declared in this scope

   KINETISK_SPI0.PUSHR = c | (pcs_data << 16) | SPI_PUSHR_CTAS(0);

                                                                ^

C:\Users\Thanos\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h: In member function 'void ILI9341_t3::writedata16_last(uint16_t)':

C:\Users\Thanos\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h:222:3: error: 'KINETISK_SPI0' was not declared in this scope

   KINETISK_SPI0.SR = SPI_SR_TCF;

   ^

C:\Users\Thanos\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h:222:22: error: 'SPI_SR_TCF' was not declared in this scope

   KINETISK_SPI0.SR = SPI_SR_TCF;

                      ^

C:\Users\Thanos\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h:223:64: error: 'SPI_PUSHR_CTAS' was not declared in this scope

   KINETISK_SPI0.PUSHR = d | (pcs_data << 16) | SPI_PUSHR_CTAS(1);

                                                                ^
 
My mistake (the above); I had downloaded and installed the latest ILI9341_t3 via IDE's library manager instead using the one that was already installed by teensyduino 1.51.
That compiles and works fine on T4.

Sorry for the false alarm! :)
 
Same thing. I can't compile this library. To update is the easiest thing to do just to grab a new teensyduino?

Code:
#include <Adafruit_GFX.h>
#include <ILI9341_t3.h>


void setup() {

}

void loop() {

}

Thanks!

-jim lee
 
Update to above..

D-loaded fresh arduino and the new teensyduino. Mac OS 10.13.6

Same result.

Code:
Multiple libraries were found for "Adafruit_GFX.h"/var/folders/wt/mcbdk5yn5wz6z1zcpf20xvzw0000gn/T/arduino_build_493687/libraries/ILI9341_t3/ILI9341_t3.cpp.o: In function `Adafruit_GFX_Button::drawButton(bool)':

 Used: /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/Adafruit_GFX
 Not used: /Users/jimlee/Documents/Arduino/libraries/Adafruit_GFX_Library
/Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/ILI9341_t3/ILI9341_t3.cpp:1851: multiple definition of `Adafruit_GFX_Button::drawButton(bool)'
/var/folders/wt/mcbdk5yn5wz6z1zcpf20xvzw0000gn/T/arduino_build_493687/libraries/Adafruit_GFX/Adafruit_GFX.cpp.o:/Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/Adafruit_GFX/Adafruit_GFX.cpp:1587: first defined here
/Applications/Teensyduino.app/Contents/Java/hardware/tools/arm/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld: Disabling relaxation: it will not work with multiple definitions
/var/folders/wt/mcbdk5yn5wz6z1zcpf20xvzw0000gn/T/arduino_build_493687/libraries/ILI9341_t3/ILI9341_t3.cpp.o: In function `Print::flush()':
/Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/ILI9341_t3/ILI9341_t3.cpp:1377: multiple definition of `Adafruit_GFX_Button::contains(short, short)'
/var/folders/wt/mcbdk5yn5wz6z1zcpf20xvzw0000gn/T/arduino_build_493687/libraries/Adafruit_GFX/Adafruit_GFX.cpp.o:/Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/Print.h:61: first defined here
collect2: error: ld returned 1 exit status
Error compiling for board Teensy 3.2 / 3.1.

Also, what is this new way of doing things? teensyduino.. Is it a replacement of the IDE? Because that's the way it seems to be acting on my machine. It has the same icon as the IDE, it runs like the IDE. Do I still need the original IDE? Confused here.

-jim lee
 
Hello, I'm having some problems with the combination of ILI9341_t3n, TFT, Touch on the Teensy LC and wonder if I'm missing something.

The road so far:

1. purchase the DISPLAY_ILI9341_TOUCH from pjrc
2. come to learn that the ILI9341_t3 doesn't work with Teensy_LC
3. relieved to find that the Adafruit display library does work, even with SPI mode
4. run the example ino ILI9341Test (from XPT2045_Touchscreen/examples) successfully
5. get disappointed by flickering
6. discover that ILI9341_t3n offers a solution to the flickering problem.
6a. Become impressed that I can get cool fonts, fast code and anti-flicker working with Teensy_LC (kudos to @KurtE and others for this!)
7. attempt to get the new anti-flickering working with touch screen
7a. fail - feels like an SPI-conflict of some sort, result
7b. instrument code to switch between the variety of running mode
7c. reach out to the sages for advice

Any suggestions are greatly appreciated. (I did try touch in both IRQ and no-IRQ mode, fwiw).
Kind regards - Dana


here's the modified code example (running on latest teensyduino (1.53 beta3) atop arduino 1.8.12)

Code:
#include <XPT2046_Touchscreen.h>
#include <SPI.h>

#define TEST_DISPLAY 1
#define USE_T3N 0

#define TOUCH_IRQ_PIN  255 /* vs 2 */
#define TOUCH_CS_PIN  8
#define DISPLAY_CS_PIN 10
#define DISPLAY_DC_PIN  21
// MOSI=11, MISO=12, SCK=13

#if USE_T3N
#include <ILI9341_t3n.h>
#include <ili9341_t3n_font_Arial.h>
ILI9341_t3n tft = ILI9341_t3n(DISPLAY_CS_PIN, DISPLAY_DC_PIN);
#else
#include <Adafruit_ILI9341.h>
Adafruit_ILI9341 tft(&SPI, DISPLAY_DC_PIN, DISPLAY_CS_PIN);
#endif


XPT2046_Touchscreen ts(TOUCH_CS_PIN, TOUCH_IRQ_PIN);

void setup() 
{
  Serial.begin(38400);
  tft.begin();
  tft.setRotation(1);
  tft.fillScreen(ILI9341_BLACK);
  tft.setTextSize(4);
  
  ts.begin();
  ts.setRotation(1);
  while (!Serial && (millis() <= 1000));
}

boolean wastouched = true;

void loop() {
  boolean istouched = ts.touched();
  if (istouched) {
    TS_Point p = ts.getPoint();
    if (!wastouched) {
      #if TEST_DISPLAY
      tft.fillScreen(ILI9341_BLACK);
      tft.setTextColor(ILI9341_YELLOW);
      #if USE_T3N
      tft.setFont(Arial_60);
      #endif
      tft.setCursor(60, 80);
      tft.print("Touch");
      #endif
      Serial.println("Touch");
    }
    #if TEST_DISPLAY
    tft.fillRect(100, 150, 140, 60, ILI9341_BLACK);
    tft.setTextColor(ILI9341_GREEN);
    #if USE_T3N
    tft.setFont(Arial_24);
    #endif
    tft.setCursor(100, 150);
    tft.print("X = ");
    tft.print(p.x);
    tft.setCursor(100, 180);
    tft.print("Y = ");
    tft.print(p.y);
    #endif
    Serial.print(", x = ");
    Serial.print(p.x);
    Serial.print(", y = ");
    Serial.println(p.y);
  } else {
    if (wastouched) {
      #if TEST_DISPLAY
      tft.fillScreen(ILI9341_BLACK);
      tft.setTextColor(ILI9341_RED);
      #if USE_T3N
      tft.setFont(Arial_48);
      #endif
      tft.setCursor(120, 50);
      tft.print("No");
      tft.setCursor(80, 120);
      tft.print("Touch");
      #endif
      Serial.println("no touch");
    }
  }
  wastouched = istouched;
  delay(100);
}
 
If needed, I can probably wire something up...

But the first thing I would try, is something simple, which should be in the touch paint, but does not look like it is...

That is if you are using multiple CS pins on SPI buss, you should make sure the others are logically deasserted before you start initialization...
Could be done with Pull Up resistors or first try changing setup:

Code:
void setup() 
{
  Serial.begin(38400);
  [COLOR="#FF0000"]pinMode(TOUCH_CS_PIN, OUTPUT);
  digitalWriteFast(TOUCH_CS_PIN, HIGH);[/COLOR]
  tft.begin();
  tft.setRotation(1);
  tft.fillScreen(ILI9341_BLACK);
  tft.setTextSize(4);
  
  ts.begin();
  ts.setRotation(1);
  while (!Serial && (millis() <= 1000));
}

And see if that solves the issue.
 
Hi Kurt, thanks for the response! I did try adding the two lines to the setup and still see the same behavior in both IRQ and non-IRQ touch modes. I also tried a pull-up resistor on TOUCH_CS_PIN, then on both CS pins. I also added a few more print statements and find that the problem seems to be that this line:

Code:
ts.touched();

is blocking/hanging on the second call. In other words, a print statement at the top of loop only fires twice.

This implies that the sequence of events is as follows:

1. initialize screen (okay)
2. initialize touch (okay)
3. loop 1:
- check touched (returns false, so okay)
- screen draw "No Touch", end loop (screen shows the right thing)
4. loop 2:
- check touched (hangs)

Is it possible that the SPI transaction is still being held-open (whatever that might mean) after the line:
Code:
 tft.print("Touch");
.

Finally: I'm unsure I understand the full implications of your statement:
using multiple CS pins on SPI bus
. I'm happy to try alternate CS pins, but I can't afford the pins to assign a different SPI bus to both the screen and the touch.
 
More evidence: reorganizing the code, i see that ts.touched() hangs after the first post-init tft activity. (I tried both fillScreen and print). I've just added the modified setup in which the expected line "touched" (or "not touched") doesn't appear.

regards, Dana

Code:
void setup() 
{
  Serial.begin(38400);
  pinMode(TOUCH_CS_PIN, OUTPUT);
  digitalWriteFast(TOUCH_CS_PIN, HIGH);
  
  tft.begin();
  tft.setRotation(1); /* 1: m2 rotation, right edge is connector */
  tft.fillScreen(ILI9341_BLACK);
  tft.setTextSize(4);
  
  ts.begin();
  ts.setRotation(3); /* 3: xmin->xmax, ymin is top, ymax is bottom */
  while (!Serial && (millis() <= 1000));
  Serial.println("start");

  /* tft activity after ts.begin causes touched to hang */
  #if USE_T3N
  tft.setFont(Arial_60);
  tft.print("hello");
  delay(2000);
  tft.fillScreen(ILI9341_BLACK);
  delay(50);
  boolean istouched = ts.touched();
  Serial.println(istouched ? "touched" : "not touched");
  #endif
}
 
Note: I hooked up an LC, although slightly different pins...

Code:
#include <XPT2046_Touchscreen.h>
#include <SPI.h>

#define TEST_DISPLAY 1
#define USE_T3N 0

#define TOUCH_IRQ_PIN  255 /* vs 2 */
#define TOUCH_CS_PIN  7
#define DISPLAY_CS_PIN 10
#define DISPLAY_DC_PIN  9
// MOSI=11, MISO=12, SCK=13
#define DISPLAY_RESET_PIN 8

#if USE_T3N
#include <ILI9341_t3n.h>
#include <ili9341_t3n_font_Arial.h>
ILI9341_t3n tft = ILI9341_t3n(DISPLAY_CS_PIN, DISPLAY_DC_PIN, DISPLAY_RESET_PIN);
#else
#include <Adafruit_ILI9341.h>
Adafruit_ILI9341 tft(&SPI, DISPLAY_DC_PIN, DISPLAY_CS_PIN);
#endif


XPT2046_Touchscreen ts(TOUCH_CS_PIN, TOUCH_IRQ_PIN);

void setup() 
{
  Serial.begin(38400);
  tft.begin();
  tft.setRotation(1);
  tft.fillScreen(ILI9341_BLACK);
  tft.setTextSize(4);
  
  ts.begin();
  ts.setRotation(1);
  while (!Serial && (millis() <= 1000));
}

boolean wastouched = true;

void loop() {
  boolean istouched = ts.touched();
  if (istouched) {
    TS_Point p = ts.getPoint();
    if (!wastouched) {
      #if TEST_DISPLAY
      tft.fillScreen(ILI9341_BLACK);
      tft.setTextColor(ILI9341_YELLOW);
      #if USE_T3N
      tft.setFont(Arial_60);
      #endif
      tft.setCursor(60, 80);
      tft.print("Touch");
      #endif
      Serial.println("Touch");
    }
    #if TEST_DISPLAY
    tft.fillRect(100, 150, 140, 60, ILI9341_BLACK);
    tft.setTextColor(ILI9341_GREEN);
    #if USE_T3N
    tft.setFont(Arial_24);
    #endif
    tft.setCursor(100, 150);
    tft.print("X = ");
    tft.print(p.x);
    tft.setCursor(100, 180);
    tft.print("Y = ");
    tft.print(p.y);
    #endif
    Serial.print(", x = ");
    Serial.print(p.x);
    Serial.print(", y = ");
    Serial.println(p.y);
  } else {
    if (wastouched) {
      #if TEST_DISPLAY
      tft.fillScreen(ILI9341_BLACK);
      tft.setTextColor(ILI9341_RED);
      #if USE_T3N
      tft.setFont(Arial_48);
      #endif
      tft.setCursor(120, 50);
      tft.print("No");
      tft.setCursor(80, 120);
      tft.print("Touch");
      #endif
      Serial.println("no touch");
    }
  }
  wastouched = istouched;
  delay(100);
}
And it is working.

One thing I would check with your setup, is, is there something hooked up to the RESET pin of the display. If it is floating, than may not work. May need to be set high... Normally I hook mine up to something, like in the above to pin 8... I changed your touched to 7 as the 8 for reset was in the graphics test example
 
in the code as posted, I see this:

#define USE_T3N 0

does your setup work if it's set to this:

#define USE_T3N 1

I appreciate your help with this!


(and yes, my reset pin is held high)
 
Phew - thought I was crazy for a minute. Glad to see that the issue can be duplicated.
Please let me know if there's anything on my end to assist. I'm starting to delve into the LC-specific code in t3n and am presently battling the learning curve for the low-level SPI machinations.

I did compare Adafruit_BusIO's spi support and currently *guess* that the fact that they directly write to CS on begin/endTransaction is an example of a less speedy, but easier-to-understand approach.
 
It looks like SPI library call SPI.transfer(x) has issues if the library leaves the SPI buss configured for 16 bit mode.

So now the output data 16 bits last, now switches back to 8 bits and also reads in status register.

This appears to get your test to run...

Try syncing up ili9341_t3n
 
Wow - so far your change looks good! I'll keep this thread posted if I run into other difficulties.
Thanks *mucho* for looking into this!

cheers, Dana
 
Hello,

A relative newbie here trying to get a "hello world" TFT example working, without much luck.

I have a ILI9341 2.8" display that I'm trying to get working on my Teensy 4.1 with Arduino IDE 1.8.11. I'm using the unmodified code from here with the graphicstest example: https://github.com/PaulStoffregen/ILI9341_t3

I've tried various wiring combinations, it's not completely clear to me which pins should go where, but at the moment I have:

VCC -> The 3.3 next to 23, have also tried Vin and others
GND -> The GND next to 3.3 (I'm unclear if it matters which one)
CS -> 10
RESET -> On/Off (assuming it's the same position as on the 4.0 as it's unlabelled in the 4.1 pinout)
DC -> 9
MOSI -> 11
SCK -> 13
LED disconnected, I'm unclear if this is needed or where it should go
MISO -> 12
T_* all disconnected

Result: the screen doesn't turn on. I can see the benchmarking output in the serial monitor so the code is definitely compiling, uploading and executing. I've had the screen working before on an Arduino.

I'm sure I'm missing something simple but could someone offer a clue?

Many thanks :)
 
Back
Top