r/raspberrypipico • • 36m ago

c/c++ Driving real SID chips from a Pico: five PIO state machines, DMA, and a cycle counter slaved to the clock pin

• Upvotes

I have been building USBSID-Pico for a while, an RP2040/RP2350 board that talks to real MOS SID chips over USB. Most of the fun was on the Pico side, and that part is what I want to share.

PIO layout (PIO0)

  • The SID clock is generated by a tiny PIO program on GPIO 22. It is two instructions with side-set, and the clock divider is computed from the system clock and the configured SID clock rate.
  • Three more state machines run off that same clock pin. One latches the control lines (RW, CS1, CS2), one drives the 16 data/address pins, and one is a delay timer that counts SID clock edges and then raises PIO IRQs to release the other two. That is how a write lands on an exact SID cycle.
  • A fifth state machine on PIO1 is a free-running cycle counter that waits on the clock pin and pushes into the FIFO. DMA drains it (endless transfer count on RP2350, two chained channels on RP2040). This creates a 32-bit wide cycle counter.

DMA and cores

  • Separate DMA channels feed the control, data and delay FIFOs and read data back from the bus. A hardware spinlock guards the shared words.
  • Core 0 runs TinyUSB and config. Core 1 runs MIDI and Network SID Device writes, the LED, and the optional embedded c64 emulator for playing SID tunes without an external player.

Other bits

  • USB composite device: 2x CDC (1 for Data and 1 for WebSerial), MIDI, and two vendor interfaces (WebUSB and a second one for fast reads).
  • pico_w/pico2_w builds can run a Network SID Device server over TCP with UDP discovery.
  • Builds exist for pico, pico_w, pico2 and pico2_w. Default optimization in CMake is -O3 to be sure everything stays in sync.

It plays C64 music with real chips, but I am posting for the Pico side. Source: https://github.com/LouDnl/USBSID-Pico

Happy to answer questions about the PIO side, especially the timing handshake between the SMs. Has anyone else used a PIO cycle counter slaved to an external pin like this?


r/raspberrypipico • • 16h ago

Is Raspberry Pico 2 W good fit for begginers

12 Upvotes

Hi, i am 15 year old student i was always interested in technologies more on the software side i did some web dev (JavaScript, Go, PHP) i really like GO and i would like to stick with it ik that Pico supports TinyGo but is that a good fit for me I want to do some simple stuff to learn the basics because i no longer do anything software and i thought this would spark things out or do you have any other recommendations?


r/raspberrypipico • • 15h ago

help-request Can i fit 1000 images on raspberry pi pico?

3 Upvotes

im using a raspberry pi pico that has micropython installed with an spi screen (driver ili9341).

im trying to play bad apple on it but i only have ~ 1mb left on the pi pico.

the images are 16x12 and take up 630bytes by themselves but, despite the small file size, not all of them can fit on the pico due to its 4kb minimum per file. is there any way to fit all 1000 images onto the pi pico to be able to draw them on the screen?.

im not too knowledgeable in micropython so please excuse me if i don't understand some things


r/raspberrypipico • • 22h ago

Running a BLE Air Quality Scanner on Adafruit Fruit Jam with BleuIO

Thumbnail bleuio.com
2 Upvotes

This project shows how the BleuIO Bluetooth Low Energy USB dongle can add BLE communication to an Adafruit Fruit Jam powered by the RP2350 to access BLE air quality data.


r/raspberrypipico • • 22h ago

[Troubleshooting] ADS1263 SPI communication issue with Pico W (MicroPython) — Register reads work, but ADC data returns all zeros

1 Upvotes

Hi everyone,

I'm trying to interface a Waveshare ADS1263 High-Precision AD HAT with a Raspberry Pi Pico W using the Waveshare Pico-to-HAT adapter, without jumper wires.

I'm porting the official Waveshare Raspberry Pi Python driver to MicroPython.

Hardware setup:

  • Raspberry Pi Pico W
  • Waveshare ADS1263 High-Precision AD HAT
  • Waveshare Pico-to-HAT adapter
  • SPI1: SCK=GP10, MOSI=GP11, MISO=GP12
  • RESET=GP18, CS=GP22, DRDY=GP17
  • SPI mode: CPOL=0, CPHA=1
  • SPI frequency: 100 kHz

What works:

  • Power supply and RESET appear normal.
  • CS can be controlled between HIGH and LOW.
  • DRDY transitions from HIGH to LOW after starting ADC conversion.
  • Chip ID reads successfully.
  • Several configuration registers can be read back correctly.

The problem:

When I send the RDATA1 (0x12) command to read ADC1 conversion data, the response contains only zeros.

Example output:

REG 0 READ: 0x23
REG_MODE2 success
REG_REFMUX success
REG_MODE0 success
REG_MODE1 success
REG 6 READ: 0x0A
DRDY is LOW
SPI STATUS: 0x00
RAW DATA: ['0x0', '0x0', '0x0', '0x0', '0x0']
Received checksum: 0x00
ADC1 checksum mismatch

I've verified the power rails, RESET, CS, and DRDY using a multimeter. I've also reduced SPI frequency from 1 MHz to 100 kHz, but the problem persists.

My questions:

  1. Is there a difference between MicroPython's machine.SPI.read() and the SPI behavior expected by the original Raspberry Pi driver?
  2. Could the ADS1263 require a specific SPI transaction sequence, CS behavior, or dummy clocks that I'm missing

Any advice would be greatly appreciated!

def ADS1263_Read_ADC_Data(self):
        config.digital_write(self.cs_pin, GPIO.LOW)#cs  0
        config.digital_write(self.cs_pin, GPIO.LOW)
        try:
            config.spi_writebyte([ADS1263_CMD['CMD_RDATA1']])
            status = config.spi_readbytes(1)[0]
            buf = config.spi_readbytes(5)

            print("SPI STATUS:", hex(status))
        finally:
            config.digital_write(self.cs_pin, GPIO.HIGH)

        read  = (buf[0]<<24) & 0xff000000
        read |= (buf[1]<<16) & 0xff0000
        read |= (buf[2]<<8) & 0xff00
        read |= (buf[3]) & 0xff
        CRC = buf[4]
        # print(read, CRC)
        if self.ADS1263_CheckSum(read, CRC) != 0:
            print("ADC1 checksum error")
            print("RAW DATA:", [hex(x) for x in buf])
            print("Received checksum:", hex(CRC))
            raise RuntimeError("ADC1 checksum mismatch")            

        return read

r/raspberrypipico • • 1d ago

I am total newbie but i need some advice on a project

Thumbnail
0 Upvotes

r/raspberrypipico • • 1d ago

E-ink

Thumbnail
gallery
13 Upvotes

r/raspberrypipico • • 1d ago

Low power battery system 5uA all included, for iot applications

Thumbnail gallery
2 Upvotes

r/raspberrypipico • • 2d ago

What could be the best pin solution in this case?

Thumbnail
gallery
13 Upvotes

I am using the OneROM project to replace ROMs on a motherboard. OneROM is a RP3250 on a small board the size of an EEPROM or ROM. You solder headers, program them to emulate any ROM you like and place them where the ROM was.

This is working well, but in my situation, the solution seat too high. The total height is 15mm and I need to be10mm. See (B) with the normal header. If I use that 15mm, the board does not fit in its enclosure anymore.

I used female headers (D) with long legs to get to solution (A)
I solder the headers the way (D) shows and then cut the top to get to solution (A).

It is not pretty. This is working, and the pins are even better match for the DIP support. But it takes time and the risk to damage something during the solder or cutting is very high.

Is there another solution. Is there a model of headers or pins I could use to get the low profile I need?
Any ideas?

Thank you very much.


r/raspberrypipico • • 1d ago

help-request Alguém pode me ajudar a resolver isso?

Post image
0 Upvotes

r/raspberrypipico • • 4d ago

Hell Ride: RP2350

Thumbnail
youtu.be
16 Upvotes

r/raspberrypipico • • 4d ago

Help needed: Raspberry Pi 5 + Camera Module 3 (IMX708) not detected by Chromium for a 3D face-tracking avatar

Post image
0 Upvotes

