8000 nrf52: Expose SPI0 and TWI1 (and not TWI0 and SPI1) by bradjc · Pull Request #4042 · tock/tock · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

nrf52: Expose SPI0 and TWI1 (and not TWI0 and SPI1) #4042

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 2 commits into from
Jun 23, 2024

Conversation

bradjc
Copy link
Contributor
@bradjc bradjc commented Jun 20, 2024

Pull Request Overview

The [SPIM|TWI]* peripherals on the nrf are the same hardware. Right now we have a runtime check (which doesn't actually error) to verify both are not used. This enforces the restriction at compile time.

We don't have any boards which are using both SPI0/1 or both TWI0/1 (TWI is more crucial as there are three spi devices). So this PR changes the default to expose only compatible devices.

Note, this doesn't prevent using both TWI or both SPI, it just requires not using the default peripheral struct.

Testing Strategy

Worked when I used the screen and flash on nrf52840dk.

TODO or Help Wanted

n/a

Documentation Updated

  • Updated the relevant files in /docs, or no updates are required.

Formatting

  • Ran make prepush.

bradjc added 2 commits June 20, 2024 09:39
SPI0 and TWI0 are the same peripheral, and SPI1 and TWI1 are the same
peripheral. Boards cannot use both 0 or both 1 at the same time.

The current default peripherals expose both, allowing boards to use two
SPI or two TWI, and they must be careful to not use both 0 or both 1
peripherals.

This changes the default to be more opinionated and only expose one spi
and one twi. This avoids the problem entirely for boards that use the
default peripherals. We can of course support other peripheral groups
for users who need say 3 SPIs or 2 I2C peripherals.
@github-actions github-actions bot added the nrf Change pertains to the nRF5x family of MCUs. label Jun 20, 2024
Copy link
Member
@ppannuto ppannuto left a comment

Choose a reason for hiding this comment

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

I've definitely been bitten by this before :/ (indeed, I think I'm responsible for the debug_assert! case here), and this is better.

Copy link
Member
@lschuermann lschuermann left a comment

Choose a reason for hiding this comment

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

This looks good to me. I'm slightly confused by the PR title. Should that say "and not TWI0 and SPI0"?

@lschuermann lschuermann added the last-call Final review period for a pull request. label Jun 23, 2024
@hudson-ayers hudson-ayers added this pull request to the merge queue Jun 23, 2024
Merged via the queue into master with commit 18c4f49 Jun 23, 2024
18 checks passed
@hudson-ayers hudson-ayers deleted the nrf52-spi0-twi1 branch June 23, 2024 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
last-call Final review period for a pull request. nrf Change pertains to the nRF5x family of MCUs.
-->
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0