Skip to content

RPI4 SPI controller CS deasserts too early at 1MHz #5655

Open
@AndreasFuchsTPM

Description

@AndreasFuchsTPM

Describe the bug

When using the SPI controller via the spidev driver from userspace, the timing between the last falling edge of the CLK and the deassertion of CS is somehow off.
It even happens that CS is deasserted before the last CLK fall.

This is worst at around 1MHz. It get's much better below 500kHz and above 2MHz.

Blue is CLK, Green is CS
SDS00080

Steps to reproduce the behaviour

I need a payload that uses 2 ioctls and leaves CS asserted between those two via the cs_change parameter = 1.

Attached you find a simple python script that reproduces this issue.
I had to insert the "waiting with asserted CS" between byte 4 and 5:
spidev-test.py.txt

Device (s)

Raspberry Pi 4 Mod. B

System

cat /etc/rpi-issue
Raspberry Pi reference 2023-05-03
Generated using pi-gen, https://github.com/RPi-Distro/pi-gen, 47eee1f0ddcf8811559d51eea1c1bb48335e3e88, stage2

vcgencmd version
Mar 17 2023 10:50:39
Copyright (c) 2012 Broadcom
version 82f3750a65fadae9a38077e3c2e217ad158c8d54 (clean) (release) (start)

uname -a
Linux raspberrypi-arael 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr 3 17:24:16 BST 2023 aarch64 GNU/Linux

Logs

Blue is CLK, Green is CS
SDS00081
SDS00082
SDS00083

Additional context

No response

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