Hi everyone! 👋
I’m trying to get the CSI camera on my Raspberry Pi 5 working with Chromium for real-time face tracking in a web-based 3D avatar application called Berry.
My setup
Raspberry Pi 5
Raspberry Pi Camera Module 3 (Sony IMX708)
Debian 13 Trixie
Linux kernel 6.18.50+rpt-rpi-2712
Chromium 154
GStreamer (libcamerasrc)
v4l2loopback
Three.js and MediaPipe Tasks Vision in my web app
What works
rpicam-hello --list-cameras detects the IMX708.
rpicam-still successfully captures images.
GStreamer detects the camera and its pipeline reaches PLAYING.
I created a virtual camera called Berry Camera at /dev/video10.
The virtual device now reports YUYV, 640×480 at 30 fps.
What doesn’t work
Chromium does not list Berry Camera as a video source on the WebRTC input/output test page.
Running this command:
v4l2-ctl -d /dev/video10 --stream-mmap=3 --stream-count=30 --stream-to=/tmp/berry-test.raw
returns:
VIDIOC_CREATE_BUFS returned -1 (Inappropriate ioctl for device)
GStreamer also reports warnings about unsupported pixel formats.
I recreated the loopback device with exclusive_caps=0 and tried v4l2sink io-mode=2, but Chromium still cannot see the virtual camera.
My questions
What is the recommended way to expose a Raspberry Pi CSI camera to Chromium on Debian 13?
Is v4l2loopback actually needed, or is there a more reliable way to use libcamera directly?
How should I troubleshoot the VIDIOC_CREATE_BUFS error?
Can Chromium’s getUserMedia() access the CSI camera directly, so I can use MediaPipe for face tracking without a virtual webcam?
I’m looking for a reliable solution and would appreciate step-by-step guidance. I can provide additional command output if needed.
Thanks in advance for any help!


r/raspberrypipico • • 5d ago

I had almost finished when I realized I had forgotten to bring out the reset switch.

Post image
9 Upvotes

r/raspberrypipico • • 6d ago

RP2350 I2C Masterclass: 1MHz EEPROM Guide (M24M01) | RP2350 #17

Thumbnail
youtube.com
6 Upvotes

r/raspberrypipico • • 8d ago

My roguelike on pico

Enable HLS to view with audio, or disable this notification

83 Upvotes

I saw many years ago something like this on hackaday and always wanted to build it by myself, so here it is


r/raspberrypipico • • 7d ago

c/c++ How to send 256 bytes en block via USB from Pico to PC

4 Upvotes

Hello,

based on a CDC example which echoed every single char received from the PC I changed it to receive a line and echo it all upper cased. This works like a charm.

Then to approach the actual requirements of my project I wanted a blockwise communication: I sent 256 bytes (0x00 ... 0xFF) to the Pico and programmed it to send it back unchanged. Result: On the PC I receive only the last 64 bytes: 0xC0 ... 0xFF although the buffer on the Pico holds the correct 256 bytes.

Seeing that the USB buffers are 64 bytes large I suspect that the sending routine stuffs the 256 byte block in portions of 64 byte into the buffer - and the last one wins.

I merely do

// echo back to host

tud_cdc_write(buff, sizeof(buff));

tud_cdc_write_flush();

which is apparently too naive. Any advice how to do better will be highly appreciated.

M'


r/raspberrypipico • • 8d ago

How far can a Pico go as a real computer? VGA + 3.2" touch LCD, USB keyboard and mouse through a second Pico, RTC - one RP2040, 264 KB SRAM

Thumbnail
gallery
122 Upvotes

Hey! Last time I showed Recaster Pico as a screenshot - here's the real thing on my desk: one RP2040 running a small desktop OS in its 264 KB of SRAM, now with the parts that make it feel like a computer. Yeah, it is still multi-user and multi-tasking (preemptive). No Linux/Unix, no RISC OS.

