Raspberry Pi Pico Update: Difference between revisions

From Foenix F256 / Wildbits/K2 Wiki
Jump to navigationJump to search
(Created page with "== Raspberry Pi Pico Update == === Overview === There is an onboard RP2040 chip (pi pico). It is not present on the Jr2. It's responsible for the following things: * the bootloader procedure that loads the right core while booting the K2. * it is also known as the "FPGA Manager" * Contains the K2 LCD screen to be shown at bootup * Has modifiably code that can invite more features and possibly a faster bootup === Opening the case === You can refer to this section t...")
 
m (Corrected filename for gzip compressed fpga cores)
 
(5 intermediate revisions by one other user not shown)
Line 3: Line 3:
=== Overview ===
=== Overview ===


There is an onboard RP2040 chip (pi pico). It is not present on the Jr2. It's responsible for the following things:
There is an onboard RP2040 chip (pi pico). It is NOT PRESENT on the Jr2. It's only present on the K2. It's responsible for the following things:


* the bootloader procedure that loads the right core while booting the K2.  
* the bootloader procedure that loads the right core while booting the K2.  
* it is also known as the "FPGA Manager"
* it is also known as the "FPGA Manager"
* Contains the K2 LCD screen to be shown at bootup
* Has modifiable code that can invite more features and possibly a faster bootup
* Has modifiably code that can invite more features and possibly a faster bootup
 
=== Preparing new pico flash files ===
 
