Skip to content

[5.4.y] [arm64] spi cs seems to be broken #3355

Closed
@asavah

Description

@asavah

Describe the bug
SPI (possibly CS) is broken on 5.4.y

To reproduce
Attach an sh1106 or ssd1306 spi (4wire) display like in https://luma-oled.readthedocs.io/en/latest/hardware.html
Install luma.core and luma.oled python modules.
Try drawing something on the display the via a python script,
for example something from https://github.com/rm-hull/luma.examples/tree/master/examples
like this:

python3 clock.py --display sh1106 --interface spi --spi-device 0 --spi-port 0

Expected behaviour
There should be image or text on the screen.

Actual behaviour
Screen is black.
Wire CS pin of the display to ground instead of CE0 (BCM8) pin - works.

System
Own OS

  • Which model of Raspberry Pi? e.g. Pi3B+, PiZeroW
    pi 4b
  • Which OS and version (cat /etc/rpi-issue)?
    Own pet project
  • Which firmware version (vcgencmd version)?
Nov 19 2019 16:42:26
Copyright (c) 2012 Broadcom
version aeebba4c03968ede49097db077673eadc2888a22 (clean) (release) (start_x)
  • Which kernel version (uname -a)?
    Linux rpi4 5.4.0-k6 #1 SMP Thu Nov 28 00:43:25 EET 2019 aarch64 GNU/Linux
    dtparam=spi=on in config.txt
    Logs
    No mentions of spi or any other scary errors in dmesg, can provide additional info if requested.

Additional context
The clue may be that if I wire display CS pin to ground it starts working like a champ.
This setup (scripts, wiring) have been working like a champ since pi2 days.
Tried using spi 0 device 1 with CS pin swapped - same behavior.
Disconnected everything from the pi except the display - same behavior.
Checked and redid display wiring - same behavior.
Checked with a smaller ssd1306 spi display - same behavior.
Checked python-smbus, luma.oled and luma.core versions - nothing changed for months.
Tried reverting a bunch of bcm-spi2835.c related commits to the state said file was in 5.3.y - same ...
Tried playing with spi0-cs and spi0-hw-cs overlays - more of the same.

Sadly I don't own a scope so I can't properly peek at what's happening with CS.
My crappy multimeter shows constantly and quickly floating voltage on active CS pin in range 0.005v - 0.07v (this measurement is not to be trusted) , it's never 0, inactive CS pin is stable 3,3v

Kernel 5.3.y with same firmware version worked fine earlier today.
However I can't test with 5.3 ATM because I rebuilt the whole thing and glibc was foolishly built with --enable-kernel=5.4.0.
If needed I can rebuild for testing, takes a bit of time tho.

Edit: if needed I can easily and quickly rebuild the kernel to test any patches on the fly.
Edit2: all other peripherals I have (i2c rtc, temperature sensor, buttons, leds, etc) work properly, this was tested with everything but the display physically disconnected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions