cpu/sam0_common: Implement time-sharing of SERCOMs#21029
Draft
maribu wants to merge 3 commits intoRIOT-OS:masterfrom
Draft
cpu/sam0_common: Implement time-sharing of SERCOMs#21029maribu wants to merge 3 commits intoRIOT-OS:masterfrom
maribu wants to merge 3 commits intoRIOT-OS:masterfrom
Conversation
benpicco
reviewed
Nov 21, 2024
1baf069 to
f9c952d
Compare
kfessel
reviewed
Nov 22, 2024
kfessel
reviewed
Nov 22, 2024
kfessel
reviewed
Nov 22, 2024
This was referenced Nov 26, 2024
kfessel
reviewed
Nov 26, 2024
56ef1ea to
08a71df
Compare
b2bb805 to
f5abef9
Compare
benpicco
reviewed
Nov 27, 2024
935ac6e to
2a64955
Compare
Contributor
|
please reduce static noise there are multiple warnings like |
Contributor
|
boards/samd20-xpro/include/periph_conf.h also miss white space ( i don't know why these messages are not brought up at once but trickel after every commit) the static test also don't like regular form past tens of irregular "reset" |
Contributor
|
seems like vera++ produced that noise, i reduced that list to once per file and warning |
d75b27a to
6d113cd
Compare
6d113cd to
0dbd13a
Compare
This adds a `periph_sercom` feature and implementation which
`periph_i2c`, `periph_uart`, and `periph_spi` are implemented on top.
This allows for sharing a single SERCOM instance to provide multiple
serial interfaces (in round-robin time-sharing fashion).
Note: In practice, a SERCOM can often not be shared if it needs to
provide an UART.
Background:
While code using the I2C/SPI APIs is already optimized to share the
peripheral with `i2c_acquire()`/`spi_acquire()` and
`i2c_release()`/`spi_release()`, UARTs are typically not shared and most
users will not call `uart_poweron()` and `uart_poweroff()` to only have
the SERCOM in UART mode when actually needed. Worse: For many use cases
(such as stdin), the UART will need to be constantly running, as
receiving data happens asynchronously at unpredictable points in time.
Now that time-sharing SERCOMs is possible, we can provide the SPI on D11/D12/D13 (backed by SERCOM3) also when the UART on D0/D1 (also backed by SERCOM3) is used.
This adds the space missing after the comma in `GPIO_PORT(<port>,<pin>` at multiple places
0dbd13a to
bd365b1
Compare
Member
Author
|
vera++ should now be happy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contribution description
This adds a
periph_sercomfeature and implementation whichperiph_i2c,periph_uart, andperiph_spiare implemented on top. This allows for sharing a single SERCOM instance to provide multiple serial interfaces (in round-robin time-sharing fashion).Note
In practice, a SERCOM can often not be shared if it needs to provide an UART.
Background:
While code using the I2C/SPI APIs is already optimized to share the peripheral with
i2c_acquire()/spi_acquire()andi2c_release()/spi_release(), UARTs are typically not shared and most users will not calluart_poweron()anduart_poweroff()to only have the SERCOM in UART mode when actually needed. Worse: For many use cases (such as stdin), the UART will need to be constantly running, as receiving data happens asynchronously at unpredictable points in time.Testing procedure
make BOARD=adafruit-metro-m4-express flash term -C tests/periph/selftest_shield2024-11-21 20:29:42,410 # ALL TESTS SUCCEEDEDIssues/PRs references
None