Pico Audio Pack Support

I may have missed something but I can’t find any libraries or examples for the Raspberry Pi Pico Audio pack.

The product page refers to the Pico SDK but, other than bit banging the audio into the card using DMA or manually toggling the GPIO pins I can’t see any higher level support.

Have I missed something or am I going to have to start reading up on the DMA, timer and interrupt functions and roll my own driver?

1 Like

The software end of things for the Pico accessories seems a bit underbaked at the moment, I think some boards have hit the shop before the accompanying code is finished. It might be worth poking @Gadgetoid on twitter or Github to see what the deal is, the repo page says that the audio pack has a library, so he may have just forgotten to unhide it?

1 Like

https://www.raspberrypi.org/products/raspberry-pi-pico/specifications/ says that the chip comes with two I2S peripherals but can’t find any examples either at https://github.com/pimoroni/pimoroni-pico or https://github.com/raspberrypi/pico-examples

In the 2040 Datasheet there is mention of a “popcorn” media player that uses the I2S but I can’t find any other details of this.

https://learn.adafruit.com/getting-started-with-raspberry-pi-pico-circuitpython says:

You’ll note there’s no I2S peripheral… instead of having specific hardware support for serial-data-like peripherals like these, the RP2040 comes with the PIO state machine system which is a … way to create custom hardware logic and data processing blocks. … … … often we bitbang the timing-specific protocol… for the RP2040, we instead use a PIO object that reads in the data buffer and clocks out the right bitstream… Same with I2S audio in or out.

But the lack of I2S does seem to contradict https://www.raspberrypi.org/products/raspberry-pi-pico/specifications/

And there still doesn’t seem to be any example of how to get PIO to do I2S anyway.

But there is something to at least make a start on PIO here: https://github.com/raspberrypi/pico-examples/tree/master/pio

In the “readme” for the SDK, it mentions:

Additional libraries/APIs that are not yet ready for inclusion in the Pico SDK can be found in https://github.com/raspberrypi/pico-extras

And, sure enough, here’s:
https://github.com/raspberrypi/pico-extras/tree/master/src/rp2_common/pico_audio_i2s

Still no examples… but there’s some library source to get started.

But the lack of I2S does seem to contradict https://www.raspberrypi.org/products/raspberry-pi-pico/specifications/

That says I2C, which is not the same as I2S. The RP2040 doesn’t have I2S hardware units, but it’s possible to emulate one using the Programmable IO, which is what your later links are describing.

1 Like

Has anyone had any luck getting the i2s example from pico-extras working with the pico-audio?
It certainly isn’t working for me.

Edit: Ok I managed to get a very glitchy looking sinewave out of one of the outs using the example.
Appears the API expects you to set the GPIO number not the pin number, so its really:

#define PICO_AUDIO_I2S_DATA_PIN 9
#define PICO_AUDIO_I2S_CLOCK_PIN_BASE 10

The web page for the device on the pimoroni store incorrectly tells you to set them to 12 and 14 respectively.
Now to figure out how to get stereo out before making an i2S API for humans.

2 Likes

as promised on the product page:
Please note that Pico Audio Pack only currently works with the C/C++ Pico SDK! We have Micro Python support planned but it is not available yet.
Any idea when this will happen?
As a newbie to pico, and python, (and so much more) a BUMP from the heart…