The one IC on the back appears to be a voltage regulator. Based on the top marking "65Z5", it is at least similar to Torex XC6206, which regulates to 3V/250mA from max input of 6V. There is an un-populated jumper between input and output. I suppose it is used to bypass the regulator. The soldering job is not great; I had to clean up a little.
The backlight LED takes 23mA at 3V.
The header pins are
- GND
- VCC
- NC
- NC
- NC
- RESET
- A0
- SDA
- SCL
- CS
- SCK
- MISO
- MOSI
- SD_CS
- LED+
- LED-
LED+, SD_CS, MOSI and SCK have 4.7-Ohm series resistors. LED- is shorted to GND. The display is advertised to work with Arduino, but it appears to take only 3V input.
There is some confusion as to how the signals should be connected. The SPI signals are connected to the SD card socket. SDA/SCL seem like I2C signals, but according to the ST7735R data sheet, the 4-wire SPI (SPI4W) mode, RESET, CS, D/C, SDA and SCL are used. A0 is the D/C (data/cmd) pin. It does not seem to follow I2C protocol. However, SDA is bidirectional.
The SD card pin out is as follows
- SD_CS
- MOSI
- GND
- VDD
- SCK
- GND
- MISO
- NC
- NC
The SD card VDD supply range is 2.7 to 3.6V. As far as I tell, the SD SPI is unrelated to the display SPI.
The Adafruit-ST7735 library can be used to test. It has the option of using software or hardware SPI. The software option worked, but the hardware option did not work. The wiring is as follows,
People have reported that the display can also run on Orange Pi. The device is supported by notro's fbtft, with built-in support for Adafruit 1.8". The wiring is as follows,
I need to go back to see why I was not able to run the display with hardware SPI.
ucglib is another library to try, https://github.com/olikraus/ucglib . Again the software SPI works, but hardware SPI does not.
I powered both the arduino and the display with 3.3V. The hardware SPI worked. (I mistakenly used D12 as DC, which compounded the problem. D12 is MISO.) Even the software SPI behaved a little better (without the some flicking). So the hardware is fine running 3.3V (drawing about 55mA).
Orange Pi is running at 3.3V, so there are still some configuration issues. One possibility is the GPIO numbering. In the GPIO driver, the number is given by (position of letter in alphabet - 1) * 32 + pin number. Pin 12 is PD14 would be 110. So I made the following connections,
- CS -D10
- RST - D8
- A0 (DC) - D9
- SCL - D13
- SDA - D11
- LED+ - 3v3
- VCC - 5V
- GND - GND
People have reported that the display can also run on Orange Pi. The device is supported by notro's fbtft, with built-in support for Adafruit 1.8". The wiring is as follows,
- LED+ - GPIO18 (12)
- SCL - SCLK (23)
- SDA - MOSI (19)
- CS - CE0 (24)
- A0 - GPIO24 (18)
- RST - GPIO25 (22)
- VCC - 3.3V (1 or 17)
- GND - GND (6,9,14,20,25,30,34 or 39)
The Orange Pi 40-pin header is compatible with the Raspberry Pi. If different pins are used for RST DC, and LED, they have to be specified on the drive parameter gpios. The numbering refers to GPIO_GENn. The GPIO18 controls the backlight, but it probably is incapable of sourcing 20-30mA LED drive current. To load the driver,
But it did not work; the kernel message is as followssudo modprobe fbtft_device name=adafruit18
[ 163.068275] fbtft_device: SPI devices registered:The problem I think is the GPIO numbering is different from RPi. GPIO18,24,25 are invalid on OPi. These pins should be GPIO1,5,6 respectively and have to be specified.
[ 163.068296] fbtft_device: spidev spi0.0 33000kHz 8 bits mode=0x00
[ 163.068305] fbtft_device: 'fb' Platform devices registered:
[ 163.068374] fbtft_device: Deleting spi0.0
[ 163.068799] fbtft_device: GPIOS used by 'adafruit18':
[ 163.068815] fbtft_device: 'reset' = GPIO25
[ 163.068822] fbtft_device: 'dc' = GPIO24
[ 163.068829] fbtft_device: 'led' = GPIO18
[ 163.068836] fbtft_device: SPI devices registered:
[ 163.068845] fbtft_device: fb_st7735r spi0.0 32000kHz 8 bits mode=0x00
[ 163.075420] fb_st7735r spi0.0: fbtft_request_gpios: gpio_request_one('reset'=25) failed with -22
- LED+ - GPIO1 (12)
- SCL - SCLK (23)
- SDA - MOSI (19)
- CS - CE0 (24)
- A0 (DC) - GPIO5 (18)
- RST - GPIO6 (22)
- VCC - 3.3V (1 or 17)
- GND - GND (39)
sudo modprobe fbtft_device name=adafruit18 gpios=reset:6,dc:5,led:1 speed=16000000 fps=25 rotate=90
[ 150.480421] fbtft_device: SPI devices registered:The data sheet specifies the min serial clock cycle time is 66ns for write and 150ns for read. Even for just writing, the max clock frequency is 15MHz. Even though the driver seemed to load correctly, I was unable to display anything. Lowering the SPI clock rate did not help.
[ 150.480440] fbtft_device: spidev spi0.0 33000kHz 8 bits mode=0x00
[ 150.480449] fbtft_device: 'fb' Platform devices registered:
[ 150.480517] fbtft_device: Deleting spi0.0
[ 150.481116] fbtft_device: GPIOS used by 'adafruit18':
[ 150.481128] fbtft_device: 'reset' = GPIO6
[ 150.481135] fbtft_device: 'dc' = GPIO5
[ 150.481142] fbtft_device: 'led' = GPIO1
[ 150.481148] fbtft_device: SPI devices registered:
[ 150.481158] fbtft_device: fb_st7735r spi0.0 16000kHz 8 bits mode=0x00
[ 151.462000] graphics fb8: fb_st7735r frame buffer, 160x128, 40 KiB video memory, 4 KiB buffer memory, fps=25, spi0.0 at 16 MHz
I need to go back to see why I was not able to run the display with hardware SPI.
ucglib is another library to try, https://github.com/olikraus/ucglib . Again the software SPI works, but hardware SPI does not.
I powered both the arduino and the display with 3.3V. The hardware SPI worked. (I mistakenly used D12 as DC, which compounded the problem. D12 is MISO.) Even the software SPI behaved a little better (without the some flicking). So the hardware is fine running 3.3V (drawing about 55mA).
Orange Pi is running at 3.3V, so there are still some configuration issues. One possibility is the GPIO numbering. In the GPIO driver, the number is given by (position of letter in alphabet - 1) * 32 + pin number. Pin 12 is PD14 would be 110. So I made the following connections,
- LED+ - 3.3V
- SCL - SCLK (23)
- SDA - MOSI (19)
- CS - CE0 (24)
- A0 (DC) - GPIO7 (29)
- RST - GPIO8 (31)
- VCC - 3.3V (1)
- GND - GND (39)
The driver is loaded with
sudo modprobe fbtft_device name=adafruit18 gpios=reset:8,dc:7,led:1 speed=16000000 fps=25 rotate=90
[ 256.212355] fbtft_device: SPI devices registered:Run fbset -i -fb /dev/fb8
[ 256.212376] fbtft_device: spidev spi0.0 33000kHz 8 bits mode=0x00
[ 256.212387] fbtft_device: 'fb' Platform devices registered:
[ 256.212462] fbtft_device: Deleting spi0.0
[ 256.212916] fbtft_device: GPIOS used by 'adafruit18':
[ 256.212930] fbtft_device: 'reset' = GPIO8
[ 256.212938] fbtft_device: 'dc' = GPIO7
[ 256.212946] fbtft_device: 'led' = GPIO1
[ 256.212953] fbtft_device: SPI devices registered:
[ 256.212964] fbtft_device: fb_st7735r spi0.0 16000kHz 8 bits mode=0x00
[ 257.122269] graphics fb8: fb_st7735r frame buffer, 160x128, 40 KiB video memory, 4 KiB buffer memory, fps=25, spi0.0 at 16 MHz
mode "160x128"
geometry 160 128 160 128 16
timings 0 0 0 0 0 0 0
nonstd 1
rgba 5/11,6/5,5/0,0/0
endmode
Frame buffer device information:
Name : fb_st7735r
Address : 0
Size : 40960
Type : PACKED PIXELS
Visual : TRUECOLOR
XPanStep : 0
YPanStep : 0
YWrapStep : 0
LineLength : 320
Accelerator : No
It is tested with a self portrait,
sudo fbi -d /dev/fb8 -T 1 -noverbose -a KMR18.jpg
The frame buffer can be directly written to, e.g.
dd if=/dev/zero of=/dev/fb8 bs=2 count=20KTo run console, map a tty to the fb with con2fbmap 2 8 . The login prompt displays when switched to tty2.
dd if=/dev/random of=/dev/fb8 bs=2 count=20K
The next step is to run X windows on it. I created X11 config file and run startx as the second display. The X Window did run on the display; but the X Windows on the HDMI display disappears.
To start the display on boot, add the kernel module to /etc/modules and parameters to /etc/modprobe.d/fbtft_device.conf .
Thanks - I have the exact same board and I've been struggling to make it work even I read a lot of articles from the web. After reading the guide I was able to hook up the screen with my orange pi zero plus 2! Thanks!
ReplyDeleteThanks
ReplyDeleteSo much to the blogger for sharing such a wealth of content!
UK TFT LCD Touch Display suppliers