My first guess is problems with using pin 7 for CS.

Quote Originally Posted by vastydeep View Post
#define __CS 7
#define __DC 9
#define __RST 8

TFT_ILI9163C display = TFT_ILI9163C(__CS, __DC, __RST);
Sumotoy's library uses the highly optimized SPI code, which requires both CS and DC using the hardware-controlled CS pins. Teensy 3.1's hardware can only generate 5 of those special fast CS signals. The possible pins are 9, 10, 15, 20 and 21. You've already connected DC to pin 9, but CS also needs to be on one of those 5 pins. Using pin 7 won't work (or if it does sometimes work, that's only because the pin happens to "float" to a logic low voltage sometimes). Sumotoy's library won't do anything at all with pin 7, so it's signal will be just random noise.

Regular (not highly optimized) SPI code using the SPI library uses digitalWrite() to control the CS signal. Peter Torelli's SPI Flash code works that way. Because it's using digitalWrite, you can use any digital pin. You're not limited to the 5 special hardware-controlled SPI signals.

To make matters even more confusing, those 5 special signals have alternate pins. We no longer print those on the pin reference card that comes with every Teensy, because it's just too confusing to figure out which ones might conflict with each other. But if you look in the code, you'll see those other pins and special checks for the conflicting combinations. I recommend simply using one of the 5 main pins (9, 10, 15, 20 and 21), but it also also possible to access 4 of those 5 special chip selects on pins 2, 6, 22 and 23.

Of course it's possible something else is wrong, but I'd start by moving the display's CS line from pin 7 to one of those 5 special chip select pins which Sumotoy's library requires.