Skip to content

Broadcom: Can't set baudrate on SPI bus #5887

@rsbohn

Description

@rsbohn

CircuitPython version

Adafruit CircuitPython 7.2.0-alpha.1-132-gba008ddfb on 2022-01-18; Raspberry Pi Zero W with bcm2835

Code/REPL

import board
import busio

def test(n=1_000_000):
    bus = busio.SPI(board.SCK, board.MOSI, board.MISO)
    with bus as spi:
        while not spi.try_lock():
            print("no lock")
        spi.configure(baudrate=n)
        spi.unlock()
        print(f"frequency={spi.frequency}")
    bus.deinit()
test()

Behavior

It reports the frequency as zero.

I can run test() multiple times on other devices, but on the Pi Zero W the second and later times I run it I get:

  File "<stdin>", line 1, in <module>
  File "test_spi.py", line 6, in test
ValueError: Invalid pins

Description

Sometimes I get fast SPI (24 MHz). But if I get zero I have to do a hard reset.

Also something isn't getting released by deinit().

I'm trying to use the PiTFT 1.14" display. I have to cycle power until I get the fast SPI bus.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    broadcomRaspberry Pis with Broadcom chipsbug

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions