I've made a custom board with RP2040 and I'm looking for a guide to upload firmware to the chip. As I understand, they already come with a boot loader installed. I have the SWDIO, SWCLK, 3.3V and GND pins. Is there a guide that is similar to how you'd program say an Atmega328P (Nano) by using Arduino as ISP but for the RP2040? I already have a bunch of arduinos handy so I'd prefer (if possible) to use an Uno or Nano to flash the firmware to the RP2040 via SWD pins. And before someone says to use google, I tried, but all I could find was to use a J-link or an official Raspberry Pi product and I'm not sure how to go about that as I'm most familiar with an Arduino IDE, so prefer to stick with that if possible?
I can't advise as I'm not familiar with the RP2040. Only thing that that i can say is that you should be aware of the fact that e.g. the Uno is a 5V device and your RP2040 is a 3.3V device.
Connecting the required signals without precautions can damage the RP2040.
Yes I'm aware of the voltage difference. My custom board drops 5v to 3.3v so it's not an issue. But I need a guide to understand how to use SWD pins to upload firmware. And before someone else proposes to just use the USB, I don't have it on my board and don't intend to add it.
it has bootloader in ROM
https://github.com/earlephilhower/arduino-pico#uploading-sketches
Assuming that your "firmware" has the correct format (includes a "secondary bootloader" and is re-formated for the UF2 bootloader, and you've implemented USB, you can just "copy" the file to the drive that will appear when you power up the rp2040 with the "bootsel" pin asserted.
For more complete answers, or alternative boot paths, you should probably try the Raspberry Pi Pico Forum
Edit:
before someone else proposes to just use the USB, I don't have it on my board
oops. Didn't see that. The built-in bootloader is all USB based.
Um... See https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf#swd-debug
You should be able to use the procedures there with any SWD debugger supported by OpenOCD, though the details may vary. (programming flash via SWD usually consists of loading code into the device RAM that understands that particular device's flash controller.)
I am not aware of any well-used SWD firmware for any Arduino. Your best bet is probably to buy an RPi Pico and use that. I believe that using one Pico to debug another Pico (or presumably other board with rp2040) is pretty well documented.
@westfw I've seen some guides using a raspberry pi product to program the other pi. But I'm not sure how that would work if I wrote my code in Arduino IDE and it is dependent on Arduino libraries? Do I just export it as hex and attempt to upload it using Raspberry pi product? I'm not familiar with the Raspberry pi ecosystem.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.