Teensy 4.1 MQS and the ILI9341_t3 library ?

peter247

Member
As seen it stated in a lot of threads that the MQS uses pin 10 and pin 12 , which is used by the default SPI.
I've tried moving to the alternative SPI pins 26,27,38,39 , with the define the lot. ILI9341_t3 tft = ILI9341_t3( TFT_CS , TFT_DC, TFT_RST, TFT_MOSI, TFT_SCLK, TFT_MISO );
But it still uses the default pins , and only CS and DC makes any difference.
I think the library was made for the Teensy 3x , so thinks my pins aren't valid ?

What do I need to do to move SPI or the MQS pins ? OR is there a Library I should be using on the Teensy 4.1 with the ILI9341 display ?

Thanks in advance Peter
 
It looks like ILI9341_t3 does not have support for the second SPI bus in Teensy 4.0/4.1. Some display drivers have a method to access the second SPI bus, some do not.

Note, there are 2 concepts. The first is independent SPI buses. These are completely separate SPI buses. The Teensy LC, 3.5, 3.6, 4.0, and 4.1 have a second SPI bus. To access this bus, you would the global variable 'SPI1' instead of 'SPI'. These separate SPI buses are on completely separate pins.

The other concept is alternative pins for the SPI bus. This allows you to use different pins for the 3 SPI pins (MOSI, MISO, and SCLK). The Teensy 3.x processors allows you to use specific other pins as alternates to pins 11, 12, and 13. The Teensy 4.0 and 4.1 only has 1 alternate pin (substituting pin 39 for pin 1 with the SPI1 MISO1 pin).

So unfortunately, you cannot move either MQSL/MQSR nor MOSI0, MISO0, or SCLK0.

KurtE has an alternate library ILI9341_t3n (https://github.com/KurtE/ILI9341_t3n) that does allow you to use the separate SPI buses.
 
Thank you , So the ones mark with a 1 on the card are not alternates which can be used with the normal SPI library , but a second independent SPI bus SPI1 ?
I will look for the ILI9341_t3n library and see if I can use it on the teensy 4.1 or use i2s which I don't think uses any of the SPI pin.
My project started life on the esp32 ,but the teensy looked easier to have sound , i2c and SPI for the display all on one chip no extra sound chips etc.
 
Yes, the T4 and T4.1 actually have a few SPI buses.

T4.1-Cardlike.jpg

They are shown on the released card as well as my excel document and photo made from it:
SPI1 has a few alternate pins for some of the features (on T4.1) which I show.
Note the ones with Black text are the default pins for it. If in RED you may have to do something like: SPI1.setMISO(39);

Note: the ILI9341_t3n library does this automatically if you pass in the pin numbers where all of the SPI pins (MISO, MOSI, SCK) are on SPI1, likewise SPI2
 
So the default pins for SPI1 to pass is pins 0/1/26/27 ?

are CS and DC any digital pin and my problem pin is just MISO pin 12 ?.
So need to use pin 1 , 26 , 27 and the CS pin is any ?

#define CS_PIN 8 // touch screen
#define TFT_DC 9
#define TFT_CS 0
#define TFT_MOSI 26
#define TFT_SCLK 27
#define TFT_MISO 1
#define TFT_RST 255
 
Last edited:
peter247-were you able to free up the MQS pins 10 & 12 using the ILI9341_t3n library as KurtE suggested?
 
So the default pins for SPI1 to pass is pins 0/1/26/27 ?

are CS and DC any digital pin and my problem pin is just MISO pin 12 ?.
So need to use pin 1 , 26 , 27 and the CS pin is any ?

#define CS_PIN 8 // touch screen
#define TFT_DC 9
#define TFT_CS 0
#define TFT_MOSI 26
#define TFT_SCLK 27
#define TFT_MISO 1
#define TFT_RST 255
I believe this will only work with my ILI9341_t3n library. I am not sure if any of my changes to allow different SPI ports ever made it back into the ILI9341_t3 library or not.
 
peter247-were you able to free up the MQS pins 10 & 12 using the ILI9341_t3n library as KurtE suggested?

Yes, no problem these are my pin defines on ILI9341_t3n

#define TOUCH_CS 36
#define TFT_DC 9
#define TFT_CS 37
#define TFT_MOSI 26
#define TFT_SCLK 27
#define TFT_MISO 39
#define TFT_RST 255
ILI9341_t3n tft = ILI9341_t3n( TFT_CS , TFT_DC, TFT_RST, TFT_MOSI, TFT_SCLK, TFT_MISO );

My biggest problem was the touch screen and make it use SPI1 , but found the default XPT2046_Touchscreen , didn't work but had to download it from git hub.
 
Back
Top