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

Add I2C target and SPI peripheral ports to IoController base, update SPI and I2C naming #277

Merged
merged 7 commits into from
Aug 8, 2023

Conversation

ducky64
Copy link
Collaborator

@ducky64 ducky64 commented Aug 8, 2023

Add I2C target and SPI peripheral ports as IoController ports. While these ports are less commonly used, microcontroller can be used as e.g. IO expanders. Coming soon in an example board...

These are exceptions:

  • While RP2040 can run in SPI peripheral mode, it will not automatically tristate the data-out pin which is software controlled. The SPI peripheral definition is not included.
  • While STM32 can run in SPI peripheral mode, the CS pins are restricted (not pin-matrix'd). Since CS pins are defined separately (CS as part of the SPI interface #276) it may make it easy to mis-pin the device.
  • It's a weird line to draw which may be re-explored later.

This also models SPI controllers and peripherals as distinct resources without a mutual exclusivity constraint as common on microcontrollers. Needs a deeper refactor into the pin resource system, #278

Other changes:

  • Update nRF52840 peripheral names to be consistent with datasheet peripheral instance names

Modernize port names as follows (keeping legacy names as an alias):

  • This is not expected to break backwards compatibility.
  • SpiMaster -> SpiController, SpiSlave -> SpiPeripheral, per https://www.oshwa.org/a-resolution-to-redefine-spi-signal-names/ (note, there isn't one authoritative SPI standard, and different vendors use different terminologies including controller/target - this seems to be one of the efforts to create a broader standard)
    • Doesn't change MISO / MOSI port names for now, since this would break compatibility. A name alias in Python is possible, but this would break pin assignments which are string-based and would need dedicated aliasing capability (which may be added in the future - as other migrations are needed).
    • Port-side SDI/SDO naming may be better in terms of matching the datasheet (which seem to prefer the device-relative naming) and reducing transcription errors when building library parts, though may be less objectively unambiguous.
  • I2cMaster -> I2cController, I2cSlave -> I2cTarget, per authoritative specification document https://www.nxp.com/docs/en/user-guide/UM10204.pdf

@ducky64 ducky64 merged commit 77fbd01 into master Aug 8, 2023
9 checks passed
@ducky64 ducky64 deleted the devices branch August 8, 2023 07:53
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.

1 participant