Trying to connect/use a small LED screen with SPI (ssd1351 controller)

Hi Hi!
I've been trying to use a Waveshare 1.5" RGB LED screen with the ROC-RK3328-CC using SPI (running the libre debian image for this board) but am very new to SPI devices and am not sure of a few things.

I'm using LUMA-OLED python library (with the help of R64-GPIO python library) and just trying to use the examples that come with it (I already have an i2c LED screen working), however I am unsure of a few things regarding the SPI hardware connection and software configuration:

Hardware:
Am I supposed to be using GPIO3 for something like this?
I've only been finding info of people wiring these LED screens to Raspberry Pis, and I'm not 100% sure I've got the pins plugged in correctly:
DIN - GPIOTX pin 19?
CLOCK - pin 23?
Chip Select - pin 24?
DC or Data/Command - which pin?
Reset - which pin?

in LUMA-OLED's documentation, it states that you need to connect RESET and DC pins to GPIO 24 and 25 on a raspberry pi, so does that mean that somewhere in the LUMA-OLED code, that is hard coded?  I'm just wondering what I may need to find/change to make sure the software is trying to speak on the right pins considering this isn't a RPi.


Software:
is "cat /sys/kernel/debug/gpio" the SPI equivalent to i2detect for i2c?
is that how I would confirm that my SPI device is being recognized?
how would I go about "setting" those GPIO pins to be in the proper modes?


Any help would be supremely appreciated.
Thanks

P.S.  Output of "cat /sys/kernel/debug/gpio":

firefly@firefly:/sys/kernel/debug$ cat gpio
GPIOs 1000-1031, platform/pinctrl, gpio0:
 gpio-1000 (                    |vcc_host_5v         ) out hi    
 gpio-1025 (                    |?                   ) out lo    
 gpio-1030 (                    |vcc_sd              ) out lo    

GPIOs 1032-1063, platform/pinctrl, gpio1:
 gpio-1050 (                    |mdio-reset          ) out hi    
 gpio-1058 (                    |vcc_host1_5v        ) out hi    

GPIOs 1064-1095, platform/pinctrl, gpio2:

GPIOs 1096-1127, platform/pinctrl, gpio3:

GPIOs 1510-1511, platform/rk8xx-gpio, rk8xx-gpio, can sleep:
 gpio-1510 (                    |?                   ) out hi    
 gpio-1511 (                    |?                   ) out lo   







