rm-hull / luma.oled

Python module to drive a SSD1306 / SSD1309 / SSD1322 / SSD1325 / SSD1327 / SSD1331 / SSD1351 / SH1106 OLED
https://luma-oled.readthedocs.io
MIT License
810 stars 163 forks source link

Add support for 256x64 4-bit greyscale SSD1322 device #90

Closed thijstriemstra closed 7 years ago

thijstriemstra commented 7 years ago

This 3.2 inch OLED looks awesome, but it's a SSD1322. Can this be supported (easily)?

s-l1600

thijstriemstra commented 7 years ago

Datasheet: http://www.farnell.com/datasheets/303158.pdf

rm-hull commented 7 years ago

Looks relatively straightforward. This seems to be a more detailed data sheet though: http://www.newhavendisplay.com/app_notes/SSD1322.pdf

rm-hull commented 7 years ago

got one of these on order, https://www.aliexpress.com/item/1pcs-3-12-inch-16PIN-Yellow-OLED-Module-SSD1322-Drive-IC-256-64-SPI-8Bit-Parallel/32414142892.html

thijstriemstra commented 7 years ago

I ordered a white one earlier today!

rm-hull commented 7 years ago

Note to self: https://en.wikipedia.org/wiki/Grayscale#Luma_coding_in_video_systems

rm-hull commented 7 years ago

Package arrived today ... standby!

thijstriemstra commented 7 years ago

Arr! Mine hasn't yet but that's ok.. Would love to see a clip/picture.

thijstriemstra commented 7 years ago

Mine arrived as well, but there are no pins on it, and soldering looks hard, e.g. have to disassemble it? Thoughts @rm-hull?

rm-hull commented 7 years ago

Mine looks exactly like the one in https://www.aliexpress.com/item/1pcs-3-12-inch-16PIN-Yellow-OLED-Module-SSD1322-Drive-IC-256-64-SPI-8Bit-Parallel/32414142892.html - 2x8 holes down one side - there are no pins, so it will need some soldering. It doesn't look like it needs to be disassembled though, but must admit I haven't looked in too much detail.

Are the pins inaccessible, or is the fact you have to do some soldering? If the latter, then try and source some solderless headers like these: https://www.sparkfun.com/products/retired/10527

thijstriemstra commented 7 years ago

