Skip to content
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

Set SPI CLK pin pull up/down in SPI Configure based on SPI polarity config #6067

Merged
merged 1 commit into from
Feb 22, 2022

Conversation

sgauche
Copy link

@sgauche sgauche commented Feb 19, 2022

If the SPI CLK polarity is set to 1, then a pull up resistor is required to keep the CLK signal high when the CLK goes to tri-state during idle periods. The pull up resistor could be external, but if your board is hard to modify, then setting the internal pull up resistor on the SPI CLK pin is useful. As the SPI CLK pin gets set up as a busio it becomes marked as "in use" and you can't manually set it to a pull up/down using digitalio, so the pull up/down should be set on spi configure.

@sgauche
Copy link
Author

sgauche commented Feb 19, 2022

Blue: Chip select
Yellow: SPI CLK (SCK)

Before change, you can see SCK is not driven until after chip select is driven active low, and then SCK is set back to tri-state before chip select is driven high again:

After change, SCK is idle high before chip select is driven active low and remains idle high after the transaction too:

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.

Looks good to me! Thank you!

@tannewt tannewt merged commit 40b430e into adafruit:main Feb 22, 2022
@sgauche sgauche deleted the spi_polarity_pullupdown branch February 26, 2022 17:33
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.

2 participants