TFT library still reference AVR

Trying to test ST7735 128x160 display, using the TFT code below.
It gives me an error comiling for the new R4, still referencing avr/io.h

In file included from C:\Users\deond\AppData\Local\Arduino15\libraries\TFT\src\utility\Adafruit_GFX.cpp:35:0:
C:\Users\deond\AppData\Local\Arduino15\libraries\TFT\src\utility\glcdfont.c:3:10: fatal error: avr/io.h: No such file or directory
** #include <avr/io.h>**
** ^~~~~~~~~~**
compilation terminated.

Sketch:

#include <TFT.h>
#include <SPI.h>

#define cs 8
#define dc 10
#define rst 9

TFT TFTscreen = TFT(cs, dc, rst);

void setup() {
  TFTscreen.begin();
  TFTscreen.background(0, 0, 0);
  TFTscreen.setTextSize(2);
}

void loop() {
  int redRandom = random(0, 255);
  int greenRandom = random (0, 255);
  int blueRandom = random (0, 255);

  TFTscreen.stroke(redRandom, greenRandom, blueRandom);
  TFTscreen.text("Hello, World!", 6, 57);
  
  delay(200);
}

Lots of third party libraries haven't been updated yet. Can you post a link to the library you're using so I know I'm looking at the same one?

1 Like

@randmental, Hi, are you interested in learning about a newer general display library?

Arduino_GFX supports many displays and boards. It is known by Library Manager.

It is known to support HW SPI also on Arduino UNO R4 Minima and WiFi.

I just tested that it compiles with these constructors for UNO R4 and ST7735:

Arduino_DataBus *bus = new Arduino_HWSPI(8, SS); // UNO
Arduino_GFX *gfx = new Arduino_ST7735(bus, TFT_RST, 0); // 1.8

Take a look at PDQgraphicstest

Good Luck!
-jz-

2 Likes

Are you sure your library Adafruit_GFX is up-to-date?
In the version I have it is in a conditional section:

#ifdef __AVR__
#include <avr/io.h>
#include <avr/pgmspace.h>
#elif defined(ESP8266)
#include <pgmspace.h>
#elif defined(__IMXRT1052__) || defined(__IMXRT1062__)
// PROGMEM is defefind for T4 to place data in specific memory section
#undef PROGMEM
#define PROGMEM
#else
#define PROGMEM
#endif

https://github.com/arduino-libraries/TFT is outdated!

It contains an outdated copy of Adafruit_GFX!
See https://github.com/arduino-libraries/TFT/blob/master/src/utility/glcdfont.c

Note: this library was retired and is no longer maintained.

It should be removed or eliminated, I think.

And this page https://www.arduino.cc/reference/en/libraries/tft/ needs some further update or elimination, because of

This library is compatible with all architectures so you should be able to use it on all the Arduino boards.

1 Like

Thanks - Reloaded the GFX library and all are compiling now.

Will do , thanks!

Dear ZinggJM

I am running the PQtest successfully on an UNO with the 128x 160 display, but needs some advice please. It has me stumped by this for the last two days:
image

Now running the same demo code on the R4 Minima give me a streaked display:
image

This is the application, a replacement VU meter for an AKAI tape deck, it also shows the streaking:
image

I have swapped displays and boards, all points to the R4 as the problem.



/*******************************************************************************
 * Start of Arduino_GFX setting
 ******************************************************************************/
#include <Arduino_GFX_Library.h>

// Manual define hardware 

/* Step 1: Define pins for Arduino_GFX_databus */
#define TFT_DC  10
#define TFT_RST 9
#define TFT_CS  8 
#define GFX_BL  6

/* Step 2: Create databus */
Arduino_DataBus *bus = new Arduino_HWSPI(TFT_DC, TFT_CS);

// 1.8" Wide angle LCD 128x160  Display  with ST7735
// ======================================================== 
Arduino_GFX *gfx = new Arduino_ST7735(bus, TFT_RST, 1 /* rotation */, false /* IPS */, 128 /* width */, 160 /* height */, 0 /* col offset 1 */, 0 /* row offset 1 */, 0 /* col offset 2 */, 0 /* row offset 2 */, false /* BGR */);

/*******************************************************************************
 * End of Arduino_GFX setting
 ******************************************************************************/

// Image data 160 x 128
static const unsigned char PROGMEM img[2560] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 

0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x03, 0xC0, 0x00, 

