The SSD1351 is 128x128 color SPI OLED controller, usually associated with a small 1.5" display from EastRising. This solution is both relatively cheap (compared with other OLED displays) and widely available.
Due to its small price and excellent contrast thanks to OLED technology, I thought it would be interesting to connect this display to the C.H.I.P. This is also applicable to the C.H.I.P Pro as the controller is connected through SPI and doesn't require a parallel display interface (DPI) which is only available on the non-pro C.H.I.P.
Despite the horrible i2c-like naming on my board, this is a SPI display so follow these instructions to enable SPI communication on the C.H.I.P.
Now that SPI is enabled, we can wire the C.H.I.P to the display:
GND -> GND VCC-3V3 -> VCC CSICK (U14_28) -> SCL CSIHSYNC (U14_29) -> SDA CSID5 (U14_36) -> RES CSID3 (U14_34) -> DC CSIPCK (U14_27) -> CS
sudo modprobe fbtft_device custom name=fb_ssd1351 buswidth=8 busnum=32766 speed=10000000 gpios=reset:137,dc:135 bgr=1 init=-1,0xFD,0x12,-1,0xFD,0xB1,-1,0xAE,-1,0xB3,0xF1,-1,0xCA,127,1,0xA0,0x74,-1,0x15,0x00,0x7F,-1,0x75,0x00,0x7F,-1,0xA1,128,1,0xA2,0x0,-1,0xB5,0x00,-1,0xAB,0x01,-1,0xB1,0x32,-1,0xBE,0x05,1,0xA6,-1,0xC1,0xC8,0x80,0xC8,-1,0xC7,0x0F,1,0xB4,0xA0,0xB5,0x55,-1,0xB6,0x01,-1,0xAF,-3
lsmod command should display that fbtft is loaded:
fb_ssd1351 4564 1 fbtft_device 29876 0 fbtft 25864 2 fb_ssd1351,fbtft_device
This is confirmed by
[ 187.215000] fbtft: module is from the staging directory, the quality is unknown, you have been warned. [ 187.250000] fbtft_device: module is from the staging directory, the quality is unknown, you have been warned. [ 187.260000] spidev spi32766.0: spidev spi32766.0 1000kHz 8 bits mode=0x00 [ 187.270000] spidev spi32766.0: Deleting spi32766.0 [ 187.275000] fbtft_device: GPIOS used by 'fb_ssd1351': [ 187.285000] fbtft_device: 'reset' = GPIO137 [ 187.285000] fbtft_device: 'dc' = GPIO135 [ 187.290000] spi spi32766.0: fb_ssd1351 spi32766.0 10000kHz 8 bits mode=0x00 [ 187.310000] fb_ssd1351: module is from the staging directory, the quality is unknown, you have been warned. [ 187.620000] graphics fb1: fb_ssd1351 frame buffer, 128x128, 32 KiB video memory, 4 KiB DMA buffer memory, fps=20, spi32766.0 at 10 MHz
The device will now appear on your filesystem as
Finally, you can test the setup by displaying an image to the framebuffer using
sudo apt-get -y install fbi wget http://art110.wikispaces.com/file/view/Mystery-100x100.jpg/30649064/Mystery-100x100.jpg sudo fbi -d /dev/fb1 -T 1 -noverbose -a Mystery-100x100.jpg
The whole image is shifted by a few rows. It can probably be fixed by changing the fbtft_device init sequence (init=...)
If you can find the right init sequence according to the SSD1351 datasheet, please share it.
To use your fbtft device from higher-level graphics libraries
and take advantage of the MALI 400 for OpenGL ES 2.0 acceleration, you can install DirectFB and SDL2.