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

cpu/sam0_common: Implement time-sharing of SERCOMs #21029

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from

Commits on Nov 21, 2024

  1. cpu/sam0_common: implement SERCOM time-sharing

    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.
    maribu committed Nov 21, 2024
    Configuration menu
    Copy the full SHA
    4c71bc3 View commit details
    Browse the repository at this point in the history
  2. boards/adafruit-metro-m4-express: allow sharing SERCOM

    Now that sharing SERCOMs is implemented, we can make use of that :)
    
    A warning is emitted if this is actually done, as sharing with UART is
    often not working as expected.
    maribu committed Nov 21, 2024
    Configuration menu
    Copy the full SHA
    a29ee49 View commit details
    Browse the repository at this point in the history
  3. tests/periph/selftest_shield: release UART after test

    Calling `uart_poweroff()` when done with the UART test allows sharing
    the underlying hardware e.g. to provide other peripheral interfaces.
    One example of this would be the SERCOM3 on the Adafruit Metro M4
    Express that is used to provide UART on D1/D0 and SPI on D11/D12/D13.
    maribu committed Nov 21, 2024
    Configuration menu
    Copy the full SHA
    122819b View commit details
    Browse the repository at this point in the history
  4. tests/periph/selftest_shield: fix logic to enable UART test

    We cannot use the D0/D1 UART if it is also used for STDIO. However,
    the logic did not take into account whether `stdio_uart` was used at
    all. This fixes the issue.
    maribu committed Nov 21, 2024
    Configuration menu
    Copy the full SHA
    feda1b9 View commit details
    Browse the repository at this point in the history
  5. boards/adafruit-metro-m4-express: Add I2C and UART Mapping

    The M4 Express does now have an I2C and an UART compatible with Arduino
    Shields, so we can expose them.
    maribu committed Nov 21, 2024
    Configuration menu
    Copy the full SHA
    f9c952d View commit details
    Browse the repository at this point in the history

Commits on Nov 22, 2024

  1. Configuration menu
    Copy the full SHA
    2ca76e0 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    c1880f3 View commit details
    Browse the repository at this point in the history
  3. boards/adafruit-metro-m4-express: improve TTY detection

    Also detect TTY of bootloader with `MOST_RECENT_PORT=1`.
    maribu committed Nov 22, 2024
    Configuration menu
    Copy the full SHA
    c3608b2 View commit details
    Browse the repository at this point in the history

Commits on Nov 23, 2024

  1. Configuration menu
    Copy the full SHA
    7efd29e View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    56ef1ea View commit details
    Browse the repository at this point in the history