What can an UNO do that a Teensy 4.0 can not?

Header pins come preinstalled
with my Mini Platform, the display SD card CS is not connected
Pulled SD CS pin from CABLE used on one unit and put on end pin #41 and it works with that display - maybe the one I got AMZN - if not parts and silkscreen looks identical to another that was from ProtoSupplies.

Cardinfo sketch and also output from @jim lee posted above.
Code:
Initializing SD card...Wiring is correct and a card is present.

Card type: SDHC

Volume type is FAT32

Volume size (Kbytes): 30518272
Volume size (Mbytes): 29803

Looks like SD card worked!
 
I thought the speed limit for SPI was officially 30MHz. Maybe it could go up to 40. How well does 80MHz work?
Have been using 60 here with useFrameBuffer(true) no problem playing Tetris. Just set to 80 MHz and it plays well nice and smooth with touch controls on screen.

Edited this to work with the ST7796_t3 - apparently higher is better. TEST 3 seems proportional direct to SPI clock.
...\libraries\ST7735_t3\examples\SpeedTest\SpeedTest.ino

Stats only sent to display, edited to send to SerMon as well and this is the result at three speeds edited in ...\libraries\ST7735_t3\src\ST7735_t3.h

#define ST7735_SPICLOCK 60000000
Code:
Test  1: 3.15
Test  2: 24.00
Test  3: 4.00
Test  4: 136.43
Test  5: 7.24
Test  6: 4.20
Test  7: 3.14
Test  8: 3.23
Test  9: 1.74
Test 10: 3.15
Test 11: 2.44
Test 12: 2.06
Test 13: 9.01
Test 14: 8.04
Test 15: 5.38

Total  : 4.22

FPS    : 227.12

#define ST7735_SPICLOCK 80000000
Code:
Test  1: 4.16
Test  2: 27.00
Test  3: 5.19
Test  4: 191.00
Test  5: 9.40
Test  6: 5.10
Test  7: 4.11
Test  8: 4.31
Test  9: 2.27
Test 10: 4.03
Test 11: 3.00
Test 12: 2.47
Test 13: 11.40
Test 14: 10.34
Test 15: 7.03

Total  : 5.37

FPS    : 284.25

#define ST7735_SPICLOCK 30000000
Code:
Test  1: 1.57
Test  2: 15.43
Test  3: 2.04
Test  4: 79.58
Test  5: 3.62
Test  6: 2.57
Test  7: 1.58
Test  8: 1.65
Test  9: 0.87
Test 10: 1.57
Test 11: 1.40
Test 12: 1.37
Test 13: 4.79
Test 14: 4.07
Test 15: 2.72

Total  : 2.27

FPS    : 124.95
 
It does technically violate the NXP spec, but we have seen no issues at that speed and as @defragster mentioned the speed increase seems pretty linear when running benchmarks.

This is on a baseboard with 6-8cm SPI traces and 56 ohm series resistors on CLK and MOSI. A breadboard setup would probably struggle at these higher speeds.
 
on a baseboard with 6-8cm SPI traces and 56 ohm series resistors on CLK and MOSI.
NOTE: on this one - a 4" ribbon cable to the display as well.
- not a MINI as shipped in this case.
- still showing perfect operation at 80 MHz with DMA > tft.useFrameBuffer(true)
 
API As provided by the driver library noted above: _spiSettings = SPISettings(ST7735_SPICLOCK, MSBFIRST, mode);

Code:
void ST7735_t3::drawPixel(int16_t x, int16_t y, uint16_t color)
{
    x += _originx;
    y += _originy;
    
    if((x < _displayclipx1) ||(x >= _displayclipx2) || (y < _displayclipy1) || (y >= _displayclipy2)) return;

    #ifdef ENABLE_ST77XX_FRAMEBUFFER
    if (_use_fbtft) {
    updateChangedRange(x, y); // update the range of the screen that has been changed;
        _pfbtft[y*_width + x] = color;

    } else
    #endif
    {
        beginSPITransaction();
        setAddr(x,y,x+1,y+1);
        writecommand(ST7735_RAMWR);
        writedata16_last(color);
        endSPITransaction();
    }
}
 
So I can open and read files from the SD card. The backlight comes on and off as it should. But I can't get the screen to draw at all. Can you sanity check my test code?

thanks!

C++:
#include <SD.h>
#include <colorObj.h>
#include <ST7796_t3.h>
#include <st7735_t3_font_Arial.h>

// pins
#define DSP_CS    10
#define SD_CS     4
#define DSP_RST   26
#define SCREEN_PIN  25


ST7796_t3 tft(DSP_CS, DSP_RST);

