Teensy 4.0 - what 9341 library to use?

Status
Not open for further replies.

1of9

Member
I am trying to figure out the pluses and minuses of the 3 main 9341 libraries that I know of:

ILI9341_t3 ILI9341_t3DMA and the ILI9341_t3n

I have a single tft I will put on SPI0, this particular TFT has no CS and it will be the only device on that bus for obvious reasons.
I don't have any plans to use the other spi buses at this time.

It looks like there have been merges between all of these libraries and it is unclear to me what library to choose.
 
Hard to say? What ILI9341 display board is out there that does not have a CS pin? Note: All three of these you mentioned require the DC pin to be on a hardware CS pin, Some require that CS pin be on hardware CS (at least defined as such).

ILI9341_t3 - This is the main one that ships with Teensyduino. I think the update to allow it to work on T4 was taken in for the latest release. Don't remember if I left in the requirement that DC be hardware CS pin (Only pin 10 on T4 SPI object)...

ILI9341_t3n - This is the one I have done most my experimenting with. Also others like @mjs513 have also added other capabilities as well. What all has been added over ILI9341_t3? Support of all of the SPI busses, support for maybe not on hardware CS pins. Ability to have a logical frame buffer, that all of the graphic primitives write to, and then the ability to tell the system to updates screen from the memory image. The update can be synchronous, asynchronous one shot update, or continuous update... Ability to set offsets, and clip rectangle , and some other graphic functions. Downside is this still requires my secondary library SPIN... One of these days I might try to remove its usage.

ILI9341_t3DMA - I am not sure what the state of Frank's library for T4? He was the first one to add the ability for frame buffer and DMA updates, which I liked the idesas and incorporated them into ILI9341_t3n.

And you also of course have the ability to use the Adafruit_ili9341 library, which also works on T4 (or at least did).
 
What ILI9341 display board is out there that does not have a CS pin?

They are out there, the one I have is just a display without any touch or SD card socket. It works on 32u4 with adafruit and other libraries - I just set the CS to an unused pin and you cant have anything else on the bus but it works fine.

I noticed this in the ILI9341_t3 library:
"Modified begin to allow using display with an invalid (255) chip select #43"
https://github.com/PaulStoffregen/ILI9341_t3/pull/43

t3n sounds like what I would prefer to use, hopefully the ILI9341_t3n will work ok with nothing connected to CS.

Thanks.
 
Looks like I don't check for 255 in the ili9341_t3n, currently you can choose any valid in your case unused pin and it should work.

If it becomes a problem, I could put in change, to not use CS pin. It would I think only impact the ::begin method as I would just not set the port/pin settings and as such all of the code would see that these are NULL and not try to set the CS Pin state.
 
1of9:

I'm a little late coming to this thread but it is of direct interest to me as I'm trying to get an ili9341 chipset TFT to work with the T4.

Do you happen to have an example of your code that actually worked you don't mind sharing?
 
Below is for double frame buffers:

Code:
#include <ILI9341_t3n.h>
#include "ili9341_t3n_font_ArialBold.h" // YMMV - I need this

// NOTE: TFT_CS UNUSED! - NOT CONNECTED!
#define TFT_CS 10 
#define TFT_DC  9
#define TFT_RESET 8
ILI9341_t3n tft = ILI9341_t3n(TFT_CS, TFT_DC,TFT_RESET);

uint16_t FB1[320*240], FB2[320*240]; // double frame buffers 
bool use_fb1 = false; // what buffer to use next 

setup:
  tft.setFrameBuffer(FB1); // have to set before use
  tft.useFrameBuffer(true);
  tft.begin();
  tft.setRotation(3); // if needed

void do_screen_update() {
  tft.waitUpdateAsyncComplete();
  tft.updateScreenAsync();
  if (use_fb1) {
    tft.setFrameBuffer(FB1);  
    use_fb1 = false;
  } else {
    tft.setFrameBuffer(FB2);  
    use_fb1 = true;
  }
}

simpler version for single (or no) frame buffer:

Code:
#include <ILI9341_t3n.h>
#include "ili9341_t3n_font_ArialBold.h" // YMMV - I need this

// NOTE: TFT_CS UNUSED! - NOT CONNECTED!
#define TFT_CS 10 
#define TFT_DC  9
#define TFT_RESET 8
ILI9341_t3n tft = ILI9341_t3n(TFT_CS, TFT_DC,TFT_RESET);

setup:
  tft.useFrameBuffer(true); // remove this for no frame buffer
  tft.begin();
  tft.setRotation(3); // if needed

then in main loop - use whaever update method works best for you
 
Status
Not open for further replies.
Back
Top