Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 22, 2024

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