void setup() {

   char  aChar;

   analogWrite(SCREEN_PIN,0);                            // Backlight off.                              
   Serial.begin(9600);                                   // Start serial.
   delay(2000);                                          // Wait for along time for things like the Mac to get ready.
   pinMode(DSP_RST,OUTPUT);                              // Setup reset pin.
   digitalWrite(DSP_RST,HIGH);                           // Hold high.
   delay(10);                                            // For a bit.
   digitalWrite(DSP_RST,LOW);                            // Hold low.
   delay(10);                                            // For a bit.
    digitalWrite(DSP_RST,HIGH);                          // Return to high and leave it there.
   delay(10);                                            // Smoke a quck cigarette..
   tft.init(320, 480);                                   // Do the init() like the example.
   tft.invertDisplay(true);                              // LCD requires colors to be inverted.
   tft.fillScreen(ST7735_RED);                           // Fill screen with color
   analogWrite(SCREEN_PIN,255);                          // Backlight on.
   if (!SD.begin(SD_CS)) {                               // Fire up the SD card.
      Serial.println("Absolutly NO SD CARD!");           // Failed? send an error out the serial port.
   } else {                                              // Success?
      Serial.println("SD.begin() says OK!");             // Tell the world.
      File testFile = SD.open("mary.txt",FILE_READ);     // Open the "mary" file.
      if (testFile) {                                    // See if we can read out the file.
         while(testFile.available()){                    // While we have any bytes left..
            aChar = testFile.read();                     // Read one as a cher.
            Serial.print(aChar);                         // Spit it out to the seial monitor.
         }
      }
   }
}


void loop() { }
 
IDE Question : Where are things like ST7796_t3.h that seems to come with the Teensy, now stored on the Mac? They used to be hidden in the "package contents" of the IDE itself. But now with this 2.x IDE, I'm not finding them.
 
Where are things like ST7796_t3.h that seems to come with the Teensy, now stored on the Mac?

In Terminal, use this command:

cd ~/Library/Arduino15/packages/teensy/hardware/avr/1.60.0/libraries/ST7735_t3/src

Or maybe try this in Terminal to get MacOS Finder to open the hidden folder.

open ~/Library/Arduino15

There's probably some way without Terminal, but I don't know MacOS that well.
 
In Terminal, use this command:

cd ~/Library/Arduino15/packages/teensy/hardware/avr/1.60.0/libraries/ST7735_t3/src

I have no idea how to get MacOS Finder to show you the hidden Library folder in your home directory, but there's probably a way. Maybe people who know more about MacOS might comment?
When a finder window is open, press cmd-shift-period. That'll show you hidden files. It's a toggle. That will also work in any file-related dialogs and such.
 
ST7796_t3.h I'm able to include this library from the .ino file, No problem. Works and everything. But, I'm having troubles wrapping it into a class for a library. This is my basic pattern for wrapping displays I use. So they'll work with my stuff.

I have this.. (snippet sorry)
C++:
#ifndef ST7796_T3_h
#define ST7796_T3_h

#include <displayObj.h>
#include <ST7796_t3.h>
#include <LC_SPI.h>
#include <mask.h>

class maskableST7796_T3 :    public ST7796_t3 {
                               
    public :
                maskableST7796_T3(int cs, int rst);
    virtual    ~maskableST7796_T3(void);
   
    virtual    void drawPixel(int16_t x, int16_t y, uint16_t color);
    //virtual    void writePixel(int16_t x, int16_t y, uint16_t color);
    virtual    void fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color);
};

It isn't complaining about ST7796_t3.h missing or anything. But I get this..
Code:
In file included from /Users/dads/Documents/GIthub/Arduino/handheld/handheld.ino:2:
/Users/dads/Documents/GIthub/Arduino/libraries/LC_ST7796_T3/ST7796_T3.h:10:50: error: expected class-name before '{' token
   10 | class maskableST7796_T3 :       public ST7796_t3 {


And here is, yes I found it, thank you! The ST7796_t3.h file..

C++:
#ifndef __ST7796_t3_H_
#define __ST7796_t3_H_
#include "ST7735_t3.h"

class ST7796_t3 : public ST7735_t3 {

 public:

  ST7796_t3(uint8_t CS, uint8_t RS, uint8_t SID, uint8_t SCLK, uint8_t RST = -1);
  ST7796_t3(uint8_t CS, uint8_t RS, uint8_t RST = -1);

  virtual void  setRotation(uint8_t m);

  void  init(uint16_t width=240, uint16_t height=240, uint8_t mode=SPI_MODE0);
protected:
    uint8_t _colstart2 = 0; // Offset from the right added to handle additional display sizes
    uint8_t _rowstart2 = 0; // Offset from the bottom

};
#endif

Should be a slam dunk. I can't figure our what I missed. Anyone see anything I'm not seeing here?

-jim lee
 
Last edited:
Never mind. It was just mad because the only difference between the two files was capitalization. I thought they were case sensitive? Obviously not.
 
Yeah, everything seems to work fine. I get icons & pictures and everything. Even runs my apps, although they are now all scrunched up in the top left. They have to be rewritten to deal with different size displays. But that's a good thing.
 
I see some of the newer Arduinos are using AI for image recognition. That would be nice to use in Teensy. (Without the latency of an operating system.)
 
Back
Top