-
Notifications
You must be signed in to change notification settings - Fork 2k
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
cpu/sam0_common: Implement time-sharing of SERCOMs #21029
base: master
Are you sure you want to change the base?
Conversation
1baf069
to
f9c952d
Compare
56ef1ea
to
08a71df
Compare
b2bb805
to
f5abef9
Compare
935ac6e
to
2a64955
Compare
please reduce static noise there are multiple warnings like
|
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" |
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
vera++ should now be happy |
Contribution description
This adds a
periph_sercom
feature and implementation whichperiph_i2c
,periph_uart
, andperiph_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()
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_shield
2024-11-21 20:29:42,410 # ALL TESTS SUCCEEDED
Issues/PRs references
None