This is a Raspberry Pi Pico based audio function generator built using their C SDK. The DAC output is generated using a PWM: the output would typically be filtered to produce an analog waveform with or without a DC offset. I built this to test some other audio ADC/DAC devices I'm developing.
For development I used a Raspberry Pi Pico W. Eventually I will add Bluetooth control, but if you are only using the serial debug monitor for control, a plain Pico should also work.
For testing I verified the PWM waveforms using an oscilloscope.
I'm assuming you know how to build code with the Pico C SDK.
Built with Raspberry Pi Pico C SDK 2.2.1. It may work with other versions of the SDK
Standard cmdline CMake build using the Pico C SDK.
Export PICO_SDK_PATH environment variable to point to your SDK.
I used this Docker image to make a container. It contains an old version of the C SDK: I manually installed the current/newer version.
Configuring the Build
- To change which GPIO the PWM output uses, edit the DAC_GPIO setting in func_gen.c or pass it via CMake with target_compile_definitions, etc (defaults to GPIO27)
Any time you change the configuration in the CMakeLists.txt, you should run:
($ is the top level of your repository clone)
cd $
rm -rf build
mkdir build; cd build
cmake ..
make
First time Build
($ is the top level of your repository clone)
cd $
mkdir build; cd build
cmake ..
make
| Signal | PICO W Pin | Pico Signal |
|---|---|---|
| TX | 1 | UART0_TX / GP0 |
| RX | 2 | UART0_RX / GP1 |
| GND | 3 | GND |
| PWM/DAC | 32 | PWM5B / GPIO27 |
Serial Debug Monitor
Connect to the standard serial port pins with your favorite serial port adapter. The settings are 115200/8N1 with no flow control. I use Putty to connect, most serial terminal programs should work. Type help or ? for instructions
This project uses a serial debug monitor written by some friends and used on many different embedded systems projects. AFAIK, it is not published online, and is modified a little on every project.