Check this [https://github.com/wildbitscomputing/fpga-manager fpga manager] repo from Cibee which can tweak and compile such files into .uf2. This project uses VSCode, the pico sdk and openocd in order to do everything.
 
Here's a summary of the booting time gains that were accomplished by Cibee (see the benchmark table on the side)
 
 
bit bang (slowest): was the old method, at launch of the K2, of sending a core file to the FPGA.
 
pio (faster): is the new method tried by Cibee
 
SD raw (slowest): was the old way of storing the core file, uncompressed, as .bin files. See [[FPGA_Releases#How_to_Upgrade_the_FPGA_for_the_F256K2]] for the exact file structure needed inside the internal "left" uSD card.
 
SD gzip (faster): is a new method of individually storing those same core files as .bin.gz, reducing the amount of bytes to send dramatically
 
FLASH LZ4 (fastest): is embedding the core files inside the pi pico flash memory so that the core manager carries its own data and sends it to the fpga during bootup. This no longer involves the internal "left" uSD card at all.
 
 
When a recent enough fpga manager (January 2026) is flashed into the pi pico, it will try to prepare the fpga with this following sequence:
 
<nowiki>*</nowiki> Reads a 2-bit context DIP switch to select one of four FPGA slots.
 
<nowiki>*</nowiki> Attempts SD card programming first (LZ4 blocks, gzip, then raw .bin).
 
<nowiki>*</nowiki> Falls back to LZ4 images stored in fixed flash slots if SD is unavailable.
 
<nowiki>*</nowiki> Prints the chosen method and timing over USB stdio if enabled.
[[File:FPGA Manager Benchmark.png|thumb]]


=== Opening the case ===
=== Opening the case ===
Line 14: Line 42:
You can refer to this section to learn how you can be [[Opening_the_F256K_case]]
You can refer to this section to learn how you can be [[Opening_the_F256K_case]]


=== Flashing using the onboard USB Header ===
Here are the steps to follow:
[[File:Rp2040-cable.jpeg|thumb|Connector location for the pico USB pin header, Switch S3 on the left, and cable orientation]]
Installation step:


=== Finding the right header and connecting a cable ===
* Install Cable as above (F256K2 Powered Off). '''WARNING''', with '''VERY LITTLE''' cable tension, this pin header can snap off [from Mu0n] and force you onto the next method of flashing using the SWD header, as seen in the next section.
* Plug Cable in any PC that holds the new programming file.
* Keep 1 finger on the button
* Power the F256K2
* A new folder will appear on the PC's Desktop
* Drop the new .uf2 file in the newly appeared folder.
* Power off F256K2
* Remove cable
* Reinstall the system as your heart's desire
* Power On the unit
* RP2040 is updated and running (because you need it to boot the unit)
* Bob's your uncle!


Here are the steps to follow:
=== Flashing using the onboard SWD Header ===
 
SWD: Serial Wire Debug. This other pin header is a second way to update your flash and gives a little more flexibility to do it piece by piece by flashing .bin at specific flash locations or .elf in one go.
[[File:Swd connector.png|thumb|Connector location for the SWD pin header, near the FPGA]]
 
You'll need either:


* Find the right .uf2 file from this github repo https://github.com/wildbitscomputing/fpga-manager
* a [https://www.raspberrypi.com/documentation/microcontrollers/debug-probe.html Pi Debug Probe] which comes with the necessary cable that leads to 3 female Dupont endings needed here
* Find the red circled header for USB
* openocd tool from PicoSDK v1.5.1 or more recent
* Use the provided USBA to female dupont connector cable you should have received with your K2 kit upon purchase. These fairly standard cables can be found online if it needs to be replaced
* a prepared .bin file with updated code.  
* While the K2 is powered off, hold the BOOTSEL button nearby and plug the cable into your modern computer
* a conversion tool to convert .uf2 to .bin, you can use this website https://polpo.org/tmp/uf2-to-bin.html or other known tools in the pico community
* When a special drive pops up on your modern computer, drag and drop the .uf2 replacement image for the pico into that drive - it will auto-dismount and perform the update.
* the key step is to use openocd like so: openocd -s scripts -f interface/cmsis-dap.cfg -f target/rp2040.cfg -c "adapter speed 5000; program NewFirmware.bin verify reset exit 0x10000000"

Latest revision as of 18:14, 14 February 2026

Raspberry Pi Pico Update

Overview

There is an onboard RP2040 chip (pi pico). It is NOT PRESENT on the Jr2. It's only present on the K2. It's responsible for the following things:

  • the bootloader procedure that loads the right core while booting the K2.
  • it is also known as the "FPGA Manager"
  • Has modifiable code that can invite more features and possibly a faster bootup

Preparing new pico flash files

Check this fpga manager repo from Cibee which can tweak and compile such files into .uf2. This project uses VSCode, the pico sdk and openocd in order to do everything.

Here's a summary of the booting time gains that were accomplished by Cibee (see the benchmark table on the side)


bit bang (slowest): was the old method, at launch of the K2, of sending a core file to the FPGA.

pio (faster): is the new method tried by Cibee

SD raw (slowest): was the old way of storing the core file, uncompressed, as .bin files. See FPGA_Releases#How_to_Upgrade_the_FPGA_for_the_F256K2 for the exact file structure needed inside the internal "left" uSD card.

SD gzip (faster): is a new method of individually storing those same core files as .bin.gz, reducing the amount of bytes to send dramatically

FLASH LZ4 (fastest): is embedding the core files inside the pi pico flash memory so that the core manager carries its own data and sends it to the fpga during bootup. This no longer involves the internal "left" uSD card at all.


When a recent enough fpga manager (January 2026) is flashed into the pi pico, it will try to prepare the fpga with this following sequence:

* Reads a 2-bit context DIP switch to select one of four FPGA slots.

* Attempts SD card programming first (LZ4 blocks, gzip, then raw .bin).

* Falls back to LZ4 images stored in fixed flash slots if SD is unavailable.

* Prints the chosen method and timing over USB stdio if enabled.

Opening the case

You can refer to this section to learn how you can be Opening_the_F256K_case

Flashing using the onboard USB Header

Here are the steps to follow:

Connector location for the pico USB pin header, Switch S3 on the left, and cable orientation

Installation step:

  • Install Cable as above (F256K2 Powered Off). WARNING, with VERY LITTLE cable tension, this pin header can snap off [from Mu0n] and force you onto the next method of flashing using the SWD header, as seen in the next section.
  • Plug Cable in any PC that holds the new programming file.
  • Keep 1 finger on the button
  • Power the F256K2
  • A new folder will appear on the PC's Desktop
  • Drop the new .uf2 file in the newly appeared folder.
  • Power off F256K2
  • Remove cable
  • Reinstall the system as your heart's desire
  • Power On the unit
  • RP2040 is updated and running (because you need it to boot the unit)
  • Bob's your uncle!

Flashing using the onboard SWD Header

SWD: Serial Wire Debug. This other pin header is a second way to update your flash and gives a little more flexibility to do it piece by piece by flashing .bin at specific flash locations or .elf in one go.

Connector location for the SWD pin header, near the FPGA

You'll need either:

  • a Pi Debug Probe which comes with the necessary cable that leads to 3 female Dupont endings needed here
  • openocd tool from PicoSDK v1.5.1 or more recent
  • a prepared .bin file with updated code.
  • a conversion tool to convert .uf2 to .bin, you can use this website https://polpo.org/tmp/uf2-to-bin.html or other known tools in the pico community
  • the key step is to use openocd like so: openocd -s scripts -f interface/cmsis-dap.cfg -f target/rp2040.cfg -c "adapter speed 5000; program NewFirmware.bin verify reset exit 0x10000000"