User Tools

Site Tools


2014:fpga_piano_drums

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
2014:fpga_piano_drums [2014/12/16 23:28]
jkingery [Verilog Modules]
2014:fpga_piano_drums [2014/12/18 23:55] (current)
jkingery
Line 1: Line 1:
 ====== FPGA Chiptunes ====== ====== FPGA Chiptunes ======
 ===== What did we do? ===== ===== What did we do? =====
-For our project, we programmed a Field Programmable Gate Array (FPGA) with Verilog that allowed a person to use the eight built-in switches as a keyboard and the four built-in buttons as a drum pad.  The sounds we set out to emulate were those of the computers and game systems of the past known as chiptunes.+For our project, we programmed a Field Programmable Gate Array (FPGA) with Verilog that allowed a person to use the eight built-in switches as a keyboard and the four built-in buttons as a drum pad.  The sounds we set out to emulate were those of the computers and game systems of the past, also known as chiptunes. ​ An image of our setup is seen below. 
 + 
 +{{ :​2014:​jr_setup.jpg?​nolink&​300 |}} 
  
 ===== Why did we do it? ===== ===== Why did we do it? =====
-Good question. Next question.+We were both interested in learning about how the audio from some of our childhood games was created, and thought it tied in nicely with the things we learned throughout the course.
  
 ===== How did we do it? ===== ===== How did we do it? =====
-One thing to note about our implementation of the project is that our code was written specifically for the [insert model name here] FPGA, so some changes may need to be made if you have a different one that you would like to run this on.+One thing to note about our implementation of the project is that our code was written specifically for the FPGA seen in the photo, so some changes may need to be made if you have a different one that you would like to run this on.
  
 ==== Verilog Modules ==== ==== Verilog Modules ====
 === Clock Divider === === Clock Divider ===
-The first module that we made was a clock divider. ​ This allowed us to slow down the built-in clock of the FPGA to audible frequencies. ​ For reference, our FPGA's default clock frequency was 50MHz while humans can only hear up to about 20kHz. ​ We used [[http://​www.fpga4fun.com/​MusicBox.html|this website]] as a reference to ensure that we were upholding good practices such as __**not**__ gating the clock. ​ We instantiated eight of these modules to get square waves of eight different frequencies (we chose frequencies that made a G Major scale starting on G4).  These eight square waves could then be ANDed with the eight switched ​on the FPGA board, and the results output through eight different General Purpose Input/​Output (GPIO) pins. +The first module that we made was a clock divider. ​ This allowed us to slow down the built-in clock of the FPGA to audible frequencies. ​ For reference, our FPGA's default clock frequency was 50MHz while humans can only hear up to about 20kHz. ​ We used [[http://​www.fpga4fun.com/​MusicBox.html|this website]] as a reference to ensure that we were upholding good practices such as __**not**__ gating the clock. ​ We instantiated eight of these modules to get square waves of eight different frequencies (we chose frequencies that made a G Major scale starting on G4).  These eight square waves could then be ANDed with the eight switches ​on the FPGA board, and the results output through eight different General Purpose Input/​Output (GPIO) pins. 
  
  
Line 23: Line 26:
  
 ===== How can it be built upon? ===== ===== How can it be built upon? =====
-All of our code is found [[https://​github.com/​jacobkingery/​CA14Project|here]] on GitHub. ​ The files relevant to the keyboard/​drum pad are [insert file names here].  ​+All of our code is found [[https://​github.com/​jacobkingery/​CA14Project|here]] on GitHub. ​ The files relevant to the keyboard/​drum pad are keyBoardBringup.v,​ squareWave.v,​ noiseWave.v,​ and edgeDetector.v. ​ All of the .do files were used for simulating our system using ModelSim PE Student Edition.  ​
  
 One of the strangest things we encountered while working on this project was finding the right amplifier power supply. ​ We tried powering it using an Analog Discovery, regulated USB breakout, and direct USB breakout, but these all caused undesirable effects on the audio quality when more than two notes were played simultaneously. ​ We then turned to a benchtop power supply, but had the same issue until we switched from using the variable source (set to 5V) to the dedicated 5V source. ​ However, when we came back another day and were using a different benchtop power supply, we had the opposite problem; the dedicated 5V source caused the issues while the variable source (set to 5V) did not.  We're still not entirely sure what the underlying cause of these effects was or why it was such a gamble on whether or not a power supply would give us trouble with it. One of the strangest things we encountered while working on this project was finding the right amplifier power supply. ​ We tried powering it using an Analog Discovery, regulated USB breakout, and direct USB breakout, but these all caused undesirable effects on the audio quality when more than two notes were played simultaneously. ​ We then turned to a benchtop power supply, but had the same issue until we switched from using the variable source (set to 5V) to the dedicated 5V source. ​ However, when we came back another day and were using a different benchtop power supply, we had the opposite problem; the dedicated 5V source caused the issues while the variable source (set to 5V) did not.  We're still not entirely sure what the underlying cause of these effects was or why it was such a gamble on whether or not a power supply would give us trouble with it.
Line 29: Line 32:
 We were able to achieve our initial goals of having square wave sounds and noise sounds in a fairly timely manner. ​ We then put quite a bit of time into improving our project, but were not able to get it working the way we wanted. ​ There are more details on this below. We were able to achieve our initial goals of having square wave sounds and noise sounds in a fairly timely manner. ​ We then put quite a bit of time into improving our project, but were not able to get it working the way we wanted. ​ There are more details on this below.
  
-We were looking to do more with our project, namely implementing the ability to pre-program songs and have them played for you.  However, we ran into some very strange issues including seemingly identical files producing different results. ​ The files relevant to our work on this are [insert file names here].  We feel that, given another week or two, we would be able to sort out the problems we were having with this, especially since we have seen other teams have success with similar features. +We were looking to do more with our project, namely implementing the ability to pre-program songs and have them played for you.  However, we ran into some very strange issues including seemingly identical files producing different results ​and the FPGA ignoring the clock frequency selection jumper. ​ It behaved as expected when simulated in ModelSim, but synthesizing and uploading to the FPGA did not produce the wonderful music we were expecting.  The files relevant to our work on this are playFromFile.v,​ songMemory.v,​ increasing.dat,​ and all of the files from the manual version.  We feel that, given another week or two, we would be able to sort out the problems we were having with this, especially since we have seen other teams have success with similar features.
  
2014/fpga_piano_drums.1418790489.txt.gz · Last modified: 2014/12/16 23:28 by jkingery