tony1812
Posts: 354
Joined: Sat Jul 15, 2017 12:40 pm
Location: Boston MA.

i2c or spi?

Tue Feb 06, 2018 5:47 pm

Hello, I brought this tiny monitor from Amazon https://www.amazon.com/gp/product/B0755 ... UTF8&psc=1

But I am a bit confused if it is I2C or SPI. It has 7 pins, GND, VCC, SCL, SDA, RES, DC and CS.
Because of the SCL and SDA pins, I assumed that it is I2C, but when I run i2cdetect, it shows no i2c address. However, if it is SPI shouldn't it has MOSI MISO pins? Thanks

davef
Posts: 59
Joined: Wed Feb 20, 2013 8:39 pm
Location: Christchurch, NZ

Re: i2c or spi?

Tue Feb 06, 2018 6:15 pm

Your assumptions are correct, but looking at the picture I see a CS pin, which is normally associated with SPI.

Another image comes up showing a part which says IIC in the description and has fewer pins.

There could be many other reasons why you don't get the correct response to i2cdetect.

Datasheet required.

User avatar
joan
Posts: 14269
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: i2c or spi?

Tue Feb 06, 2018 6:52 pm

There is a linked rar archive (from the Amazon product page). A quick look suggests it may be SPI but you would need to go through the rar in detail.

tony1812
Posts: 354
Joined: Sat Jul 15, 2017 12:40 pm
Location: Boston MA.

Re: i2c or spi?

Tue Feb 06, 2018 9:41 pm

Thanks all for the replies. nowhere in the link mention it is either i2c or spi. I guess I just to trial and error to find out. Could it be some sort of hybrid works on both i2c and spi?

User avatar
joan
Posts: 14269
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: i2c or spi?

Wed Feb 07, 2018 6:15 pm

The core chip (the SSD1331) probably supports I2C, 3-wire and 4-wire SPI, and probably a parallel interface. Generally the hobby modules constructed around the core chip only support one of I2C or 4-wire SPI.

tony1812
Posts: 354
Joined: Sat Jul 15, 2017 12:40 pm
Location: Boston MA.

Re: i2c or spi?

Wed Feb 07, 2018 11:41 pm

So how do I know whether to use i2c or not? I have a 1-bit black and white version in i2c which has only 4 wires, scl, sda, vcc and gnd. I don't know where to start on this color one, I tried use only the 4 wires scl, sad, vcc and end as i2c with no result. But the CS wires indicates it may be spi. but where are the mosi and miso? What to do?

tony1812
Posts: 354
Joined: Sat Jul 15, 2017 12:40 pm
Location: Boston MA.

Re: i2c or spi?

Wed Feb 07, 2018 11:50 pm

so if anyone knows, please tell me how to hook up this oled on pi 3? I googled but they shows either i2c or spi with clear defined mosi and miso. this looks like a i2c but with the cs pin and no mosi miso pins What to do? Thanks
Last edited by tony1812 on Thu Feb 08, 2018 12:53 pm, edited 1 time in total.

User avatar
joan
Posts: 14269
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: i2c or spi?

Thu Feb 08, 2018 8:31 am

I remember the rar had circuit diagrams. I think I saw one of the pins labelled as slave select (a SPI signal) on one of the circuit diagrams.

ddahms
Posts: 67
Joined: Tue Mar 18, 2014 3:38 pm

Re: i2c or spi?

Thu Feb 08, 2018 5:34 pm

I think the board labels are confusing. The SSD1331 chip supports SPI (plus two archaic parallel modes) but not I2C. The SSD1331 datasheet and board schematic are in the rar. In SPI mode, data goes in on the D1 pin of the chip which is labeled SDA on the board. Clk goes in on D0 which is labeled SCL. I think you should connect SDA to MOSI, SCL to SCK, and CS to CEO. There is no data output from the module so nothing connects to MISO. The DC pin chooses between Commands or Data and should be connected to a GPIO pin.

tony1812
Posts: 354
Joined: Sat Jul 15, 2017 12:40 pm
Location: Boston MA.

Re: i2c or spi?

Sat Feb 10, 2018 12:48 pm

joan wrote:
Thu Feb 08, 2018 8:31 am
I remember the rar had circuit diagrams. I think I saw one of the pins labelled as slave select (a SPI signal) on one of the circuit diagrams.
Haha, I must be blind or need to get my eyes checked out or something. I ask around people keep mention the rar file, where is it? I couldn't find it on the Amazone link. :oops:

tony1812
Posts: 354
Joined: Sat Jul 15, 2017 12:40 pm
Location: Boston MA.

Re: i2c or spi?

Sat Feb 10, 2018 12:51 pm

ddahms wrote:
Thu Feb 08, 2018 5:34 pm
I think the board labels are confusing. The SSD1331 chip supports SPI (plus two archaic parallel modes) but not I2C. The SSD1331 datasheet and board schematic are in the rar. In SPI mode, data goes in on the D1 pin of the chip which is labeled SDA on the board. Clk goes in on D0 which is labeled SCL. I think you should connect SDA to MOSI, SCL to SCK, and CS to CEO. There is no data output from the module so nothing connects to MISO. The DC pin chooses between Commands or Data and should be connected to a GPIO pin.
Thanks for pointing that out. You think the labelling is confusing as well? Thanks. I thought it was just me. A dumb newbie. :)

tony1812
Posts: 354
Joined: Sat Jul 15, 2017 12:40 pm
Location: Boston MA.

Re: i2c or spi?

Mon Feb 12, 2018 8:49 pm

I think I got the naming convention now.

SDA=MOSI->GPIO2(BCM3)
SCL=SCK=CLK=SCLK->GPIO3(BCM5)
RES=REST->GPIO24(BCM18)
CS=CE0=CS0->GPIO16(BCM36)
DC->GPIO23(BCM16)
VC->3.3V
GND->GND

Does this look right?

ddahms
Posts: 67
Joined: Tue Mar 18, 2014 3:38 pm

Re: i2c or spi?

Tue Feb 13, 2018 4:35 pm

This repo has example code and a pictorial connection diagram.
https://gist.github.com/TheRayTracer/dd ... ecb9b8b47f

Return to “Beginners”