system

package
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 15, 2025 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NextCPU

func NextCPU() rtos.IntCtx

NextCPU returns the interrupt context suitable for the rtos.IRQ.Enable function. Use it to evenly (in terms of quantity, not workload) distribute interrupts between available CPUs / cores.

func Setup

func Setup(xoscHz int64, sys, usb PLL, maxFlashHz int64)

Setup initializes and configures the system. It expects a crystal oscillator as the source of the reference frequency to both PLLs and an QSPI flash supporting maxFlashHz clock from which the code is executed (XIP).

func SetupPico2_125MHz

func SetupPico2_125MHz()

SetupPico2_125MHz setups the system assuming it is an RPI Pico 2 compatible, that is, it's clocked from 12 MHz crystal, the XIP QSPI flash supports 133 MHz clock, the IOVDD >= 2.5 V. Both the CPU and QSPI flash are configured to run at conservative 125 MHz, which seems to be a good compromise between speed and stability. Works well with Pico 2 clones that may have worse flash chip/circuit. See the Setup function for more generic interface.

func SetupPico2_133MHz

func SetupPico2_133MHz()

SetupPico2_133MHz is like SetupPico2_125MHz but both the CPU and QSPI flash run at 133 MHz. It gives you slightly faster system but without any margin for flash and its circuity which may cause problems in case of cheap Pico 2 clones.

func SetupPico2_150MHz

func SetupPico2_150MHz()

SetupPico2_150MHz is like SetupPico2_125MHz but the CPU runs at 150 MHz, the QMI (flash, PSRAM) at 75 MHz. It should give you quite good performance while being very forgiving for the flash and its circuity. It also supports most common QSPI PSRAM chips thet usually can work up to 100 MHz.

func SetupPico2_200MHz added in v0.1.3

func SetupPico2_200MHz()

SetupPico2_200MHz is like SetupPico2_150MHz but the CPU and most peripherals are overclocked to 200 MHz. The QMI (flash, PSRAM) run at 100 MHz which is below the spec of the Pico 2 flash but seems to be the maximum supported clock in case of most common PSRAM chips. This level of overclocking should work with almost all RP2350 chips but keep in mind that it's out of spec.

Types

type PLL

type PLL struct {
	RefDiv   int
	FbDiv    int
	PostDiv1 int
	PostDiv2 int
}

A PLL configuration.

vcoHz = refHz / RefDiv * FbDiv
outHz = vcoHz / (PostDiv1 * PostDiv2)

Constraints:

1 <= RefDiv <= 63
16 <= FbDiv <= 320
1 <= PostDiv <= 7
refHz / RefDiv >= 5 MHz
750 MHz <= vcoHz <= 1600 MHz

func (PLL) Fout

func (pll PLL) Fout(refHz int64) (outHz int64)

Fout calculates the output frequency of the PLL worknig with the pll configuration and the refHz frequency as an input. It returns outHz < 0 if the refHz is invalid or the pll configuration is invalid for the given refHz.

Directories

Path Synopsis
console
Package init when imported configures the whole system for typical usage assuming it's RPI Pico 2 compatible, that is, it's clocked from 12 MHz crystal, the XIP QSPI Flash supports 133 MHz clock, the IOVDD >= 2.5 V. Both the CPU and flash are configured to run at the 125 MHz..
Package init when imported configures the whole system for typical usage assuming it's RPI Pico 2 compatible, that is, it's clocked from 12 MHz crystal, the XIP QSPI Flash supports 133 MHz clock, the IOVDD >= 2.5 V. Both the CPU and flash are configured to run at the 125 MHz..
timer
riscvst
Package riscvst provides the implementation of a tickless system timer based on the RISCV platform timer.
Package riscvst provides the implementation of a tickless system timer based on the RISCV platform timer.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL