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 initial support for the Raspberry Pi Pico 2 #77368

Open
wants to merge 28 commits into
base: main
Choose a base branch
from

Commits on Nov 9, 2024

  1. dts: arm: Move rpi_pico under raspberrypi

    Follow the wider directory convention of dts/<arch>/<vendor>/<family>.
    
    This is foundation work ahead of introducing support for the RP2350.
    
    Signed-off-by: Andrew Featherstone <andrew.featherstone@gmail.com>
    ajf58 committed Nov 9, 2024
    Configuration menu
    Copy the full SHA
    3564e69 View commit details
    Browse the repository at this point in the history
  2. dts: arm: rp2040: Improve naming of included files

    Rename rpi_pico_common.dtsi to rp2040_reset.h . This is more consistent
    with the wider Zephyr source tree, and is foundation work ahead of
    introducing the RP2350 SoC.
    
    Signed-off-by: Andrew Featherstone <andrew.featherstone@gmail.com>
    ajf58 committed Nov 9, 2024
    Configuration menu
    Copy the full SHA
    ab685f9 View commit details
    Browse the repository at this point in the history
  3. drivers: clock_control: rpi_pico: Correct bitfields during init

    RESETS_RESET_PLL_USB_BITS was logically or'd twice and 'unreset'ting
    PWM doesn't seem to be required, based on the contents of the SDK.
    
    Signed-off-by: Andrew Featherstone <andrew.featherstone@gmail.com>
    ajf58 committed Nov 9, 2024
    Configuration menu
    Copy the full SHA
    08d8ed7 View commit details
    Browse the repository at this point in the history
  4. dts: bindings: clock: rpi_pico: Add default value matching the Pico SDK

    The Pico SDK defines a default value for its XOSC multiplier. Reflect
    this in the device tree binding so that it doesn't need to be repeated.
    
    Signed-off-by: Andrew Featherstone <andrew.featherstone@gmail.com>
    ajf58 committed Nov 9, 2024
    Configuration menu
    Copy the full SHA
    624a653 View commit details
    Browse the repository at this point in the history
  5. drivers: clock_control: rpi_pico: Make pinctrl-0 optional

    No in-tree board uses this driver's pinctrl functionality, and every
    RP2040-based board was configuring this to be an empty node in the
    device tree, so remove them.
    
    Signed-off-by: Andrew Featherstone <andrew.featherstone@gmail.com>
    ajf58 committed Nov 9, 2024
    Configuration menu
    Copy the full SHA
    2908fde View commit details
    Browse the repository at this point in the history
  6. drivers: clock_control: rpi_pico: Add support for the RP2350.

    Add support for SoC-specific clock ids and update the initialization
    function to support the existing RP2040 and add support for the RP2350.
    
    clock_control_rpi_pico.c uses numerical values for clock ids taken from
    rpi_pico_clock.h which are the "clock generator". For the RP2350 these
    values are different for some of the same logical clock sources, as well
    as the RP2040 and RP2350 having different clock sources available.
    
    Signed-off-by: Andrew Featherstone <andrew.featherstone@gmail.com>
    ajf58 committed Nov 9, 2024
    Configuration menu
    Copy the full SHA
    f1be0dc View commit details
    Browse the repository at this point in the history
  7. soc: rp2350: Add initial support for the Raspberry Pi RP2350

    RP2350 is Raspberry Pi's newest SoC. From the datasheet:
    
    "RP2350 is a new family of microcontrollers from Raspberry Pi that
    offers significant enhancements over RP2040. Key features include:
    • Dual Cortex-M33 or Hazard3 processors at 150 MHz
    • 520 kB on-chip SRAM, in 10 independent banks
    • 8 kB of one-time-programmable storage (OTP)
    • Up to 16 MB of external QSPI flash/PSRAM via dedicated QSPI bus
    ...
    "
    
    This commit introduces some changes to support the existing RP2040 and
    what is describe by Raspberry Pi as the "RP2350 family". Currently there
    are 4 published products in the family: RP2350A, RP2350B, RP2354A, and
    RP2354A. Within Zephyr's taxonomy, split the configuration as follows:
    Family: Raspberry Pi Pico. This contains all RP2XXX SoCs,
    SoC Series: RP2040 and RP2350.
    SoC: RP2040 and, for now, just the RP2350A, which is present on the Pico
    2, where the A suffix indicates  QFN-60 package type. This structure is
    reflected in `soc/raspberrypi/soc.yml`, and somewhat assumes that there
    won't be a RP2050, for example, as a RP2040 with more RAM.
    
    This is foundation work ahead of introducing support for Raspberry Pi's
    Pico 2 board, which is fitted with a RP2350A and 4MB of flash.
    
    Signed-off-by: Andrew Featherstone <andrew.featherstone@gmail.com>
    ajf58 committed Nov 9, 2024
    Configuration menu
    Copy the full SHA
    5560f15 View commit details
    Browse the repository at this point in the history
  8. drivers: hwinfo: rp2350: Add initial support for RP2350

    Extend the existing driver to add some initial support for the new SoC,
    whilst maintaining compatibility with the RP2040.
    
    Signed-off-by: Andrew Featherstone <andrew.featherstone@gmail.com>
    ajf58 committed Nov 9, 2024
    Configuration menu
    Copy the full SHA
    fcc98a1 View commit details
    Browse the repository at this point in the history
  9. drivers: clock_control: rpi_pico: Start tick generators for timers

    Unlike the RP2040, the RP2350 has multiple tick generators that need to
    be started. Start TIMER0 and TIMER1 tick generators during
    clock_control_init.
    
    Signed-off-by: Andrew Featherstone <andrew.featherstone@gmail.com>
    ajf58 committed Nov 9, 2024
    Configuration menu
    Copy the full SHA
    6f567cf View commit details
    Browse the repository at this point in the history
  10. drivers: watchdog: rpi_pico: Add support for RP2350

    The watchdog register configuration of RP2350 differs from that
    of RP2040, so we make fit that.
    
    Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
    Signed-off-by: Andrew Featherstone <andrew.featherstone@gmail.com>
    soburi authored and ajf58 committed Nov 9, 2024
    Configuration menu
    Copy the full SHA
    e084ac0 View commit details
    Browse the repository at this point in the history
  11. drivers: counter: rpi_pico_timer: Add support for RP2350

    The RP2350 SoC series contain two timer peripherals. Extend the driver
    to support using the second timer (`TIMER1`).
    
    N.b. this requires a fix from the Pico SDK to be patched into
    hal_rpi_pico. See raspberrypi/pico-sdk#1949 .
    
    Signed-off-by: Andrew Featherstone <andrew.featherstone@gmail.com>
    ajf58 committed Nov 9, 2024
    Configuration menu
    Copy the full SHA
    f2432f9 View commit details
    Browse the repository at this point in the history
  12. pinctrl: raspberrypi: rp2350: Add support for RP2350X

    A significant amount of the pin muxing is duplicated between the RP2040,
    the RP2350A, and RP2350B. Reflect this in the file structure, with a
    `-common` suffix used to to indicate this.
    
    Macros are defined in ascending order of the function index in the
    relevant table in the datasheet. SoC/SoC-series specific macros are
    defined in their respective tables. Functions that are not currently
    used (e.g. the new HSTX) are intentionally not defined here as they do
    not (currently) have any use in the Zephyr tree (i.e. there's no drivers
    that make use of this functionality).
    
    clang-format has been run over the existing definitions to reduce the
    noise generated by CI. These are cosmetic changes; I've tried to retain
    attribution to the relevant authors where applicable.
    
    Signed-off-by: Andrew Featherstone <andrew.featherstone@gmail.com>
    ajf58 committed Nov 9, 2024
    Configuration menu
    Copy the full SHA
    a1cf375 View commit details
    Browse the repository at this point in the history
  13. boards: rp2040: Lint whitespace in board.cmake files

    Change whitespace to match the coding style for CMake files for all
    rp2040-based boards.
    
    This is foundation work ahead of adding support for boards based on the
    RP235XX SoCs.
    
    Signed-off-by: Andrew Featherstone <andrew.featherstone@gmail.com>
    ajf58 committed Nov 9, 2024
    Configuration menu
    Copy the full SHA
    9f2c7cf View commit details
    Browse the repository at this point in the history

