Unsuccessful at writing to Adafruit TFT ST7735 with Teensy 3.2

Status
Not open for further replies.

spumoni

Member
Hi,
I am trying to write to a Adafruit TFT ST7735 with a Teensy 3.2. Using an Arduino Uno I have been successful but no luck with Teensy. Here is the code that runs ok on Arduino:

Code:
#include <Adafruit_GFX.h>
#include <Adafruit_ST7735.h>
#include <SPI.h>

#define TFT_CS     10
#define TFT_DC     9
#define TFT_RST    8  

Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST);

#define GREEN           0x07E0
#define BLACK           0x0000
 
void setup()
{
  Serial.begin(115200);
  Serial.println("start");
  
  tft.initR(INITR_BLACKTAB);        
  tft.fillScreen(GREEN);
  tft.drawCircle(40, 80, 20, BLACK);
  
  Serial.println("done");
}

void loop()
{
}

I am using Arduino version 1.6.5-r5 and uploaded Teensyduino.

Settings on compile/download:

Board: "Teensy 3.2/3.1"
USB Type: "Serial"
Port: 7
CPU Speed: 96mhz

Code compiles and uploads successfully and I get the start & done messages, but output on the LCD screen.

I have double checked the wiring - using pins 8-13 on Teensy.
Power to LCD is from Teensy Vin (5v) and Grd. (backlight on LCD is on)

Here is the last few lines of compiled output:

Multiple libraries were found for "ILI9341_t3.h"
Used: C:\Users\Allen\Music\Documents\Arduino\libraries\ILI9341_t3
Not used: C:\arduino-1.6.5-r5\hardware\teensy\avr\libraries\ILI9341_t3

Sketch uses 18,196 bytes (6%) of program storage space. Maximum is 262,144 bytes.
Global variables use 4,636 bytes (7%) of dynamic memory, leaving 60,900 bytes for local variables. Maximum is 65,536 bytes.
C:\arduino-1.6.5-r5/hardware/tools/teensy_post_compile -file=TFT_Display_FromNEt.cpp -path=C:\Users\Allen\AppData\Local\Temp\build7747845645281143961.tmp -tools=C:\arduino-1.6.5-r5/hardware/tools -board=TEENSY31 -reboot

Any help would be appreciated!
 
You might want to put in a delay in your setup before calling the initR function. Often times devices take a while to start up. An arduino with an AVR processor tends to be slower in starting up, while Teensys start faster. Try something like this:

Code:
void setup()
{
  delay (2000);   // let the USB connection and ST7735 devices start up
  Serial.begin(115200);
  Serial.println("start");
  
  tft.initR(INITR_BLACKTAB);        
  tft.fillScreen(GREEN);
  tft.drawCircle(40, 80, 20, BLACK);
  
  Serial.println("done");
}

void loop()
{
}

It also looks like you have copies of the Teensy libraries. Note, the Teensy version is not being used. So, you might want to delete your version:

Code:
Multiple libraries were found for "ILI9341_t3.h"
Used: C:\Users\Allen\Music\Documents\Arduino\libraries\I LI9341_t3
Not used: C:\arduino-1.6.5-r5\hardware\teensy\avr\libraries\ILI9341_t3
 
You might want to put in a delay in your setup before calling the initR function. Often times devices take a while to start up. An arduino with an AVR processor tends to be slower in starting up, while Teensys start faster. Try something like this:

Code:
void setup()
{
  delay (2000);   // let the USB connection and ST7735 devices start up
  Serial.begin(115200);
  Serial.println("start");
  
  tft.initR(INITR_BLACKTAB);        
  tft.fillScreen(GREEN);
  tft.drawCircle(40, 80, 20, BLACK);
  
  Serial.println("done");
}

void loop()
{
}

It also looks like you have copies of the Teensy libraries. Note, the Teensy version is not being used. So, you might want to delete your version:

