Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 6 of 6

Thread: Teensy 3.2 and Waveshare 1.5inch RGB OLED

  1. #1
    Junior Member
    Join Date
    Jul 2021
    Posts
    2

    Teensy 3.2 and Waveshare 1.5inch RGB OLED

    Hey all,
    Ive been trying to set up my Teensy 3.2 with an OLED module (Waveshare 1.5inch RGB OLED) using SPI.

    Im working with this SSD13XX library
    And Im compiling this example

    I have uncommented the proper line in the library settings, and re-commented the default as per the instructions state (#include "../_display/SSD_1351_128x128.h").

    I have RS tied to 3.3v
    DC Tied to pin 9
    CS tied ti pin 10
    CLK tied to pin 13
    DIN tied to pin 12

    I confirmed that the code makes it to the else block that has tft.print("Ready!"); and no errors are printing to the serial monitor.
    Thanks in advance for your help.

    Code paste below

    Code:
    #include <SPI.h>
    #include <SSD_13XX.h>
    
    /*
    Teensy3.x and Arduino's
    You are using 4 wire SPI here, so:
    MOSI:  11//Teensy3.x/Arduino UNO (for MEGA/DUE refere to arduino site)
    MISO:  12//Teensy3.x/Arduino UNO (for MEGA/DUE refere to arduino site)
    SCK:   13//Teensy3.x/Arduino UNO (for MEGA/DUE refere to arduino site)
    ESP8266-----------------------------------
    Use:
    #define __CS  16  //(D0)
    #define __DC  5   //(D1)
    #define __RST 4   //(D2)
    
    SCLK:D5
    MOSI:D7
    */
    #define __CS1   10
    #define __DC  9
    /*
    Teensy 3.x can use: 2,6,10,15,20,21,22,23
    Arduino's 8 bit: any
    DUE: check arduino site
    If you do not use reset, tie it to +3V3
    */ 
    
    uint8_t errorCode = 0;
    
    SSD_13XX tft = SSD_13XX(__CS1, __DC);
    
    void setup() {
      Serial.begin(38400);
      Serial.println("TEST");
      pinMode(6, OUTPUT);
      digitalWrite(6, HIGH);
      long unsigned debug_start = millis();
      while (!Serial && ((millis() - debug_start) <= 5000));
      Serial.println("serial ok, testing lib...");
      tft.begin();
      
      //the following it's mainly for Teensy
      //it will help you to understand if you have choosed the
      //wrong combination of pins!
      errorCode = tft.getErrorCode();
      if (errorCode != 0) {
        Serial.print("Init error! ");
        if (bitRead(errorCode, 0)) Serial.print("MOSI or SCLK pin mismach!\n");
        if (bitRead(errorCode, 1)) Serial.print("CS or DC pin mismach!\n");
      }
      else {
        tft.print("Ready!");
        Serial.println("SDASD");
      }
    }
    
    
    void loop(void) {
    
    }

  2. #2
    Senior Member
    Join Date
    Nov 2012
    Posts
    1,721
    I think the display's DIN should be on Teensy pin 11. The display only has input, so its DIN corresponds to what SPI usually calls MOSI (Master Out, Slave In, in this case Teensy is the Master).
    DIN on the Teensy 3.2 refers to input to the Teensy but the display doesn't send to the Teensy - this pin is what SPI refers to as MISO.

    Pete

  3. #3
    Junior Member
    Join Date
    Jul 2021
    Posts
    2
    Thanks for the reply.
    Just tried it on pin 11 and still nothing on the screen.

  4. #4
    Senior Member
    Join Date
    Nov 2012
    Posts
    1,721
    It may be that it is not initializing SPI for you. Try this:
    Code:
      tft.begin(false);
    The begin method requires a boolean value telling it whether to call SPI.begin() for you. When you don't specify a value it will see a random value on the stack which is almost certainly not zero which will make it avoid calling SPI.begin().
    Alternately, you could use begin(true) and add a call to SPI.begin() in your setup function before calling tft.begin(true).

    Pete

  5. #5
    Senior Member
    Join Date
    Nov 2012
    Posts
    1,721
    Ahhh, rats. Somehow I missed the declaration of begin() in SSD13XX.h where it defaults to false anyway.

    Pete

  6. #6
    Senior Member
    Join Date
    Nov 2012
    Posts
    1,721
    I think the wiring is correct so the only thing I can suggest is to post a photo of the wiring between Teensy and display.

    Pete

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •