Skip to content

Set SPI clock line idle polarity for CPOL=1#9075

Merged
tannewt merged 1 commit intoadafruit:mainfrom
kbsriram:spi-polarity-1
Mar 22, 2024
Merged

Set SPI clock line idle polarity for CPOL=1#9075
tannewt merged 1 commit intoadafruit:mainfrom
kbsriram:spi-polarity-1

Conversation

@kbsriram
Copy link

Fixes #9074

Manually verified with this code before and after the change.

import board
import bitbangio
import digitalio
import time


def doit():
    with digitalio.DigitalInOut(board.GP13) as en:
        en.switch_to_output(value=True)
        time.sleep(1)
        with bitbangio.SPI(clock=board.GP15, MOSI=board.GP14) as spi:
            spi.try_lock()
            spi.configure(baudrate=10, polarity=1, phase=0, bits=8)
            en.switch_to_output(value=False)
            spi.write(b"\xaa")
            en.switch_to_output(value=True)

Before

p1-before

After

p1-after

Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@tannewt tannewt merged commit e3d1302 into adafruit:main Mar 22, 2024
@kbsriram kbsriram deleted the spi-polarity-1 branch March 22, 2024 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bitbangio SPI issue when CPOL=1

2 participants