Iāve trying to get my OLED via SPI to work, but these pins are very confusing to me.
To the left is what my OLED reads, and on the right is the pins Iāve tried to use on my Electron
Data - D2
Clk - D4
DC/SA0 - D1 (?)
Rst - D6 (guess this can be any output pin?)
CS - D5
3v3 - 3V3
Vin - empty
Gnd - Gnd
Where do I go wrong? Iām interpreting the Data pin on the OLED to be the MOSI, and the DC/SA0 Iām not really sure aboutā¦
Iām using the Adafruit_ssd1306 library, with these commands:
The code compiles and all. Iām using the same code Iāve been running but on an I2C OLED, so I figure the code itself does not need any change apart from the parts above.
Edit: Also used the example that you posted @ScruffR but no success. From the datasheets Iāve looked at thereās also no difference in pins between the core/photon and electron.
My OLED reads āBus deafult SPI4ā. Does this change something?
@ScruffR could you advise me on whether this display will work with Electron?
It has one less pin than the SPI display Iām using atm. Is this a 3-wire SPI? And what would I translate SCL & SDA to? Guessing SCL = SPI CLK and SDA = SPI MOSI? But how does the CS/SS work then?
@ftideman, if the link is the exact display, take a look at the back and tell us which of the R1, R2, R3 and R4 resistors are installed on the board. These configure the communication method. As pictured in the link, it is configured for 4-wire SPI.
Yeah sorry @peekay123, I noticed that just after posting. Should be more well-read before asking.
So yeah itās configured for 4-wire SPI. But where did the CS (presuming my translation of the SDA & SCL in my post above were correct) go? And can I run the display without it?
@ftideman, I did some digging and got to their site to download the arduino libraries. They are Adafruit libraries. Based on this, Iām not sure how they get 4-wire SPI but based on their Use demo.txt file:
/*******************************/
Wireling Guide:
--------------------------------
| OLED Photon
|--------------
| GND GND
| VCC 5V or 3.3V
| SCL A3 (SCK)
| SDA A5 (MOSI)
| RES D2 (or any GPIO pin)
| DC D3 (or any GPIO pin)
/*******************************/
#define OLED_CLK A3 // OLED SCL
#define OLED_MOSI A5 // OLED SDA
#define OLED_RESET D2 // OLED RES
#define OLED_DC D3 //OLED DC
#define OLED_CS A2 //CS pin has been connected to GND onboard, so we ignore this definition
Adafruit_SSD1306 display(OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS);
Notice that there is no CS line. Thatās because they tied it to GND on the board meaning you canāt have other devices on the SPI bus!!!
Tried tying my CS line from my current screen to electronās ground which works. And Iām not going to run any other SPI devices on my current setup so thatās completely fine!