Comments

  • Also just in case, when I try to execute any of the examples in luma.examples, I get the following:


    sudo python 3d_box.py -i spi --display ssd1351 --spi-port 3
    Version: luma.oled 3.3.0 (luma.core 1.12.0)
    Display: ssd1351
    Interface: spi
    Dimensions: 128 x 64
    ------------------------------------------------------------
    Error: Unable to export GPIO
    Error: Unable to set GPIO direction
    Error: Unable to export GPIO
    Error: Unable to set GPIO direction
    You must setup() the GPIO channel (BCM 25) as an output first
    You must setup() the GPIO channel (BCM 25) as an output first
    usage: 3d_box.py [-h] [--config CONFIG] [--display DISPLAY] [--width WIDTH]
                     [--height HEIGHT] [--rotate ROTATION] [--interface INTERFACE]
                     [--i2c-port I2C_PORT] [--i2c-address I2C_ADDRESS]
                     [--spi-port SPI_PORT] [--spi-device SPI_DEVICE]
                     [--spi-bus-speed SPI_BUS_SPEED] [--spi-cs-high SPI_CS_HIGH]
                     [--spi-transfer-size SPI_TRANSFER_SIZE]
                     [--ftdi-device FTDI_DEVICE] [--gpio GPIO]
                     [--gpio-mode GPIO_MODE]
                     [--gpio-data-command GPIO_DATA_COMMAND]
                     [--gpio-reset GPIO_RESET] [--gpio-backlight GPIO_BACKLIGHT]
                     [--block-orientation ORIENTATION] [--mode MODE]
                     [--framebuffer FRAMEBUFFER] [--bgr] [--h-offset H_OFFSET]
                     [--v-offset V_OFFSET] [--backlight-active VALUE]
                     [--transform TRANSFORM] [--scale SCALE] [--duration DURATION]
                     [--loop LOOP] [--max-frames MAX_FRAMES]
    3d_box.py: error: SPI device not found

  • Have you enabled spi with the overlay tool?  
  • Thanks so much for your reply.
    I have not, as was using the libre debian image which I believe does not have dt overlay available.
    So I've also downloaded the armbian images in an attempt to use the overlays to enable SPI however I cannot find any info on an "overlay tool". 
    The "README.rockchip-overlays" in the "/boot/dtb/rockchip/overlay" folder gives some details of manually using overlays, and all I could find online regarding dt overlays was at: https://docs.armbian.com/User-Guide_Allwinner_overlays/
    Although not for Rockchip, it seems to be a generic document which also explains how to manually add overlays.

    Can you let me know where I can find this "overlay tool", or any link to pages ragarding this tool's usage?
    I really appreciate any tips you may have on this.
    Thanks again!





    P.S.
    With the armbian images, the output of "cat /sys/kernel/debug/gpio" looks like this:
    gpiochip0: GPIOs 0-31, parent: platform/pinctrl, gpio0:
     gpio-30  (                    |sdmmc-regulator     ) out lo ACTIVE LOW

    gpiochip1: GPIOs 32-63, parent: platform/pinctrl, gpio1:
     gpio-50  (                    |snps,reset          ) out hi ACTIVE LOW
     gpio-58  (                    |vcc-host1-5v-regulat) out hi

    gpiochip2: GPIOs 64-95, parent: platform/pinctrl, gpio2:

    gpiochip3: GPIOs 96-127, parent: platform/pinctrl, gpio3:

    gpiochip4: GPIOs 511-511, parent: platform/ff100000.syscon:grf-gpio, ff100000.syscon:grf-gpio:
     gpio-511 (                    |vcc_sdio            ) out lo








  • Also, the SPI pins specified in the RockChip Overlay Readme for SPIDEV are as follows:

    SPI 0 pins (MOSI, MISO, SCK, CS): GPIO3_A5, GPIO3_A4, GPIO3_A6, GPIO3_A7
    SPI 1 pins (MOSI, MISO, SCK, CS): GPIO1_A7, GPIO1_B0, GPIO1_B1, GPIO1_B2
    SPI 2 pins (MOSI, MISO, SCK, CS): GPIO1_C0, GPIO1_B7, GPIO1_C1, GPIO1_C2
    SPI 3 pins (MOSI, MISO, SCK, CS): GPIO2_B2, GPIO2_B1, GPIO2_B3, GPIO2_B4

    However the only document I could find showing the GPIO pins for the ROC-RK3328-CC doesn't have these pin numbers for the specified GPIOs:
    Is there a better document out there which specifies the ROC-RK3328-CC GPIO pin numbers?
    That image I linked to is the only one I could find, and it was in the following forum post:


  • So I've edited /boot/armbienEnv.txt and added the following 2 lines:
    overlays=spi-spidev
    param_spidev_spi_bus=0

    after reboot, I still get nothing for:
    dmesg | grep spi
    and there is no /dev/spidev device files present.
    Is there a step I'm missing to enable SPI?
    Thanks




  • edited July 27
    It always seemed to me that it was very difficult to understand all this. Video chats give people the opportunity to always stay in touch and solve work issues during quarantine. But why do meetings in Zoom so often tire and provoke fatigue? I couldn't figure it out, but it turned out that I was spending a lot of time setting up the internet. During the quarantine, all meetings and meetings were held online and therefore I needed a good quality of communication. I decided to turn to pop up cinema screen for a cool business negotiation support. I'll tell you a secret, I still really like online meetings.
  • It always seemed to me that it was very difficult to understand all this.
Sign In or Register to comment.