Dear all,
I’m having some OLED Display lying around here, which I want to connect to my VIM3. One is driven by SSD1309, the other by SSD1351, both can be connected via SPI having the same pin-outs:
GND Ground
VCC VCC 3.3V
SCL/CLK Clock
SDA/CS SPI
RES/RST Reset
DC/DIN Data
CS1/CS ChipSelection
I already did some searching here, which lead me to this pin-out for VIM2 (Oled Display connection to VIM GPIO - #9 by Gouwa). For VIM3 it seems to be a little bit different. What I did so far, I enabled the spidev first editing the dtb to enable spicc1, disabling pwm_ef. That seemed to be successsful (/dev/spidev0.0 is there). That lead me to the GPIO Header/schematics (as referenced in VIM3L GPIO capability - #3 by quatro) the VIM3 seem to has the following pin out for SPI:
VIM3 SPI:
PIN37: GPIOH_4/SPIB_MOSI
PIN35: PWM_F/SPIB_MISO
PIN15: UARTC_RX/SPIB_SS
PIN16: UARTC_TX/SPIB_SCLK
So I tried to conclude with VIM3 GPIO Pinout | Khadas Documentation but failed:
1.GND (power ground) ------------------- VIM3 PIN 28
2.VCC (power supply positive) ---------- VIM3 PIN 27
3.SCL (clock line) --------------------- VIM3 PIN 25? or 16?
4.SDA (data line) ---------------------- VIM3 PIN 26? or 15?
5.RES (reset line) --------------------- VIM3 PIN ???
6.DC (data / command) ------------------ VIM3 PIN 37?
7.CS (chip select) --------------------- VIM3 PIN 35? 15?
It’s really confusing me. Any help would be appreciated here.
Up to the next problem. I wanted to use luma.oled to drive the OLED display (GitHub - rm-hull/luma.oled: Python module to drive a SSD1306 / SSD1309 / SSD1322 / SSD1325 / SSD1327 / SSD1331 / SSD1351 / SH1106 OLED). It’s originally designed for RaspberryPi and depends on RPi.GPIO. I know that there is a RPi.GPIO implementation for VIM3 (How To Use RPi.GPIO | Khadas Documentation), but I’m unsure if this will work, because:
1.) RPI.Gpio example - #3 by Frank (last post) says “The RPi.GPIO in VIM3 can’t control SPI”
2.) looking at the sources from RPi.GPIO for Khadas (RPi.GPIO-Khadas/khadas.h at master · frank180/RPi.GPIO-Khadas · GitHub) the physical pinouts for phyToGpio_rev_vim3 are totally different from the ones from for example wiringPi (WiringPi/khadas_vim3.c at master · khadas/WiringPi · GitHub). 3xx vs. 5xx
So it’s hard to say, if luma.oled will work with the Khadas made implementation of RPi.GPIO. Did someone already manage to get luma.oled to work on VIM3?
Another approach seems to be GitHub - rm-hull/OPi.GPIO: RPi.GPIO drop-in replacement library for Orange Pi Zero and other SBCs then (It originally is a replacement library for RPi.GPIO made for orange-pi, but one could easily write an device mapping file to work with VIM3. Look at for example at the on for M4 (OPi.GPIO/m4.py at master · rm-hull/OPi.GPIO · GitHub):
# The Rockchip RK3399 GPIO has 5 banks, GPIO0 to GPIO4, each with 32 pins.
# Each bank is then divided into 4 parts with 8 pins each, labeled A through D (A=0, B=1, C=2, D=3)
# So, GPIO4_D5 is 4*32 + 3*8 + 5 = 157
# NanoPi M4 physical board pin to GPIO pin
BOARD = {
7: 32, # GPIO1_A0
8: 145, # GPIO4_C1/I2C3_SCL
10: 144, # GPIO4_C0/I2C3_SDA
11: 33, # GPIO1_A1
12: 50, # GPIO1_C2
13: 35, # GPIO1_A3
15: 36, # GPIO1_A4
16: 54, # GPIO1_C6
18: 55, # GPIO1_C7
19: 40, # GPIO1_B0/SPI1_TXD/UART4_TX
21: 39, # GPIO1_A7/SPI1_RXD/UART4_RX
22: 56, # GPIO1_D0
23: 41, # GPIO1_B1/SPI1_CLK
24: 42, # GPIO1_B2/SPI1_CSn0
26: 149 # GPIO4_C5/SPDIF_TX
}
Couldn’t be to hard to write this definition file for VIM3 with getting the physical pin details out of WiringPi/khadas_vim3.c at master · khadas/WiringPi · GitHub, right?
Really looking forward if someone can help me with all this stuff.
Best regards
mcbain