SidBerry2 – enhanced Raspberry Pi 6581 SID player

I post here the great work of Davide aka Thoroide (thoroide@gmail.com). 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.

image001

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/

image003

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.

image005

For all remaining digital connections i use the SIDBerry original schematic.

Software

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:


1) add #include <unistd.h> after the line #include <sys/time.h>
2) search for \mread and replace with \nread

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

qnjvo2

Fitted protoboard on PI

image010

image011

image014

You can see a video of operating hardware here:

Next?

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.

Tagged , .

9
Leave a Reply

avatar
3 Comment threads
6 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
5 Comment authors
ThorstiAnonymousLM02Gianlucacreepebrine Recent comment authors
Thorsti
Thorsti

There might be a mistake in the SidBerry2 schematic. For 8580 it tells C1/C2 should be 22pF and the C64 schematic above tells 22000pF which looks more reasonable. It is worth to mention that for the Cs polystyrene capacitors gives less noise compared to ceramic.

LM02
LM02

Hello!
I’ve just completed building this circuit, but the music really sounds weird. After some testing I found out it is a bad oscillator (quartz). Can anyone give me the type of quartz used in this guide or some quartz known to be working? Has it to be a 1 MHz TTL Quartz? Thanks in advance.
– LM02

Anonymous
Anonymous

Hi!, you need a 1MHz TTL oscillator which outputs a square wave 0V-5V, 50% duty cycle. Simply connecting a 1 MHz quartz wont work. I used a generic 1MHz 5V oscillator O1M000000L632. Here the link:
https://uk.farnell.com/ael-crystals/o1m000000l632/crystal-oscillator-1mhz/dp/9509798

LM02
LM02

Thanks for your answer! Yes I maybe used a wrong oscillator (a TFT680 1MHz I got from conrad.de) with a CMOS output, because it was cheap and the only one with 1 MHz (non SMD). Is there any cheaper alternative, because arround 7,50€ is way too much for me for such a part.

creepebrine
creepebrine

Is it normal when an 8580R5 SID’s output is very quiet and barely hearable? Adding an LM386 amplifier didn’t help. Output seems to be correct, but how could I make it actually hearable? Could it be the (brand new) 9V battery I used to power the SID’s 9V line?
Greetings from Germany!

creepebrine
creepebrine

Hello.
Thanks for your reply. I was able to get more sound out of the SID using an external amp. Now I noticed a very strong noise which makes the music barely hearable. Here’s an example I recorded on my PC (usually makes very “clean” recordings): https://bit.ly/2CHQPit
The SID File I used: https://bit.ly/2RpTlSq
Any solution?
– Creepebrine