0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0xE0, 0x02, 0xC0, 0x03, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x78, 0x01, 0x80, 0x01, 0xC0, 0x01, 0x81, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x01, 0xE0, 0x01, 0xC0, 0x01, 0x83, 0x20, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x80, 0x18, 0x00, 0x20, 0x02, 0x40, 0x01, 
0x83, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0xC0, 0x18, 0x00, 
0x20, 0x03, 0xC0, 0x01, 0x83, 0x20, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x16, 0xC0, 0x30, 0x01, 0xE0, 0x03, 0xC0, 0x01, 0x83, 0x20, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x16, 0x40, 0x30, 0x01, 0xC0, 0x00, 0x00, 0x01, 0x81, 0x60, 0x00, 0x16, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x40, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x01, 0xC0, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0xE0, 0x16, 0x40, 0x20, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0xF0, 
0x13, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x38, 0x00, 0x00, 
0x00, 0x00, 0x17, 0x90, 0x13, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 
0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x05, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 
0x00, 0x00, 0x00, 0x0E, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x90, 0x00, 0x00, 0x00, 0x00, 

0x20, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x19, 0x90, 
0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 
0x00, 0x00, 0x1E, 0xF0, 0x00, 0x00, 0x04, 0x00, 0x20, 0x00, 0x80, 0x01, 0x02, 0x00, 0x00, 0x00, 
0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x60, 0x00, 0x00, 0x04, 0x00, 0x20, 0x00, 0x80, 0x01, 
0x02, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 
0x20, 0x00, 0x80, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x80, 0x04, 0x00, 0x20, 0x00, 0x80, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x20, 0x00, 0x80, 0x02, 0x04, 0x00, 0x00, 0x10, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x00, 0x80, 0x02, 
0x04, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x40, 0x02, 0x00, 
0x3F, 0xFF, 0xFF, 0xF2, 0x04, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 
0x00, 0x40, 0x02, 0x1F, 0xFF, 0xFF, 0xFF, 0xFF, 0xE4, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x04, 0x00, 0x20, 0x07, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xC6, 0x00, 0x00, 0x40, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x20, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 
0xCF, 0xF0, 0x00, 0x40, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x2F, 0xFF, 0xFC, 
0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0x00, 0x80, 0x03, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 

0x00, 0xFF, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x80, 0x07, 0x00, 0x20, 0x00, 
0x00, 0x00, 0x00, 0x01, 0x07, 0xFF, 0xC0, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0F, 0xFE, 0x80, 
0x06, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x01, 0x3F, 0xFC, 0x00, 0x0C, 0x80, 0x0F, 0xC0, 0x4D, 
0xC0, 0x00, 0x7F, 0xE0, 0x0E, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x71, 0xFF, 0xC0, 0x00, 0x0D, 
0xC0, 0x05, 0x40, 0x75, 0x40, 0x00, 0x0F, 0xF8, 0x1C, 0x03, 0xFC, 0x00, 0x00, 0x00, 0x01, 0xFF, 
0xFE, 0x00, 0x00, 0x0D, 0x40, 0x05, 0x40, 0x77, 0x40, 0x00, 0x01, 0xFF, 0x1C, 0x00, 0x20, 0x00, 
0x00, 0x00, 0x01, 0xFF, 0xE0, 0x00, 0x00, 0x05, 0x40, 0x0D, 0xC0, 0x75, 0x40, 0x00, 0x00, 0x1F, 
0xF8, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0xFF, 0x00, 0x00, 0x00, 0x1D, 0xC0, 0x00, 0x00, 0x4D, 
0xC0, 0x00, 0x00, 0x07, 0xF8, 0x00, 0x20, 0x00, 0x00, 0x00, 0x07, 0xF8, 0x00, 0xEE, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x00, 0xFF, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1F, 0xE0, 
0x00, 0x2A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x1F, 0xC0, 0x00, 0x00, 
0x00, 0x00, 0x7F, 0x00, 0x00, 0x7A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 
0x07, 0xF0, 0x00, 0x00, 0x00, 0x01, 0xFC, 0x00, 0x00, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x3E, 0x00, 0x00, 0xFC, 0x00, 0x00, 0x00, 0x07, 0xF0, 0x0C, 0x00, 0x6C, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x07, 0x80, 0x1A, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x0F, 0xC0, 0x00, 

