pico

module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2025 License: BSD-3-Clause

README

Support for Raspberry PI microcontrollers

Embedded Go supports the RP2350 family, aka Pico 2 (there is no support for RP2040).

Your program will run on both ARM cores (the RISCV mode is not supported).

Getting started

  1. Install the Embedded Go toolchain.

    go install github.com/embeddedgo/dl/go1.24.5-embedded@latest
    go1.24.5-embedded download
    
  2. Install egtool.

    go install github.com/embeddedgo/tools/egtool@latest
    
  3. Create a project directory containing the main.go file with your first Go program for RPi Pico 2.

    package main
    
    import (
    	"time"
    
    	"github.com/embeddedgo/pico/devboard/pico2/board/leds"
    )
    
    func main() {
    	for {
    		leds.User.Toggle()
    		time.Sleep(time.Second/2)
    	}
    }
    
  4. Initialize your project.

    go mod init firstprog
    go mod tidy
    
  5. Copy the go.env file suitable for your board (here is one for Pico 2 and another one for a board with 16 MB flash).

  6. Compile your first program.

    export GOENV=go.env
    go build
    

    or

    GOENV=go.env go build
    

    or

    egtool build
    

    The last one is like GOENV=go.env go build but looks for the go.env file up the current module directory tree.

  7. Connect your Pico 2 to your computer in the BOOT mode (press the onboard button while connecting it to the USB).

  8. Load and run.

    egtool load
    

Examples

See more example code for supported develompent boards.

Directories

Path Synopsis
dci
devboard
pico2/examples/blinky command
Blinky flashes the on-board LED.
Blinky flashes the on-board LED.
pico2/examples/blinky1 command
Blinky flashes the on-board LED.
Blinky flashes the on-board LED.
pico2/examples/crudeblinky command
Crudeblinky flashes the on-board LED without using HAL.
Crudeblinky flashes the on-board LED without using HAL.
pico2/examples/display command
Display draws on the connected display.
Display draws on the connected display.
pico2/examples/dma command
Dma shows how to use the DMA controller for RAM to RAM transfers.
Dma shows how to use the DMA controller for RAM to RAM transfers.
pico2/examples/gpiotest command
Gpiotest tests all GPIOs exposed as the Pico 2 GPIO pins.
Gpiotest tests all GPIOs exposed as the Pico 2 GPIO pins.
pico2/examples/irqpin command
Irqpin shows how to setup an IO pin to be an interrupt source.
Irqpin shows how to setup an IO pin to be an interrupt source.
pico2/examples/readpin command
Readpin polls the state of the GP15 pin and shows it using the onboard LED.
Readpin polls the state of the GP15 pin and shows it using the onboard LED.
pico2/examples/smpblinky command
Smpblinky tests the Go and noos schedulers.
Smpblinky tests the Go and noos schedulers.
pico2/examples/spi command
SPI loop test: wire GP3 and GP4 together.
SPI loop test: wire GP3 and GP4 together.
pico2/examples/spotpear-pico-1.54inch-lcd command
Pico-lcd-1.3 is similar to the Waveshare demo code for this module.
Pico-lcd-1.3 is similar to the Waveshare demo code for this module.
pico2/examples/uart command
Uart allows to tests the communication over UART peripheral.
Uart allows to tests the communication over UART peripheral.
pico2/examples/w5500 command
W5500 tests the communication with the WIZnet W5500 TCP/IP Ethernet controller.
W5500 tests the communication with the WIZnet W5500 TCP/IP Ethernet controller.
pico2/examples/waveshare-pico-8seg-led command
Pico-8seg-led uses standard fmt.Fprintf function to prints different chars and numbers on the 8-segment display.
Pico-8seg-led uses standard fmt.Fprintf function to prints different chars and numbers on the 8-segment display.
pico2/examples/waveshare-pico-lcd-1.3 command
Pico-lcd-1.3 is similar to the Waveshare demo code for this module.
Pico-lcd-1.3 is similar to the Waveshare demo code for this module.
pico2/examples/waveshare-pico-restouch-lcd-2.8 command
Pico-restouch-lcd-2.8 allows to test the LCD module.
Pico-restouch-lcd-2.8 allows to test the LCD module.
pico2/examples/ws2812 command
WS2812 uses the UART peripheral to drive the string of the WS2812 RGB LEDs.
WS2812 uses the UART peripheral to drive the string of the WS2812 RGB LEDs.
weacta10/examples/blinky command
Blinky flashes the both on-board LEDs using two goroutines.
Blinky flashes the both on-board LEDs using two goroutines.
weacta10/examples/irqbtn command
Irqbtn shows how to use interrupts to wait for the onboard button to be pressed.
Irqbtn shows how to use interrupts to wait for the onboard button to be pressed.
weacta10/examples/irqbtncond command
Irqbtncond shows how to use interrupts to wait for the onboard button to be pressed.
Irqbtncond shows how to use interrupts to wait for the onboard button to be pressed.
weacta10/examples/smpblinky command
Smpblinky tests the Go and noos schedulers.
Smpblinky tests the Go and noos schedulers.
weactb/examples/blinky command
Blinky flashes the both on-board LED.
Blinky flashes the both on-board LED.
weactb/examples/irqbtn command
Irqbtn shows how to use interrupts to wait for the onboard button to be pressed.
Irqbtn shows how to use interrupts to wait for the onboard button to be pressed.
weactb/examples/irqbtncond command
Irqbtncond shows how to use interrupts to wait for the onboard button to be pressed.
Irqbtncond shows how to use interrupts to wait for the onboard button to be pressed.
hal
dma
Package dma provides interface to the DMA controller.
Package dma provides interface to the DMA controller.
dma/dmairq
Package dmairq allows to share the limited number of system-level DMA interrupts between the interrupt service routines (ISRs, interrupt hadlers) for individual DMA channels.
Package dmairq allows to share the limited number of system-level DMA interrupts between the interrupt service routines (ISRs, interrupt hadlers) for individual DMA channels.
mem/nocache
Package nocache allows to allocate variables and slices of arbitrary type in the DMA-capable non-cached memory.
Package nocache allows to allocate variables and slices of arbitrary type in the DMA-capable non-cached memory.
spi
system/init
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 conservative 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 conservative 125 MHz.
system/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