1

I'm trying to get a waveshare 4.2inch E-Ink Display Module Compatible with Raspberry Pi 4B/3B+/3B/2B/B+/A+/Zero/Zero W/WH/Zero 2W Series Boards 400x300 Resolution SPI Interface working on a Raspberry Pi Zero 2 W that already has a Pimoroni Keybow Mini on it. I can get it working on SPI0, but that conflicts with the pin usage of the Keybow, so now I'm trying to get it working on SPI1. I've got the following pin mappings:

Display PIN BCM
VCC 17 3.3V
GND 25 GND
DIN 38 GPIO 20, SPI1 MOSI
CLK 40 GPIO 21, SPI1 SCLK
CS 12 GPIO 18, SPI1 CE0
DC 22 GPIO 25
RST 16 GPIO 23
BUSY 18 GPIO 24

I had to move the RST off GPIO 17, since that's used by the Keybow, so it's on GPIO 23 now. That works fine when the display is on SPI0, so I know it works in general.

I've changed epdconfig.py to have the following pin settings:

# Pin definition
RST_PIN  = 23 #17
DC_PIN   = 25
CS_PIN   = 18 #8
BUSY_PIN = 24
#PWR_PIN  = 18
MOSI_PIN = 20 #10
SCLK_PIN = 21 #11

I commented out all of the PWR_PIN usage, since there's no wire for it anyway. I've also set the SPI object to use SPI 1.0:

# SPI device, bus = 1, device = 0
self.SPI.open(1, 0)

The example program runs, but nothing displays on the waveshare. Any ideas?

(It seems the Keybow is fully hardwired, so my only option is to mess with the display.)

EDIT: SPI1 enabled like so in /boot/firmware/config.txt:

# SPI1 for display
dtoverlay=spi1-1cs

1 Answer 1

0

You haven't specified HOW you enabled SPI but the documentation for dtoverlay=spi1-1cs states:-

Name:   spi1-1cs

Info:   Enables spi1 with a single chip select (CS) line and associated spidev
        dev node. The gpio pin number for the CS line and spidev device node
        creation are configurable.
        N.B.: spi1 is not accessible on old Pis without a 40-pin header.

Usage:  dtoverlay=spi1-1cs,<param>=<val>

Params: cs0_pin                 GPIO pin for CS0 (default 18 - BCM SPI1_CE0).
        cs0_spidev              Set to 'off' to stop the creation of a
                                userspace device node /dev/spidev1.0 (default
                                is 'on' or enabled).

but you appear to be using GPIO 17, SPI1 CE0

NOTE not all modes work on SPI1 but you haven't listed any code.

You may be able to use other CS pins with SPI0, but I have never tested this.

dtoverlay -h spi0-2cs
Name:   spi0-2cs

Info:   Change the CS pins for SPI0

Usage:  dtoverlay=spi0-2cs,<param>=<val>

Params: cs0_pin                 GPIO pin for CS0 (default 8)
        cs1_pin                 GPIO pin for CS1 (default 7)
        no_miso                 Don't claim and use the MISO pin (9), freeing
                                it for other uses.
3
  • Edited question, but I've enabled it in /boot/firmware/config.txt like so: dtoverlay=spi1-1cs. What do you mean by not all modes working?
    – zimdanen
    Commented Jun 2 at 2:28
  • SPI has 4 modes 0-3 (these specify which edge is used). This is normally set in software, but needs to match hardware.
    – Milliways
    Commented Jun 2 at 2:41
  • Aha, okay. I think this is doing that: self.SPI.mode = 0b00
    – zimdanen
    Commented Jun 2 at 2:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.