0x00, 0x02, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x03, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xC0, 0x00, 0x00, 0x00, 0xD8, 0x0C, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0xD0, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x8D, 0x8C, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x01, 0x8D, 0x8C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x01, 0x8D, 0x8C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x99, 0x8C, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD9, 0x8C, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0xD9, 0x8C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0xD9, 0x8C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x71, 0xCC, 0x00, 0x00, 0x00, 0x00, 0x00, 

0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0xFC, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x70, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x20, 0x75, 0x02, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x30, 0x62, 0x06, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x24, 0x06, 0x04, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x28, 0x07, 0x04, 

0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x58, 0x30, 0x0B, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x58, 0x30, 0x09, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x38, 0x0F, 0x84, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8C, 0x2C, 0x10, 0x84, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 
0x04, 0x26, 0x10, 0xC4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x01, 0x06, 0x63, 0x30, 0xC6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 

0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 

0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 
};

void setup() {

  //GFX_EXTRA_PRE_INIT();
  gfx->begin(); // Initialize the display
  gfx->fillScreen(0x0000); // Clear the screen
  
#ifdef GFX_BL
  pinMode(GFX_BL, OUTPUT);
  digitalWrite(GFX_BL, HIGH);
#endif
}


void loop() {
  gfx->drawBitmap(0, 0, (uint8_t *)img, 160, 128, WHITE); // Draw the image
}

This is not a good idea. Try to add a delay(), of at least 100ms.

And maybe you need to reduce the SPI speed. The standard UNO will ignore the higher SPI speeds, but the R4 can use them. Try

  gfx->begin(8000000); // Initialize the display, SPI 8MHz

Please post a link to the display you have, or a picture of the backside. Maybe I have the same.

Unfortunately the slower clock speed did not make a difference, nor did adding a delay.

I think the issue has something to do with the Fill Screen - the screen never actually turns black.


void loop() {
  gfx->drawBitmap(0, 0, (uint8_t *)img, 160, 128, WHITE); // Draw the image
  delay(2200);
  gfx->fillScreen(0x0000);
  delay(2200);
 }

Display giving this issue:
image

Sorry, maybe I am missing something.

But have you tried the normal Adafruit_ST7735 library? This looks a lot different.

image

The fix I put in to use this library was merged...
Support the new Arduino UNO-R4 boards by KurtE · Pull Request #187 · adafruit/Adafruit-ST7735-Library (github.com)

@randmental, sorry, I do have the same display, but I didn't test it with Arduino UNO R4 yet.

It doesn't work for me on UNO R4, too.

I shouldn't claim things that I didn't test myself.
Maybe I was misled by my own library GxEPD2 working on UNO R4 WiFi. It uses HW SPI.

I will try to analyze why Arduino_GFX doesn't work with HW SPI, at least for me for this display.

BTW: the display has an LDO for use with 5V supply, but no level converters for data lines.
-jz-

I shall again try using both libraries on the UNO and the R4 - I have the same displays on both boards, wired the same.

Interestingly swaping for the 128x128 Display, it works fine:

EDIT: Appologies - It does not work fine, it has the same problem with both Adafuit and Arduino ST755 libraries.

image

Using the standard Adafruit ST7735 Library 1.10.3 and running the graphicstest demo, I get a similar effect. At the end of this demo, the screen image are inverted and cycled - one screen give the streaking, the other one not. The only changes I made to the demo code are as below: enabled the Backlight on pin 6, and swap CS and DC pin numbers for my wiring:

#include <Adafruit_GFX.h>    // Core graphics library
#include <Adafruit_ST7735.h> // Hardware-specific library for ST7735
#include <Adafruit_ST7789.h> // Hardware-specific library for ST7789
#include <SPI.h>

// For the breakout board, you can use any 2 or 3 pins.
// These pins will also work for the 1.8" TFT shield.
#define TFT_CS   8
#define TFT_RST  9 
#define TFT_DC   10
#define TFT_MOSI 11  // Data out
#define TFT_SCLK 13  // Clock out
#define TFT_BL   6

// For ST7735-based displays, we will use this call
Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_MOSI, TFT_SCLK, TFT_RST);

float p = 3.1415926;