Code:
Multiple libraries were found for "ILI9341_t3.h"
Used: C:\Users\Allen\Music\Documents\Arduino\libraries\I LI9341_t3
Not used: C:\arduino-1.6.5-r5\hardware\teensy\avr\libraries\ILI9341_t3

Hi Michael,
Thanks for the tip. Unforunately, that did not work for me. May I'll try alternate SPI ports.
 
May I'll try alternate SPI ports.

Don't go that route. Only the main SPI port is well supported.

Instead, put a little effort into a few good photos to actually show us how you connected the wires. I know you said you already double checked the wiring, but we get these questions all the time and the problem almost always turns out to be an error or misunderstanding in how to connect the wires. We're pretty good at helping, but only when we can actually see how the wires are really hooked up.
 
I am also confused on why it is showing duplicate liebiraries for ili9341_t3.h? ... When you are using #include <Adafruit_ST7735.h> ?

Also pictures really help! Example is this in a breadboard? If So are the pins soldered to the teensy?

Also might help to know which Adafruit display...
 
FWIW, i have successfully used this ST7735R, https://www.adafruit.com/product/358, with T3.2. I have a mandelbrot sketch and an audio FFT spectrum analyzer sketch.
i will try your sketch later tonight ...

EDIT: Your sketch (unaltered) worked on my display -- a black circle on green background. 3.3v, gnd, SPI (10-13), DC 9, RESET 8, 3.3v to LITE. IDE 1.8.4/1.40
Works for me.

Like KurtE I suspect bad wiring/soldering.... Do you have 3.3v to LITE pin? Update your IDE?

tft7735.jpg
 
Last edited:
BTW, I am using another Teensy 3.2. All the pins on the Teensy are soldered in. I recrimped the short adapter plug coming from the Teensy SPI ports. The Teensy power jumper on the back is open so I am powering with a 5v source (red connector on right). On the connector at the TFT, I have a jumper from +5v to Lite. Here's another picture of setup.IMG_0018.jpg
 
You might try updating your Arduino IDE and teensyduino.

It looks like you have 6 data wires (pins 8-13) coming from T3.2, but in the next connector you have 7 wires ??? you should leave CARD_CS unconnected.
 
I initially tried Arduino 1.8.5 but I was getting all kinds of weird errors during the compile, so I went with 1.6.5 and things went fine. I installed Arduino directly under the C: drive.

I have the 6 data wires and just had the SD card CS wired but not plugged into the board. As I mentioned, I can plug this right into an Uno and it works perfectly. I also ran the "Blink" program on both Teensys' and they work fine.

IMG_0022.jpg
 
I ran it here, using Arduino 1.8.5 and the latest 1.42 beta. Works. No compile errors.

DSC_0084_web.jpg

DSC_0086_web.jpg

Maybe something about your copy of 1.8.5 got corrupted? You can always just download fresh copies. Best to get the ZIP file and extract somewhere unique you can remember, so it stays separate from any other copies you have.
 
Hi,

I downloaded fresh zip copies of 1.8.5 and Teensyduino and unzipped and installed on another directory under c: drive. Tested blink (which worked) and the test program and it didn't work again. I again had all kinds of compile errors. I then brought up 1.6.5 on this computer which worked fine yesterday and that also kick out more strange complie errors. Not sure what is going on, but it seems Arduino is searching the hard drive to find any available libraries that it needs. Very strange.

I downloaded fresh zip copies of 1.8.5 and Teensyduino and unzipped and installed on a different computer (ASUS laptop). Used a different USB cable to the Teensy. This time it compiled and ran but again nothing was displayed. I tried the program without any Serial.begin() and still no joy.

I guess I am throwing in the towel now and will try to pick up another display from Adafruit.
Thank you all for all the help and suggestions! I really appreciate it.
I guess some days you are the windshield and other days you are the bug.
 
Status
Not open for further replies.
Back
Top