Commits on Nov 10, 2024

  1. rp2350: Fix for storing larger pinctrl alt func

    On RP2350, the alt function value can be up to 0x1F, so store as 5 bits.
    
    Signed-off-by: Peter Johanson <peter@peterjohanson.com>
    Signed-off-by: Andrew Featherstone <andrew.featherstone@gmail.com>
    petejohanson authored and ajf58 committed Nov 10, 2024
    Configuration menu
    Copy the full SHA
    897af30 View commit details
    Browse the repository at this point in the history
  2. boards: Add initial support for the Raspberry Pi Pico 2

    The Raspberry Pi Pico 2 is Raspberry Pi's first board fitted with their
    RP2350A SoC.
    
    This adds a minimal board definition, sufficient to build and run
    `samples/hello_world` and `samples/basic/blinky` on the board. Images
    can be run on the target using OpenOCD. Raspberry Pi's `picotool` can
    create a UF2 binary, which ensures that errata RP2350-E10 is avoided
    e.g.
    
    ```
    > picotool uf2 convert build\rpi_pico2\hello_world\zephyr\zephyr.elf \
        build\rpi_pico2\hello_world\zephyr\zephyr.uf2 \
        --family rp2350-arm-s --abs-block`
    ```
    
    Raspberry Pi Pico 2 is a low-cost, high-performance microcontroller
    board with flexible digital interfaces. Key features include:
    
    - RP2350A microcontroller chip designed by Raspberry Pi in the United
      Kingdom
    - Dual Cortex-M33 or Hazard3 processors at up to 150MHz
    - 520KB of SRAM, and 4MB of on-board flash memory
    - USB 1.1 with device and host support
    - Low-power sleep and dormant modes
    - Drag-and-drop programming using mass storage over USB
    - 26x multi-function GPIO pins including 3 that can be used for ADC
    - 2x SPI, 2x I2C, 2x UART, 3x 12-bit 500ksps Analogue to Digital
      Converter (ADC), 24x controllable PWM channels
    - 2x Timer with 4 alarms, 1x AON Timer
    - Temperature sensor
    - 3x Programmable IO (PIO) blocks, 12 state machines total for custom
      peripheral support
        - Flexible, user-programmable high-speed IO
        - Can emulate interfaces such as SD Card and VGA
    
    The Raspberry Pi Pico 2 comes as a castellated module which allows
    soldering direct to carrier boards.
    
    Only enable timer 0 for now. Timer 1 won't work correctly until the
    rpi_pico HAL has picked up the fix for `hardware_alarm_irq_handler`. See
    raspberrypi/pico-sdk#1949 .
    
    Co-authored-by: Benjamin Cabé <kartben@gmail.com>
    Signed-off-by: Andrew Featherstone <andrew.featherstone@gmail.com>
    ajf58 and kartben committed Nov 10, 2024
    Configuration menu
    Copy the full SHA
    af28df1 View commit details
    Browse the repository at this point in the history
  3. UF2: Enable support for Raspberry Pi RP2350

    Add UF2 Family ID for Raspberry Pi 2350 and build
    UF2 image by default for Pico 2 board
    
    Signed-off-by: Ryan Grachek <grachek@gmail.com>
    Signed-off-by: Andrew Featherstone <andrew.featherstone@gmail.com>
    oscardagrach authored and ajf58 committed Nov 10, 2024
    Configuration menu
    Copy the full SHA
    f9183a4 View commit details
    Browse the repository at this point in the history
  4. samples: rpi_pico2: Add ADC-related samples for rpi_pico2

    The Raspberry Pi Pico 2's device is compatible with the existing Pico 1.
    The build system requires a `<board>.overlay` file, but these use the
    pre-processing to #include the sibling rpi_pico.overlay files rather
    than duplicating the contents as an attempt to keep things DRY.
    
    Tested locally.
    
    Signed-off-by: Andrew Featherstone <andrew.featherstone@gmail.com>
    ajf58 committed Nov 10, 2024
    Configuration menu
    Copy the full SHA
    3bba48b View commit details
    Browse the repository at this point in the history
  5. tests: drivers: adc_api: Add support for the Raspberry Pi Pico 2

    For these tests' needs, the RP2350 on the Pico 2 is compatible with the
    RP2040 on the Pico 1. #include the latter's overlay in preference to
    duplicating the content.
    
    Signed-off-by: Andrew Featherstone <andrew.featherstone@gmail.com>
    ajf58 committed Nov 10, 2024
    Configuration menu
    Copy the full SHA
    1320458 View commit details
    Browse the repository at this point in the history
  6. doc: rpi_pico2: Document Raspberry Pi Pico 2 and related changes

    Add some documentation for the board itself (mostly aiming to refer to
    canonical sources of information rather duplicate). Add entries in the
    release notes where applicable.
    
    boards/raspberrypi/rpi_pico2/doc/img/rpi_pico2.webp is a cropped and
    compressed version of https://www.raspberrypi.com/documentation/microcontrollers/images/pico-2.png
    which is released under the CC-BY-SA-4.0 license. See https://github.com/raspberrypi/documentation/blob/develop/LICENSE.md
    
    Co-authored-by: Benjamin Cabé <kartben@gmail.com>
    Signed-off-by: Andrew Featherstone <andrew.featherstone@gmail.com>
    ajf58 and kartben committed Nov 10, 2024
    Configuration menu
    Copy the full SHA
    37dba18 View commit details
    Browse the repository at this point in the history
  7. boards: raspberrypi: rpi_pico2: Add OpenOCD runner configuration

    Add OpenOCD debugger support.
    For now we will need a Raspberry Pi'a forked version of OpenOCD from
    https://github.com/raspberrypi/openocd .
    
    The default adapter speed is set to match Raspberry Pi's documentation.
    
    Signed-off-by: Andrew Featherstone <andrew.featherstone@gmail.com>
    ajf58 committed Nov 10, 2024
    Configuration menu
    Copy the full SHA
    164f9d4 View commit details
    Browse the repository at this point in the history
  8. tests: gpio_api_1pin: rpi_pico2: Support using external pulldowns

    Extend gpio_api_1pin so that tests can require a test fixture to provide
    an external pulldown resistor to the board under test. Use the new
    test-gpio-external-pulldown device tree binding to define where that
    GPIO is, and, finally, add a device tree overlay for the Raspberry Pi
    Pico 2 board that defines where the pulldown provided by the fixture
    will be.
    
    Tested locally using `--fixture gpio_external_pull_down` when running
    Twister on the command line, or by creating and using a Hardware Map
    file, in combination with a modified Pico 2.
    
    Signed-off-by: Andrew Featherstone <andrew.featherstone@gmail.com>
    ajf58 committed Nov 10, 2024
    Configuration menu
    Copy the full SHA
    7dcb537 View commit details
    Browse the repository at this point in the history
  9. rpi_pico2: rp2350: Add PIO support and extend samples

    Add initial support for the RP2350's PIO peripherals, extend the
    existing example under samples/boards/raspberrypi/rpi_pico/uart_pio to
    demonstrate this on the Raspberry Pi Pico 2, and update the board's
    documentation.
    
    Signed-off-by: Andrew Featherstone <andrew.featherstone@gmail.com>
    Signed-off-by: Manuel Aebischer <manuel.aebischer@belden.com>
    Manuel Aebischer authored and ajf58 committed Nov 10, 2024
    Configuration menu
    Copy the full SHA
    0568837 View commit details
    Browse the repository at this point in the history
  10. rpi_pico2: rp2350: Add DMA support

    Add initial support for the RP2350's DMA peripheral, allow tests
    under drivers/dma/loop_transfer to run on on the Raspberry Pi Pico 2,
    and update the board's documentation.
    
    Signed-off-by: Manuel Aebischer <manuel.aebischer@belden.com>
    Signed-off-by: Andrew Featherstone <andrew.featherstone@gmail.com>
    ajf58 committed Nov 10, 2024
    Configuration menu
    Copy the full SHA
    3bb3bea View commit details
    Browse the repository at this point in the history
  11. drivers: dma: rpi_pico: Refactor DMA files for Raspberry Pi SoCs

    Avoid referring to Pico 2 (the name of a board). In this context,
    RPI_PICO is used to refer to the (Zephyr) `SOC_FAMILY` rather than the
    Pico 1 board. This clarifies common numerical values between the RP2040
    and RP2350 SoC series, and enables existing DTS files to be used with
    RP2350-based boards with fewer changes.
    
    Remove the use of Zehpyr's `CONFIG_` macros from the device tree files,
    and replace them with `SOC_SERIES`-specific files. Update the driver
    implementation to conditionally include the correct file. Update
    documentation and samples to match.
    
    Signed-off-by: Andrew Featherstone <andrew.featherstone@gmail.com>
    ajf58 committed Nov 10, 2024
    Configuration menu
    Copy the full SHA
    e4bd97e View commit details
    Browse the repository at this point in the history
  12. drivers: dma: rpi_pico: Correct handling of NULL filter_param

    From the API documentation, `dma_api_chan_filter`` can be given a value
    of NULL for `filter_param`. Match the behaviour of most implementations,
    and return true. This removes misleading error messages logged during
    tests (e.g. `test_tst_dma0_m2m_loop`).
    
    Signed-off-by: Andrew Featherstone <andrew.featherstone@gmail.com>
    ajf58 committed Nov 10, 2024
    Configuration menu
    Copy the full SHA
    cd90b2d View commit details
    Browse the repository at this point in the history
  13. tests: drivers: dma: Increase test coverage for RP2040 and RP2350A

    Increase test coverage for Raspberry Pi's SoCs. Use the `socs` folder
    rather than `boards` to enable these tests to run on any boards with the
    same SoCs.
    
    Signed-off-by: Andrew Featherstone <andrew.featherstone@gmail.com>
    ajf58 committed Nov 10, 2024
    Configuration menu
    Copy the full SHA
    b94ec77 View commit details
    Browse the repository at this point in the history
  14. samples: drivers: led: pwm: Add rpi_pico2 board

    The RP2350's PWM peripheral is largely unchanged from the RP2040's, but
    the higher clock frequency means the long blink delay must be lower.
    
    Signed-off-by: Andrew Featherstone <andrew.featherstone@gmail.com>
    ajf58 committed Nov 10, 2024
    Configuration menu
    Copy the full SHA
    c73a7e9 View commit details
    Browse the repository at this point in the history
  15. rp2350: Define and implement a cpucluster of Cortex-M33s

    Assume that users want to run a dual Cortex-M33 on the Pico 2, and
    update various parts of the codebase to match. I expect the majority of
    the soc's definition will move from `dts/arm/raspberrypi` to
    `dts/common/raspberrypi` if/when support is added for the Hazard3 cores.
    
    Some parts of the codebase can cope without encoding the cluster in the
    filename (e.g. Twister seems to use the identifier in
    `boards/raspberrypi/rpi_pico2/rpi_pico2.yaml` rather than the filename
    itself), others can't (e.g. `rpi_pico2_m33_defconfig`) which itself is
    a form of <board>_<cpucluster>_defconfig and doesn't refer to the SoC.
    Despite this, some files have been given the verbose fully-specified
    name because this matches the current documentation.
    
    Update documentation to try to highlight the capabilities and
    limitations of the current support within Zephyr for the Pico 2 board
    and the underlying SoC.
    
    Update `.overlay` and `.conf` files in `samples/` and `tests/` to match
    the new requirement.
    
    Limited tested locally with no issues found.
    
    Signed-off-by: Andrew Featherstone <andrew.featherstone@gmail.com>
    ajf58 committed Nov 10, 2024
    Configuration menu
    Copy the full SHA
    c9567fb View commit details
    Browse the repository at this point in the history