Unable to run custom rp2350 board

Hi, I have a custom rp2350 board with wifi that I made and I’m trying to get custom board.json and variant files working.

My board works when using a generic platformio.ini for the rppico2w. I can access the wifi chip and make the LED blink, however, I can’t use it due to flash limitations.

I copied over the rppico2w board.json and tweaked the flash size and changed the name.

I also made a new folder for the variant and copied over the files from rppico2w folder into it.

The project compiles fine, but the basic led blink and print code wont run once uploaded.

I’m not sure where the problem is, below i have my platform.ini file.

Any ideas on what I can fix to get it working like the rppico2w?

[env:customboard]
platform = raspberrypi
board = customboard
framework = arduino
board_build.core = earlephilhower
board_build.filesystem = littlefs
board_build.filesystem_size = 12m
board_upload.psram_length = 8388608
upload_protocol = picotool
monitor_speed = 115200
build_flags = 
    -DRP2350_PSRAM_CS=8

So what’s the customboard.json? Does it run without PSRAM?

If you attach a CMSIS-DAP debugger (like the debugprobe), where does the code get stuck?

Hi Max,

Thank you for the reply.

It doesn’t run when the psram is removed.

I havn’t been able to test using a debugger yet. I’m having problems trying to get my pico to act as one.

I have my current board.json below. I copied it from the rppico2w board.json but changed the ram size and name. Is there something else I need to change?

Thanks again for your help.

{
    "build": {
        "arduino": {
            "earlephilhower": {
                "boot2_source": "none.S",
                "usb_vid": "0x2E8A",
                "usb_pid": "0xF00F"
            }
        },
        "core": "earlephilhower",
        "cpu": "cortex-m33",
        "extra_flags": "-DARDUINO_RASPBERRY_PI_PICO_2W -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=250  -DPICO_CYW43_SUPPORTED=1 -DCYW43_PIN_WL_DYNAMIC=1",
        "f_cpu": "150000000L",
        "hwids": [
            [
                "0x2E8A",
                "0x00C0"
            ],
            [
                "0x2E8A",
                "0xF00F"
            ]
        ],
        "mcu": "rp2350",
        "variant": "customboard"
    },
    "debug": {
        "jlink_device": "RP2350_M33_0",
        "openocd_target": "rp2350.cfg",
        "svd_path": "rp2350.svd"
    },
    "frameworks": [
        "arduino",
        "picosdk"
    ],
    "name": "customboard",
    "upload": {
        "maximum_ram_size": 524288,
        "maximum_size": 16777216,
        "require_upload_port": true,
        "native_usb": true,
        "use_1200bps_touch": true,
        "wait_for_upload_port": false,
        "protocol": "picotool",
        "protocols": [
            "blackmagic",
            "cmsis-dap",
            "jlink",
            "raspberrypi-swd",
            "picotool",
            "picoprobe"
        ]
    },
    "url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
    "vendor": "Raspberry Pi"
}

Does it work when you use the original flash size of the Pico 2W?

If not, I think you can only make progress by attached a debugprobe.

I tried changing the flash size. I had the same error unfortunately.

On the bright side though, I got the debug interface working (the swdio pin was not properly soldered).

The debugger seems to get an error in RP2040Support.h during RP2040::begin(). Line 206 at

_ccountPgm = new PIOProgram(&ccount_program);

I havn’t really used vscodes’ debugger that much, i’m not too sure what to lookout for. An error pops up here in vscode and says “Attempt to use a type name as an expression (from data-evaluate-expression PIOProgram)” Not sure if this helps narrow down the issue.

Any ideas what could be the issue or things I can check now that I have the debugger working?

Thanks again.

How does the error show? Does it enter the Hardfault handler?

You can ignore these messages, everything you hover your mouse over is being tried to be evaluated as an expression. A class name doesn’t have any “value” to evaluate, so it fails.

It wasn’t really showing any errors just running through the code normally while in debug.

After stepping through many lines, I eventually passed portc.h and then into tasks.c? Looks like I might be having an issue with FreeRTOS?

I disabled FreeRTOS in that project folder though, so I’m not sure why it was still compiling it.

I made a new project folder, same .ini file and now the board.json and variant.h files work. :slight_smile: So I guess that solved it, though I do want to get FreeRTOS working at some point.

Thanks again.

For reference, I listed the errors I was getting below.

#if ( configNUMBER_OF_CORES > 1 )
    static portTASK_FUNCTION( prvPassiveIdleTask, pvParameters )
    {
        ( void ) pvParameters;

        taskYIELD();

Error: Couldn’t get register r0.

Error: RTOS: failed to get register list”