What's on the board now

  • VGA, 640×480 at 60 Hz, 256 colors (RGB332), straight from PIO and DMA. Core 1 composes every scanline just in time.
  • A 3.2" SPI touch LCD as a second screen. It mirrors the VGA desktop (well, 1/4 of it ;-)) - core 1 hands the lines it has just composed to a DMA channel, no second compose - or a program takes it over and draws on it directly. Touch moves and clicks the mouse pointer, and the panel also works alone, without a monitor.
  • USB keyboard and mouse through a second RP2040 in the serial line: USB host on its micro-USB port, plus a USB-A socket on two GPIOs driven by Pico-PIO-USB. Events travel as CRC-protected packets mixed into the 1 Mbaud UART console, and the serial terminal still works through it. German layout with dead keys and umlauts.
  • RTC and EEPROM (DS1307 / AT24C32) on I2C, set up with a small text file - the EEPROM even shows up as a file under /dev.
  • GPIO, ADC, PWM, PIO and DMA from the shell language, with the same names as in the Pico SDK.
  • Runs from a power bank.

Lessons for your own projects

  1. pico_minimize_runtime() turns float off. Pico-PIO-USB computes its PIO clock dividers in float at init, so every float operation hits the SDK's panic stub and core 1 silently stops. Use pico_minimize_runtime(target INCLUDE FLOAT).
  2. The same function with pico_multicore: malloc's auto-init mutex never gets initialized, so the first malloc on core 1 hangs forever. PICO_USE_MALLOC_MUTEX=0 if you only malloc once at start.
  3. TinyUSB 0.18 drives one host controller per firmware, and Pico-PIO-USB 0.7 no longer enumerates devices on its own. A second USB port means writing a small host on its low-level API - about 300 lines for boot keyboards and mice.
  4. Flash erases switch core 0's interrupts off for ~45 ms per sector, while at 1 Mbaud the UART's 32-byte FIFO holds about 10 ms of mouse traffic. Put the UART interrupt on core 1 and run it from SRAM.

Next: sound (the speaker is already on the board), the SD card (already there), and touch-friendly UI controls - buttons, sliders, lists.

And yes: I will post a video of it showing it in motion, soon. And you will get your fingers at that ".uf2"-files to play with it.


r/raspberrypipico • • 8d ago

MicroPython is running in standalone mode.

Post image
11 Upvotes

r/raspberrypipico • • 9d ago

Spotify Player/Flight Radar

Thumbnail
gallery
18 Upvotes

Hi all,

Showing you a small project I made based on ideas from the internet.

I have this problem that drives me crazy: whenever I’m listening to Spotify while I have a YouTube tab open, pressing the play/pause button on my earphones doesn’t just pause Spotify, it starts playing the YouTube video instead.

To solve that, I created a Spotify Player manager, and it was a little bit boring, so I added Flight Radar using the free API at https://adsb.lol/ (and my football team's next game :D).

For the hardware, I used: Pimorini Pim580 Display 2.0" and Raspberry Pico 2.

I posted the 3D model in makerworld: https://makerworld.com/en/models/3399877-case-pimoroni-pim580-display-2-w-rasperry-pico

Check all the functions: https://www.youtube.com/shorts/jv8n3v8LW0w


r/raspberrypipico • • 9d ago

Orange pi zero 3 , ideas pls

0 Upvotes

Me e comprado un ORANGE PI ZERO 3 DE 1GB DE RAM y varios componentes electronicos como una pantalla TFT de 128x160 , sensores, luces, diodios, etc. Tengo algunos proyectos en mente como servidores locales, bloqueadores de anuncion para la casa, intentar un "apaga pcs" con concectarlo a un usb y mas pero me gustaria saber que mas podria hacer.

Me he comprado esto:

https://es.aliexpress.com/item/1005006139989470.html?invitationCode=R0NGTU4ySFVYa09wZU1PVHg4aStTYzRSMlk2R1Bna1hRZHhUaFlSaEM2NmVQemFTZUJrNWVWT0s1MU1hdTAyWg&srcSns=sns_WhatsApp&spreadType=socialShare&social_params=61634254943&bizType=ProductDetail&spreadCode=R0NGTU4ySFVYa09wZU1PVHg4aStTYzRSMlk2R1Bna1hRZHhUaFlSaEM2NmVQemFTZUJrNWVWT0s1MU1hdTAyWg&aff_fcid=7a753e4627684b1181e826a249a3af76-1791301567091-03638-_EyfE51c&tt=MG&aff_fsk=_EyfE51c&aff_platform=default&sk=_EyfE51c&aff_trace_key=7a753e4627684b1181e826a249a3af76-1791301567091-03638-_EyfE51c&shareId=61634254943&businessType=ProductDetail&platform=AE&terminal_id=f5cbccb6e3034f6d9d9ce5be321e216f&afSmartRedirect=y&gatewayAdapt=glo2esp

