Hello,
I seem to be having trouble getting my OLED display to work using HW SPI. To test I am using the "Hello World" program in the u8g2 library examples (full buffer) using the software SPI first.
Uncommenting this constructor:
U8G2_SSD1322_NHD_256X64_F_4W_SW_SPI u8g2(U8G2_R0, /* clock=/ 52, / data=/ 51, / cs=/ 53, / dc=/ 49, / reset=*/ 48); // Enable U8G2_16BIT in u8g2.h
The SW SPI works flawlessly, but I want to try and get HW SPI working for speed reasons.
When I swap to this constructor:
U8G2_SSD1322_NHD_256X64_F_4W_HW_SPI u8g2(U8G2_R0, /* cs=/ 53, / dc=/ 49, / reset=*/ 48); // Enable U8G2_16BIT in u8g2.h
It doesn't work at all (just a blank screen).
Things I've done:
-
Used a logic level converter module (for 4 of the 5v signals and used a 4.7K resistor for the fifth wire to be dropped down to 3.3v)
-
Enabled U8G2_16BIT in u8g2.h
-
Checked the pins_arduino.h file to determine default HW pins for SPI using a Mega. Found the following:
#define PIN_SPI_SS (53)
#define PIN_SPI_MOSI (51)
#define PIN_SPI_MISO (50)
#define PIN_SPI_SCK (52)
static const uint8_t SS = PIN_SPI_SS;
static const uint8_t MOSI = PIN_SPI_MOSI;
static const uint8_t MISO = PIN_SPI_MISO;
static const uint8_t SCK = PIN_SPI_SCK;
I don't have any pin on the display connected to MISO pin 50 as I don't know if it needs it or not? and wouldn't know what to connect it to as nothing looked to be obviously labelled for MISO
Can anyone suggest other things for me to try? I've used other smaller displays with Unos and they work flawlessly using the u8g2 lib using HW SPI. This is the only one i've had trouble with so far.
I am a beginner to Arduino with about 6 months experience so I apologise if i've missed something obvious
Cheers,
Adam