Teensy-LC with ST7735

Status
Not open for further replies.

scott.boone

New member
Sorry if this is already answered somewhere else. If so, feel free to point me in that direction. I am attempting to use the Adafruit 1.8 inch (128x160) color TFT LCD display with the Teensy-LC. It works fine as a display using the standard Adafruit libs when running it using the three wire interface: Adafruit_ST7735 tft = Adafruit_ST7735(cs, dc, rst) or at least I should say that it runs the graphics example from the Adafruit library in this mode with no visible issues.

I would like to use the SD interface on the display as well but I note that when I read the information at the following link: http://pjrc.com/teensy/td_libs.html that the column for Teensy-LC is blank for this display, it does not say NO or YES. I read all of the information on making the display work for the Teensy 3.x but wondered if it can be made to work with the LC.

So my basic question is: Is the Teensy LC physically capable of driving the 5 wire interface (Adafruit_ST7735(cs, dc, mosi, sclk, rst)) to the ST7735 and using the SD interface at the same time and if so, what library changes need to be made for that to happen?

It probably does not matter but just in case you were wondering, here are two things I have attempted so far:
1. Used the three wire interface to run the display while accessing the SD. As you might expect, this causes conflict issues with the display when accessing the SD card making for an unpredictable display.
2. Ensured that the LC was connected in the same manner as shown here: https://www.pjrc.com/teensy/td_libs_ST7735.html
As part of this exercise, I also downloaded the library shown on that same page and replaced the other Adafruit 7735 lib with it. This yields errors when trying to compile the library files:
\\scsrv1\users\scott.boone\My Documents\Arduino\libraries\Adafruit-ST7735\Adafruit_ST7735.cpp: In constructor 'Adafruit_ST7735::Adafruit_ST7735(uint8_t, uint8_t, uint8_t, uint8_t, uint8_t)':
\\scsrv1\users\scott.boone\My Documents\Arduino\libraries\Adafruit-ST7735\Adafruit_ST7735.cpp:30:3: error: '_cs' was not declared in this scope
_cs = cs;
^
\\scsrv1\users\scott.boone\My Documents\Arduino\libraries\Adafruit-ST7735\Adafruit_ST7735.cpp:31:3: error: '_rs' was not declared in this scope
_rs = rs;
^
\\scsrv1\users\scott.boone\My Documents\Arduino\libraries\Adafruit-ST7735\Adafruit_ST7735.cpp:32:3: error: '_sid' was not declared in this scope
_sid = sid;
^
\\scsrv1\users\scott.boone\My Documents\Arduino\libraries\Adafruit-ST7735\Adafruit_ST7735.cpp:33:3: error: '_sclk' was not declared in this scope
_sclk = sclk;
^
\\scsrv1\users\scott.boone\My Documents\Arduino\libraries\Adafruit-ST7735\Adafruit_ST7735.cpp:34:3: error: '_rst' was not declared in this scope
_rst = rst;
^
\\scsrv1\users\scott.boone\My Documents\Arduino\libraries\Adafruit-ST7735\Adafruit_ST7735.cpp: In constructor 'Adafruit_ST7735::Adafruit_ST7735(uint8_t, uint8_t, uint8_t)':
\\scsrv1\users\scott.boone\My Documents\Arduino\libraries\Adafruit-ST7735\Adafruit_ST7735.cpp:43:3: error: '_cs' was not declared in this scope
_cs = cs;
^
\\scsrv1\users\scott.boone\My Documents\Arduino\libraries\Adafruit-ST7735\Adafruit_ST7735.cpp:44:3: error: '_rs' was not declared in this scope
_rs = rs;
^
\\scsrv1\users\scott.boone\My Documents\Arduino\libraries\Adafruit-ST7735\Adafruit_ST7735.cpp:45:3: error: '_rst' was not declared in this scope
_rst = rst;
^
\\scsrv1\users\scott.boone\My Documents\Arduino\libraries\Adafruit-ST7735\Adafruit_ST7735.cpp:47:3: error: '_sid' was not declared in this scope
_sid = _sclk = 0;
^
\\scsrv1\users\scott.boone\My Documents\Arduino\libraries\Adafruit-ST7735\Adafruit_ST7735.cpp:47:11: error: '_sclk' was not declared in this scope
_sid = _sclk = 0;
^
\\scsrv1\users\scott.boone\My Documents\Arduino\libraries\Adafruit-ST7735\Adafruit_ST7735.cpp: In member function 'void Adafruit_ST7735::commonInit(const uint8_t*)':
\\scsrv1\users\scott.boone\My Documents\Arduino\libraries\Adafruit-ST7735\Adafruit_ST7735.cpp:462:3: error: 'colstart' was not declared in this scope
colstart = rowstart = 0; // May be overridden in init func
^
\\scsrv1\users\scott.boone\My Documents\Arduino\libraries\Adafruit-ST7735\Adafruit_ST7735.cpp:462:15: error: 'rowstart' was not declared in this scope
colstart = rowstart = 0; // May be overridden in init func
^
\\scsrv1\users\scott.boone\My Documents\Arduino\libraries\Adafruit-ST7735\Adafruit_ST7735.cpp:571:7: error: '_rst' was not declared in this scope
if (_rst) {
^
\\scsrv1\users\scott.boone\My Documents\Arduino\libraries\Adafruit-ST7735\Adafruit_ST7735.cpp: In member function 'void Adafruit_ST7735::initR(uint8_t)':
\\scsrv1\users\scott.boone\My Documents\Arduino\libraries\Adafruit-ST7735\Adafruit_ST7735.cpp:596:5: error: 'colstart' was not declared in this scope
colstart = 2;
^
\\scsrv1\users\scott.boone\My Documents\Arduino\libraries\Adafruit-ST7735\Adafruit_ST7735.cpp:597:5: error: 'rowstart' was not declared in this scope
rowstart = 1;
^
\\scsrv1\users\scott.boone\My Documents\Arduino\libraries\Adafruit-ST7735\Adafruit_ST7735.cpp: In member function 'void Adafruit_ST7735::setAddrWindow(uint8_t, uint8_t, uint8_t, uint8_t)':
\\scsrv1\users\scott.boone\My Documents\Arduino\libraries\Adafruit-ST7735\Adafruit_ST7735.cpp:618:18: error: 'colstart' was not declared in this scope
writedata16(x0+colstart); // XSTART
^
\\scsrv1\users\scott.boone\My Documents\Arduino\libraries\Adafruit-ST7735\Adafruit_ST7735.cpp:621:18: error: 'rowstart' was not declared in this scope
writedata16(y0+rowstart); // YSTART
^
Error compiling.
 
I now have the LC working with both the display and SD functions of the ST7735. There is a page with a link to a download file for the library that does not work. If anyone is interested, the Download link on this page: http://pjrc.com/teensy/td_libs_ST7735.html which points to http://pjrc.com/teensy/arduino_libraries/Adafruit_ST7735.zip is NOT the same as the link on this page:http://pjrc.com/teensy/td_libs.html and the link to the ST7735 library that does work is https://github.com/PaulStoffregen/Adafruit_ST7735.

I did not do exhaustive testing on this yet but my application runs great now using the github version of the Adafruit_ST7735 library. If the link on the Adafruit ST7735 Color TFT Display Library page is bad as I suspect, I hope it will be removed or updated to point to the github version.

Lesson learned is, use this link for the library: https://github.com/PaulStoffregen/Adafruit_ST7735

Sorry if anyone spent any time looking at this. If I learn anything more, I will post it here.
 
I will try to provide some further details in case someone else is attempting to use the TeensyLC with the ST7735. I physically connected the TeensyLC to the display/SD module like this:
SCLK 13
MOSI 11
TFT_CS 10
DC 15
RST 9
SD_CS 4

These pin assignments are consistent with the information given in the example program shown here: http://pjrc.com/teensy/td_libs_ST7735.html
The download link on that same page for the library for the ST7735 does not work for this example at the time of this writing.

This example uses the "five wire" display interface:
Adafruit_ST7735 tft = Adafruit_ST7735(cs, dc, mosi, sclk, rst);

Replace your existing Adafruit-ST7735 library with this one: https://github.com/PaulStoffregen/Adafruit_ST7735

The remainder of my program is mostly inconsequential for this exercise and difficult to replicate by other users since its purpose is to communicate with a bootloader for Atmel microcontrollers and to update the application code on the Atmel micro it resides on with a .hex file that is on the SD card attached to the ST7735 display.
 
Last edited:
Status
Not open for further replies.
Back
Top