#define TFT_CS 10
#define TFT_RST -1 // -1 for unused
#define TFT_DC 8
const uint16_t Display_Color_Black = 0x0000;
const uint16_t Display_Color_Blue = 0x001F;
const uint16_t Display_Color_Red = 0xF800;
const uint16_t Display_Color_Green = 0x07E0;
const uint16_t Display_Color_Cyan = 0x07FF;
const uint16_t Display_Color_Magenta = 0xF81F;
const uint16_t Display_Color_Yellow = 0xFFE0;
const uint16_t Display_Color_White = 0xFFFF;
uint16_t Display_Text_Color = Display_Color_White;
uint16_t Display_Backround_Color = Display_Color_Black;
Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_RST); // Hardware SPI init
void setup()
{
tft.init(135, 240);
tft.setFont();
tft.setRotation(135); // 135 or 45
tft.fillScreen(Display_Backround_Color);
tft.setTextColor(Display_Text_Color);
tft.setTextSize(2);
tft.print("TEST");
}
Should output TEST
and that's it, but flickers and only shows the text if I press the Reset button on the R4 Wifi. The same code is working fine on a e.g. Arduino Nano.
Do I have to use another SPI mode (although tried everything) or adjust the SPI speed?
Thank you!
leon22
July 10, 2023, 11:49am
2
leon22
July 12, 2023, 6:44pm
3
KurtE
July 28, 2023, 10:37pm
5
Works for me:
Note: rotation can only be 0, 1, 2, 3
I changed colors:
#include <Adafruit_ST7789.h>
#define TFT_CS 10
#define TFT_RST -1 // -1 for unused
#define TFT_DC 8
const uint16_t Display_Color_Black = 0x0000;
const uint16_t Display_Color_Blue = 0x001F;
const uint16_t Display_Color_Red = 0xF800;
const uint16_t Display_Color_Green = 0x07E0;
const uint16_t Display_Color_Cyan = 0x07FF;
const uint16_t Display_Color_Magenta = 0xF81F;
const uint16_t Display_Color_Yellow = 0xFFE0;
const uint16_t Display_Color_White = 0xFFFF;
uint16_t Display_Text_Color = Display_Color_Red;
uint16_t Display_Backround_Color = Display_Color_Blue;
Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_RST); // Hardware SPI init
void setup()
{
tft.init(135, 240);
tft.setFont();
tft.setRotation(1); // 135 or 45
tft.fillScreen(Display_Backround_Color);
tft.setTextColor(Display_Text_Color);
tft.setTextSize(2);
tft.print("TEST");
}
void loop() {
}
I am running on a MINIMA. My Wifi one has other stuff hooked up.
DO you have the display made by Adafruit?
leon22
December 31, 2023, 7:46pm
6
Thx but we have two differences in our hardware:
I can still only see the text when the Reset button is pressed.
KurtE
December 31, 2023, 11:37pm
7
Should not matter if WIFI or MINIMA, but could try either...
You are right I don't have one of these... I have many others that Adafruit sells.
Also hard to know what is happening without seeing your wiring and the like. For example what is connected to backlight pin...
KurtE
January 1, 2024, 1:54pm
9
Maybe a voltage issue? display is setup for 3.3v IO and you are giving it 5v? On an Adafruit forum was posting about different PITFT and was mentioned you could fry it without level converter
leon22
January 1, 2024, 4:59pm
10
Don't think so:
The weird thing is, as mentioned, that the same display works flawless on Arduino Uno / Nano.
KurtE
January 1, 2024, 5:49pm
11
As you said the 5v in is for specific stuff... But the IO levels going to the display are +5v from the IO pins.
From this displays schematic
Where if you use their Arduino version, they go through level shifters:
Can not say for sure that is the issue, but I know some other Adafruit ST7789 displays are working.
Not sure if anything else I could do. So good luck
KurtE
January 1, 2024, 6:19pm
12
One other thing... When you say flicker, is the display actually working, but not working well, and only readable when reset?
Maybe it is because the SPI transfer code to update the screen, is not fast... Read that as
Wonder if I should make a version of our Teensy version of the ST7789 library like I did for the ILI9341 as discussed in the thread:
Note: This is related to the thread:
However, thought maybe better to not diverge that thread, to discuss issues with SPI and the Adafruit library.
As mentioned in the other thread, I am able to get their graphics test example to run on the GIGA, using the bitbang version of SPI. That is using the constructor:
#define TFT_DC 9
#define TFT_RST 8
#define TFT_CS 10
#define TFT_MOSI 11
#define TFT_MISO 12
#define TFT_CLK 13
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_MOSI, TFT_C…
Edit: Oops, don't remember if I made it work for UNO R4... Did for GIGA and Portenta
leon22
January 1, 2024, 6:37pm
13
Yes I can see "TEST" when I click the Reset button, so the display itself works. What should I test / modify?
(this is why I added the comment if anything with SPI needs to be adjusted)
Thank you very much.
KurtE
January 1, 2024, 7:09pm
14
Not sure: again this is using your sketch, except I added the missing lines (#include loop()...)
And I have Reset connected...
As I mentioned SPI is not overly great, it is only using about 1/5th the speed
Note: I only connect +5v on this board as it level shifts down to 3.3v...
Also I use +5v not VIN
Not sure what else.
leon22
January 1, 2024, 7:23pm
15
Thx, I would connect the RESET line but not sure which pin on the MiniPi TFT (according to the pinout there is no one => it's a different display).
My question what should I test next was related to "Maybe it is because the SPI transfer code to update the screen, is not fast... Read that as Wonder if I should make a version of our Teensy version of the ST7789 library like I did for the ILI9341 as discussed in the thread".