Raspberry Pi RP2040

From SEGGER Wiki
Revision as of 14:24, 11 May 2022 by Leon (talk | contribs) (Reset)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This article covers the Raspberry Pi RP2040 device, an arm Cortex-M0+ dualcore MCU with up to 133 MHz Clock. It is the first MCU designed and published by Raspberry Pi. The RP2040 is present on the Raspberry Pi Pico evaluation board.

Features (selection)

Stat Specification
Core Dualcore M0+
RAM 264kB SRAM
Internal flash No internal flash (ext. QSPI supported)
Pins (multifunc) 30 GPIOs
Pins (dedicated) 6 SPI IOs

For further information please refer to the Raspberry Pi RP2040 web page

J-Link Support

The Raspberry Pi RP2040 is fully supported by J-Link.

  • Support was implemented with J-Link Software Pack V6.96.
  • It is recommended to always use the most recent version of the J-Link software as the software is continuously improved and any reported bugs are fixed

ROM Bootloader

The RP2040 comes with a bootloader in ROM. More information on ROM bootloaders in general can be found here: ROM Bootloader.
For a documentation of the RP2040 boot sequence, refer to the RP2040 datasheet.

When working with the RP2040, the following must be considered in regard to its ROM bootloader:
The ROM BTL expects a "flash second stage" (aka. "2nd stage bootloader") in the external QSPI flash.
The ROM BTL verifies that such a valid 2nd stage BTL is present by calculating a CRC over the first 252 bytes of the QSPI flash and comparing it against the 4 bytes following those 252 bytes. Only if the calculated CRC matches the CRC value in flash, the ROM BTL will jump to user application code (i.e. the 2nd stage BTL).

The 2nd stage BTL is not part of the application image and as such can be adapted by the user. It usually performs some additional setup to enable XIP from the QSPI flash or similar before jumping to the "actual" start of application.

Reset

As explained above, the RP2040 includes a boot ROM which needs to be executed after reset in order to guarantee proper functionality.
Due to the behavior of the ROM BTL, J-Link performs a device specific reset which halts at address 0x20041F00, on the first instruction of this so called "flash second stage" aka. 2nd stage BTL.

RAM Debugging

As explained above, the RP2040 includes a boot ROM which needs to be executed after reset in order to guarantee proper functionality.
Due to the behavior of the ROM BTL, it is necessary to download a valid 2nd stage BTL into flash, even if only code in RAM should be downloaded and debugged, otherwise the target device might not behave as expected.
For an example setup of RAM project for the RP2040, refer to the section "RAM Projects" below

Evaluation boards

There are multiple RP2040 evaluation boards. For all of the ones listed below, sample applications are available.

Sample projects

SEGGER Embedded Studio provides a RP2040 board support package for the RP2040 Pico. It is easily adjusted to all other available RP2040 boards, especially, as the QSPI pin-out is not modifiable. Additionally, the articles listed under Evaluation boards all provide sample applications.

RAM Projects

To run the following example projects the following prerequisites need to be met:

Core0: RaspberryPi_RP2040_Core0.zip