SSD1351 OLED display using HW SPI on Teensy 41

Status
Not open for further replies.

SteveBar

Well-known member
Hi All,
I'm trying to get the SSD1351 lib to use HW SPI1 on Teensy 4.1. (SPI1: sclk=27 mosi=26 reset=23 dc=19 cs=38)
Similar to my last question about SPI1 use in the MD_MAX72xx

In file ssd1351.h I replaced all "SPI." with "SPI1." to force the lib to use SPI1 not SPI (aka SPI0)
NOTE: don't change the line "#include <SPI.h>"

Code:
      #define OLED_dc    19
      #define OLED_reset 23      
      #define OLED_cs    38
      #define OLED_mosi  26
      #define OLED_sclk  27
      typedef ssd1351::HighColor Color;
      auto OLEDdisplay = ssd1351::SSD1351<Color, ssd1351::SingleBuffer, 128, 128>(OLED_cs, OLED_dc, OLED_reset, OLED_mosi, OLED_sclk);

THIS DIDN"T WORK! :) and hung the T41.

So I put "Serial.println("...")" statements in SSD1351.h and SPI.cpp...
NOTE: Line numbers below might be off a bit due to inserted .println

Calling: auto OLEDdisplay = ssd1351::SSD1351...
It made it thru validating MOSI and CLK pins (SSD1351.h L~136)

From setup() it calls: OLEDdisplay.begin();
It made it thru the SPI begin (SSD1351.h L~138)

Then...
Fails between lines (SSD1351.h L~162):
pinMode(cs, OUTPUT);
DIRECT_WRITE_HIGH(_csport, _cspinmask);

I don't know how to validate if the pointers _csport & _cspinmask are OK or for SPI not SPI1 etc.... please help if you can! :)

Questions:
1) How can I get the SSD1351 and SPI libs to use the SPI1 of the T41?
2) I am also running a 4x 8x8 LED Matrix via MD_MAX72xx on the same SPI1 - any crystal ball ...it will never work advice? :)


Thanks,
Steve
 
Status
Not open for further replies.
Back
Top