SOLVED - SSD1309 with SPI to Arduino Micro help

I have one of these generic Aliexpress 2.42in OLED displays that support both SPI and I2C.

I have a smaller 0.96in I2C oled which I have been able to get running no problems but it is a touch small and I will have a few input shift registers on the I2C and SPI should be faster so wanted to run the bigger display in the default mode of SPI.

I am having difficulty finding the correct wiring schematic for the SPI connection to the Micro, I have read a ton but can't map the pins from the Micro to the display. The display has CS, DC, and RES which should be all I need to connect.

All my reading on SPI on a Micro talks about MISO and MOSI but these don't relate to the pins that I have on the board. Also unsure if I have to use the ICSP header or if the SPI pins are also mapped to the main pins as well.

I am looking at the U8X8 library for simple text display and it references the pin numbers on the Micro for the 3 data connections ie :-

U8X8_SSD1309_128X64_NONAME2_4W_HW_SPI u8x8(/* cs=/ 12, / dc=/ 4, / reset=*/ 6);

The OLED board has 7 pins for the SPI connection however I believe that I only need 5, power, ground and CS, DC and RST. Extensive reading seems to show that the other 2 pins are for when you switch it to I2C mode.

Link to the actual board I have :-
2.4" 2.42 Inch 128x64 OLED LCD Display Module SSD1309 12864 4 Pin IIC I2C SPI Serial Interface for Arduino C51 - AliExpress

Appreciate any assistance on this.

Cheers
Matt

I believe they are mapped to the pins at the far end from the USB connector: MOSI, SCK, and MISO, right?

Micro Pinout

Thanks for the reply, happy re the pins on the micro. The pins on the OLED are CS, DC,RES,SDA,SCLK,VDD and VSS. Any thoughts on how these should map to the Micro?

Cheers
Matt

If you didn't already, I'd try:

Display Micro
SDA MOSI
SCLK SCK
VDD 5V
VSS GND
CS 12*
DC 4*
RES 6*

* or whichever pin you set in the constructor

I believe you will need the full 7.
SDA carries the commands / data to display.
SCLK tells the display when the next bit of data is available on SDA .
CS tells the display when to ignore the Arduino and when to listen.
DC tells the display whether the SDA data is a command or image data.
RST resets the display.

(All hugely oversimplified, but gives a general idea hopefully)

It's not asking about the other pins because, with Arduino Micro, I don't believe (?) that you have the freedom to move the SPI pins around; the library already knows exactly where you're going to be connecting SDA and SCLK.

Thanks so much for your help Toddnz - followed your mapping and it worked perfectly....

Cheers
Matt

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.