RP2040 Devboard

Wow another devboard.

I wanted to start playing around with an RP2040 in a newer robotics controller. This devboard is to prove out whether I can design a working PCB with the RP2040.

Design

The Raspberry Pi folks have a lot of really good reference documentation for the RP2040. I effectively just followed the hardware design guide.

What’s different about the RP2040 is that you must connect it to external SPI flash to operate. So this is a bit different compared to what I’m used too.

Power supply is a typical 3.3V regulator connected to a USB-C connector.

image not found!

Then we have the MCU

image not found!

with SPI flash

image not found!

and a 12MHz crystal:

image not found!

This is all copy paste from the design guide.

Bringup

On initial connection to my PC via USB-C the board appeared in device manager but it wasn’t recognized as a USB mass storage device (What the RP2040 boot rom with look like). I did this with the BOOT button down as well.

I’m still hoping to work that out, but first I just wanted to confirm the board itself could be programmed. So opted to try programming it over SWD.

The Raspberry Pi devs made it so a Pico devboard can be used as a debug probe, luckily I have one in my “drawer of tech”. Following the official documentation online I setup the Pico debug probe and setup the pico sdk using the Raspberry Pi Pico VS Code Extension.

image not found!

I used the pico sdk blink example but modified to use the LED on my devboard

/**
 * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

#include "pico/stdlib.h"

// Pico W devices use a GPIO on the WIFI chip for the LED,
// so when building for Pico W, CYW43_WL_GPIO_LED_PIN will be defined
#ifdef CYW43_WL_GPIO_LED_PIN
#include "pico/cyw43_arch.h"
#endif

#ifndef LED_DELAY_MS
#define LED_DELAY_MS 250
#endif

#define LED_PIN 7

// Perform initialisation
int pico_led_init(void) {
    gpio_init(LED_PIN);
    gpio_set_dir(LED_PIN, GPIO_OUT);
    return PICO_OK;
}

// Turn the led on or off
void pico_set_led(bool led_on) {
    gpio_put(LED_PIN, led_on);
}

int main() {
    int rc = pico_led_init();
    hard_assert(rc == PICO_OK);
    while (true) {
        pico_set_led(true);
        sleep_ms(LED_DELAY_MS);
        pico_set_led(false);
        sleep_ms(LED_DELAY_MS);
    }
}

Using the VS Code Extension I just ran the Flash task, the probe was detected automatically, and I flashed the program.

image not found!

And successfully programmed the board!

Hopefully I can get the USB BOOTROM working. But I’d call that a success for now.