void setup(void) {
  Serial.begin(9600);
  Serial.print(F("Hello! ST77xx TFT Test"));

  // Use this initializer if using a 1.8" TFT screen:
  tft.initR(INITR_BLACKTAB);      // Init ST7735S chip, black tab

#ifdef TFT_BL
  pinMode(TFT_BL, OUTPUT);
  digitalWrite(TFT_BL, HIGH);
#endif

Good screen :

image

Inverted image (with streaking and black not being solid black):

image

I believe the problem is in the FIll Screen (BLACK) Command.
The screen turns solid black behind text, but when the screeen is cleared using the Fill (Black) command, the screen is actually grey and streakish.

I have also retested the 128x128 screen, it actually has the same problem on the R4

Edit : Droping the SPI speed to 40M, and 10M made no difference

The plot thickens:

On the R4:
Using the Adafruit ST7735 library and graphicsdemo sketch , I get the similar streaking with both the 160x128 and the smaller 128x128 display.

Using the Arduino ST7735 library and its PDQgraphicstest skecth the larger screen gives similar streaking as on the Adafruit lib & demo sketch.

HOWEVER the 128x128 screen works and look perfect, as it does on the Uno.

With which SPI speed?

There was a topic about SPI speeds on UNO R4, telling only some "known" speeds are accepted, not using the next lower speed as usual on other platforms. I didn't find that topic (didn't search for), and I don't know if it is fixed in the meantime.

Missing level converters may also be of issue. I don't yet have a shield with real level converters to check. My wiring skills are slow.

I have a 5V tolerant ST7789 display that works on UNO R4, tested with 4MHz. Will test higher speeds later.

I am running the Adafruit 128x128 display using their graphic test sketch.
Using the default pins. The only thing I changed was the initR call:

  // OR use this initializer (uncomment) if using a 1.44" TFT:
  tft.initR(INITR_144GREENTAB);  // Init ST7735R chip, green tab

I do have an 128x160 display,
Amazon.com: HiLetgo 1.8" inch ST7735R SPI 128 * 160 TFT LCD Display Module with PCB : Electronics

But as the device does not handle 5v signals

Note:
Please contact us for documents and driver if you need. Please noted this LCD is 3.3V, which can not receive 5V signals from the Arduino, so please use a 1k series resistors between GPIO lines on a 5V arduino and this LCD, power this LCD with 5V but drive it with 'level shifted resistor' GPIO lines.

So I did not try this one.

Will hook up a scope tomorrow ands see what is the diffeence bteween UNO and R4 vonnections as used by these St7735 display

Thanks for the assistance, really appreciate it - wanted to do a quick and direty VU meter replacement, but the UNO memory is to small for a clour Bitmap, thus thought the R4 would be a quick alternative.

I'll offer this up as a datapoint: using an R4 Minima, running the graphicsdemo example from the Adafruit ST7735 Library 1.10.3, on a real Adafruit 160 x 128 ST7735 breakout board, I don't see any streaks at the end where it cycles back and forth inverting the screen. No modifications were made to the demo code.

I ordered another 1.8" one, that supposed to handle 5v
Amazon.com: DIYmalls 1.8" inch TFT LCD Display Screen Module SPI Interface ST7735S 128x160 w/SD Card Slot for Arduino U NO Mega-2560 : Electronics

Will see how well it works.

Note: most of the time when I read Arduino_GFX, my eyes see Adafruit_GFX.
I now have that library installed as well. Running on my 128x128 display.

1 Like

My new proto-shield with level converters is wired, but doesn't work yet. Some cold joint to find.

But now an earlier proto-shield with 4k7 series resistors (for e-paper displays) works with this display.
Because I discovered the reason why it had failed; TFT_RST was not adapted to the shield, silly me.

// RST pin used
//#define TFT_RST 2 // ESP8266 e-paper proto board
#define TFT_RST 9 // UNO e-paper proto board

Conclusion: the 1.8" ST7735 display works with Arduino_GFX on Arduino UNO R4 Minima.

Looks like at least series resistors are needed with this 5V processor with 5V IO pins.
5V IO pins on classic Arduino UNO have higher driving power, maybe that's why it worked without series resistors.

Added: It only works with 4MHz SPI speed!, neither with 8MHz nor with 12MHz.

Added more: 4MHz with 4k7 series resistors, or 4k7/10k voltage divider shield.
8MHz and 12MHz (default value) also work with my shield with I2C level converters.

Added: It only works with 4MHz SPI speed!, neither with 8MHz nor with 12MHz.

Added more: 4MHz with 4k7 series resistors, or 4k7/10k voltage divider shield.
8MHz and 12MHz (default value) also work with my shield with I2C level converters.

2 Likes