Another picture (with horrible quality, I don't get this phone) that shows the pins are in the center, unlike yours on the side. So this is not a recommended display to buy. Your solderless headers sound like a good idea but it looks like taking it apart temporarily shouldn't be too hard, I'll try that first.

img_20170117_184932_5cs

thijstriemstra commented 7 years ago

Soldered it, hooked it up, but then realized there's no support yet, but yeah.

rm-hull commented 7 years ago

This is probably the next task.... I think it should be quite similar to the SSD1325 drivrt

rm-hull commented 7 years ago

@thijstriemstra Well I've drafted out a driver for this OLED, but am not getting any signs of life on the device at all ... if I push the WIP to a branch, can you try the code with your device?

thijstriemstra commented 7 years ago

Yep, sounds good. My device has the following connections: one the left side there's the 'TF' section with MISO, SCK MOSI, CS and on the right 'SPI' side there are: RES, CS, DC, SCL, SDA, GROUND and VCC. Do you have the same connections @rm-hull? I guess I'll use connections from both sides if I look at the connection diagram in our docs.

thijstriemstra commented 7 years ago

The ebay page also mentions 5V v.s. the 3.3V in our hardware doc.

thijstriemstra commented 7 years ago

@rm-hull seem results as you (with both 3.3v and 5v): nothing's happening. The ports I used: SCK, MOSI, RES, CS, DC, GND and VCC.

rm-hull commented 7 years ago

ok, well thats \~sort of\~ encouraging, it is unlikely that both of them are broken, more likely the init sequence is wrong.

Also, on the back side, do you see any jumpers similar to BS1 and BS2 below with R18-R21 zero-ohm resistors:

image

If so how are they jumpered?

rm-hull commented 7 years ago

Progress:

image

rm-hull commented 7 years ago

Bingo!

image

image

rm-hull commented 7 years ago
$ cat ssd1322.conf 
--display=ssd1322
--interface=spi
--width=256
--height=64
--spi-bus-speed=16000000
rm-hull commented 7 years ago

@thijstriemstra:

My device has the following connections: one the left side there's the 'TF' section with MISO, SCK MOSI, CS and on the right 'SPI' side there are: RES, CS, DC, SCL, SDA, GROUND and VCC.

The 'TF' section probably refers to the unsoldered SD card slot on your device:

3b23983a-dda4-11e6-981a-fc7fa287b222

The pic is too fuzzy to make any other details out - you need a better 📷 !!

Do you have the same connections @rm-hull?

No, mine is two rows of 8 pins, and is documented like this, and can be configured in SPI or 8-bit parallel mode:

image

I guess I'll use connections from both sides if I look at the connection diagram in our docs.

You should only connect up the pins on the SPI side only, wiring exactly like the docs here: https://luma-oled.readthedocs.io/en/latest/hardware.html#spi

It should work with 3V3 or 5V (mine was 3V3)

rm-hull commented 7 years ago

New demo in examples repo to showcase colour and greyscale rendering:

image

thijstriemstra commented 7 years ago

Holy shit, wow! Awesome work @rm-hull, as always! Gonna test it now. Thanks for the detailed comments, that'll make good documentation as well.

thijstriemstra commented 7 years ago

I'm getting this traceback for the examples:

Traceback (most recent call last):
  File "/home/pi/projects/pi-test/luma.examples/examples/demo_opts.py", line 77, in <module>
    rotate=args.rotate)
  File "/home/pi/projects/pi-test/luma.oled/luma/oled/device.py", line 284, in __init__
    self.command(0xFD, 0x12)        # Unlock IC
  File "/home/pi/projects/pi-test/luma.oled/luma/oled/device.py", line 347, in command
    self._serial_interface.data(args)
  File "/home/pi/projects/pi-test/luma.core/luma/core/serial.py", line 152, in data
    write(data[i:i + 4096])
TypeError: write() argument 1 must be list, not tuple

Hmm

thijstriemstra commented 7 years ago

And here's a picture:

ssd1322_small

rm-hull commented 7 years ago

Re: traceback ... Haven't tried it on python 3 and there are no tests yet, so not trapped by tox/travis

rm-hull commented 7 years ago

Fix for python 3 in commit 63814ef

thijstriemstra commented 7 years ago

You should only connect up the pins on the SPI side only, wiring exactly like the docs here: https://luma-oled.readthedocs.io/en/latest/hardware.html#spi

@rm-hull but my spi side contains SDA and SCL pins and D0 and D1 are not even on there. :(

rm-hull commented 7 years ago

D0 = SCL (clock) D1 = SDA (data) RES = RST (reset)

Probably worth adding some wiring info for different devices

rm-hull commented 7 years ago

@thijstriemstra - did you get your SSD1322 working? I only tried it on a PiZero so far (both Py2.7 and 3.4) and seems to work fine, but it would get glitchy display if I raised the SPI bus speed over 16MHz (this might be something to do with the PiZero... it's not fast)

thijstriemstra commented 7 years ago

I'll test it later tonight.

thijstriemstra commented 7 years ago

@rm-hull unfortunately I didn't get it to work and kind of ready to throw it in the bin :-1: raspberrypi is wonderful but the amount of monkeypatching and trickery needed to get 3rdparty stuff working is disheartening. When I connect the pins on a powered-up RPi I sometimes see a flash on the screen but other than that, nothing.

rm-hull commented 7 years ago

@thijstriemstra That's a bit disappointing 🙁. It's possible that it is configured in parallel mode rather than SPI... I made a comment on this thread about the BS1 and BS2 jumpers -they control the config.

If you want to post it on to me, I'm happy to test it for you, document the wiring connections and then send it back to you.