- Notifications
You must be signed in to change notification settings - Fork2
henrikenblom/SIDPod
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
The SIDPod is a PSID player for RP2040 microcontroller based boards, such as theRaspberry Pi Pico or theSolder Party RP2040 Stamp. Playback is based on the SID emulator found inRockbox, which in turn is based on TinySID.
SIDPod requires both theRaspberry Pi Pico SDK and thepico-extras. Make sure to grab these and either put them next to theSIDPod directory or, if you have them somewhere else, point thePICO_SDK_PATH
andPICO_EXTRAS_PATH
environmentvariables to their respective location. You'll also need CMake on your path. If/when these prerequisites have beensatisfied, you're almost ready to run thecmake
command to create the build directory and configure the build. Onelast thing to do is to make sure the board type matches the one you have. By default, SIDPod builds for the Solder PartyRP2040 Stamp, which, for example, has a larger NAND flash than the more common Raspberry Pi Pico. Using a RP2040 StampUF2 on a Pi Pico would most likely cause issues on the first run, as the flash will get formatted,using boardspecific settings, if no readable FAT filesystem is found on it. Changing board type can either be done by modifyingthePICO_BOARD
variable inCMakeLists.txt or by setting thePICO_BOARD
environment variable beforerunning thecmake
commands. The correct value for the Raspberry Pi Pico is 'pico'. Once this is done, the build isconfigured by running:
cmake -B cmake-build-debug
Alternatively, if you haveNinja installed, you can save a few seconds of your valuable timeby instead running:
cmake -G Ninja -B cmake-build-debug
Then, to build theSIDPod.uf2 binary, issue:
cmake --build cmake-build-debug --target all -j 12
Once the build finishes, just follow the official instructions for loading a UF2 binary onto the board. For Raspberry PiPico you hold down theBOOTSEL button when you plug it in and then copySIDPod.uf2 to it, once it appears as adrive namedRPI-RP2. For some other types of boards, such as the Solder Party RP2040 Stamp, this mode is activated bydouble-clicking the reset button.
Also note that if you're running macOS, copying using Finder might fail with thiserror:The operation can’t be completed because an unexpected error occurred (error code 100093).If this is the case, fire up the 'ol terminal and do:
cp cmake-build-debug/SIDPod.uf2 /Volumes/RPI-RP2
To get a jump start you can also grab theprebuilt binaries.There are two versions, one for the Solder Party RP2040 Stamp and one for the Raspberry Pi Pico.
Since the main goal is to make a portable player, the actual build and design is up to you, the maker. My currentprototype is built inside a 3-AA battery box I had lying around, using a Solder Party RP2040 Stamp and a 3.7V 150mAhLiPo battery. However, the breadboard design I'm using for development, based on a Raspberry Pi Pico H, looks like this:
In reality, the development breadboard looks a bit different. I use a dual lane breadboard and connect to the SIDPodPico board via aPicoprobe, for debugging and a less painful developmentprocess.
The development breadboard setup.
The working prototype. Please excuse the soldering. I'm a lover, not a solderer. 😜
The main advantage of the Solder Party RP2040 Stamp, besides its size, is the onboard LiPo charger. This removes somecomplexity and saves space when moving beyond the breadboard design. Many RP2040 projects can easily run off the powerprovided from the host computer over the built-in USB port. The SIDPod however, will enter a special USB device stateand start to mimic a USB mass storage device once connected to a computer.More on that here. Thisposes a problem, if you actually want to use it for what it's designed for - to play PSIDs. That problem can easily besolved by powering it from any power source connected to theVSYS pin. That power source can be anything from a 3.7VLiPo battery to a separate USB breakout bord, with the breakout boardsVBUS connected toVSYS on the Pico Board andthe breakout board GND connector connected to any GND on the Pico Board. In my development breadboard setup I power theSIDPod Pico Board from the Picoprobe Pico Board. In the next section I've listed the components needed for a fewdifferent options:
Option 1 - Using a Solder Party RP2040 Stamp (the prototype setup):
- 1 xSolder Party RP2040 Stamp
- 1 xAdafruit I2S 3W Class D Amp - MAX98357A
- 1 xLCD OLED 0.91″ 128x32px I2C
- 1 x 3.5mm stereo jack
- 1 xRotary encoder w switch
- 2 x100Ω resistor
- 1 xBattery LiPo 3.7V 150mAh
Option 2 - Using a Raspberry Pi Pico (the breadboard setup):
- 1 xAdafruit I2S 3W Class D Amp - MAX98357A
- 1 xLCD OLED 0.91″ 128x32px I2C
- 1 x3.5mm stereo jack
- 1 xRotary encoder w switch
- 2 x100Ω resistor
Option 2a - Add a Raspberry Pi Pico with Picoprobe, for debugging, binary upload and power through VSYS:
Option 2b - Power the Raspberry Pi Pico through a USB breakout board:
To keep the construction as simple as possible I tried to minimize the number of physical controls, and a rotary encoderwith a built-in push button provides enough versatility to cater to every possible use case of this rather minimaldesign. Therefore, controls are both contextual and pattern driven.
TheSID or Sound Interface Device, which this player does arudimentary emulation of, was a component in the world's most popular home computer, theCommodore 64. Due to its legendary status and, to this day, very activecommunity, there's no shortage of SID files to fill your SIDPod with. The most complete collection is theHigh Voltage SID Collection. It has everything, from cult classics by the legendary JeroenTel to contemporary pieces by Kamil Wolnikowski, aka Jammer. Download the full archive and use one of the SID playersreferenced on that page to find the music you like. The collection contains both PSIDs and RSIDs. However, RSID playbackrequires either a real C64 or a more sophisticated emulator than TinySID. More on the effects of this in the nextsection.
The SIDPod doubles as a USB mass storage device, which means that if you plug it in to your computer it will show up asa regular, FAT-formatted drive. This means that adding and removing PSIDs is as easy as copying or deleting files. Thereare a few caveats though:
- Only PSIDs are supported, RSIDs are filtered out. Unfortunately they share the same file extension, which means it'simpossible to know beforehand if a SID file is playable or not. So, if you add a tune to the SIDPod, and it doesn'tshow up, this is most likely the cause.
- PSIDs must be put in the root directory.
- Use it with moderation.FatFs doesn't have anywear levelling algorithm, and NAND flash storage wears out faster thanregular flash drives. Note though that this only goes for write operations. Reading is totally harmless.
- It's slower than you're probably used to. This is due to several factors. One being that flash memory blocks needs tobe erased before new data can be written to them.
While the SIDPod is connected, the screen shows flickering bars. Don't be alarmed. This is a feature, not a bug. Infact, it's a reference to the C64 - those who know, know.
Once you've added some funky tunes andsafely disconnected the SIDPod it presents the titles. In the order they wereadded. The controls in this mode are:
- Scroll through the list by turning the encoder.
- Single-clicking plays the selected song and enters a very retro-fancy visualization mode.
- Double-clicking plays or pauses the selected song but keeps the playlist mode.
- Double-clicking in visualization mode pauses playback and displays a pause notification on screen.
The currently selected song is decorated with a traditional play symbol and the currently playing song is decorated withan animated spectrum analyser symbol. When a song is paused, the animation is paused as well.
If a song gets crossed out when you're trying to play it, it means that it's either corrupt or uses a combination ofopcodes that have caused the song loading routine to enter an infinite loop and seemingly hang. This is very rare.
These controls are only available from the visualization mode and are activated by rotating the encoder. The controls inthis mode are:
- Lower/raise the volume by turning the encoder.
- Single-clicking toggles line level on/off. Use this if you notice distortion when the SIDPod is connected to anamplifier.
After two seconds of inactivity the SIDPod returns to the visualization mode.
In this mode the screen is turned off, as well as the regular controls. Playback is still active though, which makes itperfect for when you're out and about. To enter this mode, simply hold the button pressed until the screen goes black.This takes exactly one second. Be careful not to hold it for too long, as this will put the SIDPod to sleep. More onthat in the next section. To get out of pocket mode, simply double-click, and it will return to whatever mode you werein before entering pocket mode.
This mode is as close as you can get to turning the SIDPod off. As with pocket mode, all regular controls are disabled.Additionally, playback is stopped, as well as USB device clocks. In fact, in this mode, even both processor cores arestopped, meaning that the power consumption is next to nothing. To enter deep sleep, press the button for more than twoand a half second. To get out, just double-click.
About
A SID player for RP2040 microcontrollers