I post here the great work of Davide aka Thoroide (firstname.lastname@example.org). He took my Raspberry Pi SID player project and enhanced it creating SidBerry2. It features a new power stage, a better audio output stage and much more:
Here the original post:
Time ago, I recovered a 6581 SID chip from a dead C64, and then I wondered if you could connect it to an Arduino or RaspberryPi.
I have done several researches, finding various projects, most of them abandoned. Having a Raspberry card on which I was doing other work, I chose the SIDBerry project by Gianluca Ghettini That seemed the easiest.
First of all I have slightly changed the hardware part. The original hardware was pretty basic, although perfectly functional. To do this, I got a similar project schematic created for Arduino platform called RealShield https://github.com/atbrask/RealSIDShieldand I took some parts in order to design a more powerful version of SidBerry.
First I got a component to generate +12V from 5V (MC34063A) of which you can see the functional diagram taken from the datasheet. Starting from this schematic a proper component value were calculated in order to obtain an increase of the voltage. The original circuit generates the +12V only using MC34063A, but this require some precision resistors on feedback, so I preferred to generate an higher voltage (+ 18V / + 20V) and then using an linear regulator 78L12 to be sure that the 12V was accurate. This to avoid the premature dead of MOS6581 chips, that can burn easily if the voltages are not accurate.
If you don’t like to make a Step-Up with spare components, you can easily buy an already done DC/DC like http://uk.rs-online.com/web/p/isolated-dc-dc-converters/6895015/
The second modification is about the audio output stage, creating one very similar to the original C64. In RealSIDShield, the network is a bit more complex, but the stage is a simple transistor amplifier.
For all remaining digital connections i use the SIDBerry original schematic.
For software part I done a step by step guide to make a working SIDBerry code, starting with a clean jassie image and a RaspberryPi 3.
I started with a clean image, jessie, in particular mine was the 2016-09-23-raspbiam-jessie.zip downloaded directly from the official source.
I followed this guide for a complete update of the fresh installation. https://www.raspberrypi.org/blog/introducing-pixel/
Next configure a static IP for easily remote connect the RPI, editing the file dhcpcd.conf sudo nano /etc/dhcpcd.conf and added at the end these following lines:
interface eth0 static ip_address=[your preferred fixed IP]/24 static routers=[your preferred gateway] static domain_name_servers=[your preferred DNS1][your preferred DNS2]
Then I activate a VNC server to easily remote control the raspberryPi using a following commands:
sudo apt-get install -y realvnc-vnc-server sudo vncinitconfig -service-daemon sudo systemctl enable vncserver-x11-serviced.service
then configure from desktop (clicking on the tray VNC icon) the preferred authentication method for access on your PI via VNC. These steps are optional, if you prefer can use an HDMI monitor with keyboard/mouse or SSH connection.
Next you need to install a WiringPi library, to make C++ program able to control I/O resources. Use the following commands:
sudo apt-get install git-core sudo git clone git://git.drogon.net/wiringPi cd wiringPi sudo ./build
If you have problems with wiringPi see this link: http://wiringpi.com/download-and-install/
So next you need to get the SIDberry sources:
Return to home dir (cd ..)
sudo git clone https://github.com/gianlucag/SidBerry cd SidBerry
Take ownership of all files
sudo chown pi:root *
Now edit with your preferred editor the file main.cpp to fix 2 little problems:
Now compile the sources to obtain the working executable
sudo g++ -o SidBerry mos6502.cpp SidFile.cpp main.cpp -lwiringPi
Now you can test your work using this command
sudo ./SidBerry R-Type.sid 0
where 0 is the song index of the SID file. Each SID file my contain various song or variations that you can play changing the index.
If you like to know something more about SID file format, follow this link: http://cpansearch.perl.org/src/LALA/Audio-SID-3.11/SID_file_format.txt
Fitted protoboard on PI
You can see a video of operating hardware here:
I don’t know when, but I would try to generate a 1Mhz clock for the SID using a PI internal timer, also can be interesting make a python GUI for the SIDBerry.
Also, but a little harder, try to change the 6502 player to allow to play a SID format that includes samples, in fact this player, actually was unable to play many famous SID+PCM song that include digitized instruments or voices. When you try to play this there are a SID format error. There are not a official documentation for this mode, and probably is not really standard.