For myself... I am more just a simple nuts and bolts type user. So I sort of add newer things only when I have a needs (or sometimes just an itch )@KurtE
Just came across this lib for the 9341/9488. Has some interesting features. Any of interest to you?
http://marekburiak.github.io/ILI9341_due/
Macros
//////////////////////////////////////////////////////////////////////////
// Color reading and writing
#define QUICK_READ PIND
//////////////////////////////////////////////////////////////////////////
// Permutations between color bit order and port bit order.
// In the Leonardo these are complex, and are computed ahead of time
// to speed up IO.
// On the Uno, these permutations can be replaced by the identity map.
// Send color data from 565 format into the permuted representation
// for faster IO
#define BIT_TO_PORT_PERMUTATION(b) b
#define PORT_TO_BIT_PERMUTATION(b) b
#define WRITE_PERMUTED_BUS(d) WRITE_BUS(d)
#define IDENTITY(b) BIT_TO_PORT_PERMUTATION(PORT_TO_BIT_PERMUTATION(b))
#define PERMUTED_QUICK_READ QUICK_READ
======================================================
//Functions
void Arduino_TFTLCD::fastFlood(uint8_t c, uint16_t l) {
flood( 0x0101*c, l);
}
// Very fast flood routine.
void Arduino_TFTLCD::flood(uint16_t color, uint32_t len) {
uint8_t i;
uint8_t hi = IDENTITY(color>>8);
uint8_t lo = IDENTITY(color);
START_PIXEL_DATA();
if(hi == lo) {
WRITE_BUS(color);
while (len>=128) {
CLOCK_128;
len-=128;
}
if (len &0b01000000) { CLOCK_64; }
if (len &0b00100000) { CLOCK_32; }
if (len &0b00010000) { CLOCK_16; }
if (len &0b00001000) { CLOCK_8; }
if (len &0b00000100) { CLOCK_4; }
if (len &0b00000010) { CLOCK_2; }
if (len &0b00000001) { CLOCK_1; }
} else {
uint16_t blocks = (uint16_t)(len/32);
while(blocks--) {
i = 4;
do {
SEND_PAIR(hi,lo); SEND_PAIR(hi,lo);
SEND_PAIR(hi,lo); SEND_PAIR(hi,lo);
SEND_PAIR(hi,lo); SEND_PAIR(hi,lo);
SEND_PAIR(hi,lo); SEND_PAIR(hi,lo);
} while(--i);
}
for(i = (uint8_t)len&31; i--; ) SEND_PAIR(hi,lo);
}
}
#define CLOCK_1 {CLOCK_DATA; CLOCK_DATA;};
#define CLOCK_2 {CLOCK_1 CLOCK_1};
#define CLOCK_4 {CLOCK_2 CLOCK_2};
#define CLOCK_8 {CLOCK_4 CLOCK_4};
#define CLOCK_16 {CLOCK_8 CLOCK_8};
#define CLOCK_32 {CLOCK_16 CLOCK_16};
#define CLOCK_64 {CLOCK_32 CLOCK_32};
#define CLOCK_128 {CLOCK_64 CLOCK_64};
#define CLOCK_256 {CLOCK_128 CLOCK_128};
#define CLOCK_DATA {\
READY_DATA;\
SEND_DATA;\
}\
#define READY_COMMAND CONTROLPORT=(DEFAULT|RD_FLAG)
#define SEND_COMMAND CONTROLPORT=(DEFAULT|RD_FLAG|WR_FLAG)
#define RS_PIN 4
#define CS_PIN 3
#define CD_PIN 2
#define WR_PIN 1
#define RD_PIN 0
#define _SEND_PAIR(hi,lo) {\
WRITE_BUS(hi);\
CLOCK_DATA;\
WRITE_BUS(lo);\
CLOCK_DATA;\
}
With the Teensy 3.2-3.6, I mostly saw that it was the SSD1306 (OLED screens) that were problematical with higher SPI bus speeds. I don't recall having to slow down the SPI bus for the ST7735, but it maybe at the faster Teensy 4 speeds you do.
Think that should be mandatory reading That's where I figured out what to do with the tri-state bufferThe pull-up resistors comes from Paul's paper about better SPI bus design:
https://www.pjrc.com/better-spi-bus-design-in-3-steps/
#include "ILI9488_t3.h"
ILI9488_t3 tft = ILI9488_t3(&SPI, 10, 9, 8);
void setup() {
tft.begin();
tft.setRotation(2);
tft.fillScreen(ILI9488_BLACK);
}
#define DELAY 500
void loop() {
tft.drawTriangle( 0,0, 160,0, 0,240, ILI9488_WHITE);
tft.fillTriangle( 0,0, 160,0, 0,240, ILI9488_BLUE);
tft.drawTriangle( 310,0, 160,0, 310,240, ILI9488_WHITE);
tft.fillTriangle( 310,0, 160,0, 310,240, ILI9488_ORANGE);
tft.drawTriangle( 310,460, 160,460, 310,240, ILI9488_WHITE);
tft.fillTriangle( 310,460, 160,460, 310,240, ILI9488_GREEN);
tft.fillTriangle( 0,460, 160,460, 0,240, ILI9488_YELLOW);
tft.drawTriangle( 0,460, 160,460, 0,240, ILI9488_WHITE);
delay(DELAY);
}
Actually if you look at ili9341_t3n log on April 8th, there was a fix for fillTriangles.
So in ILI9488.t3.cpp line 2147, try changing int16_t to int32_t...
And see if that helps
#ifdef KINETISK
_pkinetisk_spi = &_pspin->port();
#elif defined(__IMXRT1052__) || defined(__IMXRT1062__) // Teensy 4.x
_pimxrt_spi = &_pspin->port();
#else
_pkinetisl_spi = &_pspin->port();
#endif
uint16_t ILI9341_t3n::readPixel(int16_t x, int16_t y)
{
uint16_t colors = 0;
readRect(x, y, 1, 1, &colors);
return colors;
}
tft.readRect(0, 0, 50, 50, pixel_data);
// For heck of it lets make sure readPixel and ReadRect
// give us same data, maybe check along diagnal?
for (uint i=0; i < 50; i++) {
uint16_t pixel_color = tft.readPixel(i,i);
if (pixel_color != pixel_data[i*50+i]) {
DBGSerial.printf("Read rect/pixel mismatch: %d %x %x\n", i, pixel_color,pixel_data[i*50+i]);
}
}
ILI9488_t3n: (T4) SPI automatically selected
Use FB: 0 Read rect/pixel mismatch: 1 f000 0
Read rect/pixel mismatch: 4 c000 0
Read rect/pixel mismatch: 8 8000 0
Read rect/pixel mismatch: 15 8000 0
Read rect/pixel mismatch: 43 fc00 0
Read rect/pixel mismatch: 0 0 0
Read rect/pixel mismatch: 1 0 0
Read rect/pixel mismatch: 2 0 0
Read rect/pixel mismatch: 3 0 0
Read rect/pixel mismatch: 4 0 0
Read rect/pixel mismatch: 5 0 0
Read rect/pixel mismatch: 6 0 0
Read rect/pixel mismatch: 7 0 0
Read rect/pixel mismatch: 8 0 0......
Display Power Mode: 0x2
MADCTL Mode: 0x0
Pixel Format: 0x2
Image Format: 0x0
Self Diagnostic: 0x0
Use FB: 0 Read rect/pixel mismatch: 2 ffff 9cf3
Read rect/pixel mismatch: 8 ffff 9cf3
Read rect/pixel mismatch: 9 ffff 9cf3
Read rect/pixel mismatch: 10 ffff 9cf3
Read rect/pixel mismatch: 11 ffff 9cf3
Read rect/pixel mismatch: 12 f618 8cf0
Read rect/pixel mismatch: 35 f800 0
Read rect/pixel mismatch: 36 f800 2000
Read rect/pixel mismatch: 37 f800 0
Read rect/pixel mismatch: 38 f800 2000
Read rect/pixel mismatch: 39 f800 0
Read rect/pixel mismatch: 42 7bef ffff
Read rect/pixel mismatch: 43 7bef ffff
Read rect/pixel mismatch: 44 7800 f800
Read rect/pixel mismatch: 45 7800 f800
Read rect/pixel mismatch: 46 7800 f800
Read rect/pixel mismatch: 47 7800 f800
Read rect/pixel mismatch: 48 7800 f800
Read rect/pixel mismatch: 49 7be0 ffff
128
Display Power Mode: 0x0
MADCTL Mode: 0x80
Pixel Format: 0x87
Image Format: 0x85
Self Diagnostic: 0x87
Use FB: 0 Read rect/pixel mismatch: 1 2000 0
Read rect/pixel mismatch: 8 8000 0
Read rect/pixel mismatch: 9 8000 0
Read rect/pixel mismatch: 12 8000 0
108
Note: It appears like I am not receiving any data back on my MISO line as well with the one display (ILI9488...)