y esto

https://es.aliexpress.com/item/1005007594124386.html?invitationCode=R0NGTU4ySFVYa081VVIrTE1qL1paYzRSMlk2R1Bna1hRZHhUaFlSaEM2NmVQemFTZUJrNWVWT0s1MU1hdTAyWg&srcSns=sns_WhatsApp&spreadType=socialShare&social_params=61634254985&bizType=ProductDetail&spreadCode=R0NGTU4ySFVYa081VVIrTE1qL1paYzRSMlk2R1Bna1hRZHhUaFlSaEM2NmVQemFTZUJrNWVWT0s1MU1hdTAyWg&aff_fcid=5a39b2df82eb4e92803b6ae7f8323b4e-1791301605643-07482-_EIisN7s&tt=MG&aff_fsk=_EIisN7s&aff_platform=default&sk=_EIisN7s&aff_trace_key=5a39b2df82eb4e92803b6ae7f8323b4e-1791301605643-07482-_EIisN7s&shareId=61634254985&businessType=ProductDetail&platform=AE&terminal_id=f5cbccb6e3034f6d9d9ce5be321e216f&afSmartRedirect=y

PD: si es de aliexpress, el presupuesto es lo que hay xd


r/raspberrypipico • • 10d ago

Same spi port has multiple rx and tx lines?

2 Upvotes

If i am looking at the pico pinout correctly, it seems like there are at least twop tx and rx lines on the the spi0 port and spi1 port. Does anyone know how to use these? My first intuition is that each spi port can only have one rx and one tx line so any clarification would help greatly!


r/raspberrypipico • • 10d ago

From learning RP2040 PIO to a complete telemetry system: Introducing SIMUT

3 Upvotes

Hi everyone! I’d like to share a personal project that has grown into something quite massive.

It started out as an experiment to learn the RP2040’s PIO features by writing some Arduino libraries, but it ended up evolving into a complete monitoring and telemetry system. The sensor drivers are built to be completely modular so that new ones just drop in, and the releases are now backed by automated and bench tests.

Even so, there is still a lot we can optimize and implement. If anyone has ideas, feedback, or wants to contribute, I would be absolutely thrilled. The repository is open and free for ideas!

https://github.com/angeloINTJ/simut


r/raspberrypipico • • 10d ago

Pico 2W USB interface killed by Powman?

1 Upvotes

Hi folks,

I have a prototype board I'm working on that uses a Pico 2W to add functionality to a vintage pocket computer. I had made a lot of progress until today. Power consumption is a concern, so I had set up the solution to put the RP2350 dormant between events/commands. Dormant, though, the Pico 2W was still drawing about 6 or 7mA, which is still about 6 or 7 times what the whole pocket computer draws.

Today I tried adding some functionality to go full Powman shutdown instead of, or in addition to, dormant (i.e. set to dormant immediately, and Powman shutdown after one minute). I got the Powman sleep/wake wrong... partially mixed with the CYW43 handling. Net/net is that I bricked my Pico2W, and, even after a flash erase over SWD, it still won't connect to USB, in BOOTREL or not.

Windows reports an unrecognized device. I have tried the RUN ground trick, and the 3V3_EN trick, and deleting the USB device, and rebooting the laptop, and none of these things help. As far as I can tell, something about that Powman goof permanently damaged the USB port. By the way, it was not connected to USB when it initially failed.

One thing I wonder is if this maybe something related to bad state in the CYW43 that can't be corrected through the SWD connection to the RP2350?

Any other ideas of things to try to see if this Pico2W can be saved/recovered? I guess, worst case, I will use it just over SWD, but I would really like to get USB working again.

Thanks,
Paul


r/raspberrypipico • • 11d ago

LittleFS on built-in Flash | RP2350 #16

Thumbnail
youtube.com
1 Upvotes

r/raspberrypipico • • 12d ago

hardware DIY Resonating FM Drum Machine with Raspberry Pi Pico2 on Breadboard - A Few Beats

Thumbnail
youtu.be
44 Upvotes