Wave-file player using sigma-delta DAC


mkarlsson

Recommended Posts

A while ago there was interest in microblaze_mcs design so I decided to make a project to show what it can do, 

 

The project has the following components:

* microblaze_mcs running at 120 MHz

* uart module for serial i/o

* spi module for sd-card file i/o

* wing module for digital i/o

* timer module for time keeping

* sound module for sigma-delta sound output

 

Software for the system is written using Arduino 1.5.2 with additions for generating microblaze code.

To demonstrate the system a wave file player capable of playing 16-bit 44.1 khz stereo wave files from the sd-card is included in the project.

For this app, the sound sample files in the wave folder needs to be copied to a sd-card for the pipistrello board to read.

The bit-files have the wave-file player app pre-loaded in BRAM.

 

The following file are available for download:

 

http://www.saanlima.com/download/pipistrello-v2.0/waveplayer_no_songs.zip (379 kB)

This is just the bit file and a few short sound examples to peak your curiosity.

 

http://www.saanlima.com/download/pipistrello-v2.0/waveplayer.zip (79.5 MB)

This is the bit file with two full-length songs.  This really shows how good the sound from the sigma-delta DAC can be.

 

http://www.saanlima.com/download/pipistrello-v2.0/waveplayer_complete.zip (324 MB)

This is the complete project including all source code, ISE project setup, Arduino_1.5.2 code base and waveplayer arduino sketch.

In other words, everything needed to recreated the bit file and the wave-file player app.

 

Enjoy!

Link to comment
Share on other sites

Wow amazing, it sounds crystal clear to me! Without downloading the 324MB source, can you tell me, is this the standard Xilinx ΣΔ from XAPP154 ? If so what is the clocking freq ? The theoretical ideal would be 2^16 bits *44.1K samples or 2.89Ghz! so I'm pretty sure you didn't go that high :)

Link to comment
Share on other sites

It's not using the XAPP154 code but the idea is the same. 

 

The sigma-delta DAC has 12 bit resolution and is clocked at 120 MHz.  Here is the verilog code:

 

module dac(clock, DACin, DACout);
input clock;
input [11:0] DACin;
output DACout;

  reg [12:0] accumulator;
  always @(posedge clock)
    accumulator <= accumulator[11:0] + DACin;

  assign DACout = accumulator[12];
endmodule

Link to comment
Share on other sites

Here is a bit more information about how to rebuild the complete system on windows.  BTW, the size of the system is 910 slices.

 

The process of generating the waveplayer bit file has 3 steps:

1) Build the hardware system in ISE

2) Copy the .bit file and the .bmm file from the ISE build to the Arduino system

3) Startup the Arduino IDE, open the waveplayer.ino sketch and compile/upload to Pipistrello

 

 

More detailed information:

 

 

First download and unzip the waveplayer_complete.zip file somewhere on your computer.

 

Copy the files in <waveplayer>\wave folder to a uSD-card, insert the uSD-card in the Pipistrello sd-card socket, connect an audio cable to the board and finally connect the Pipistrello board to the PC.

 

Next step is to build the hardware system.  Go to <waveplayer>\ise and double-click on mb_mcs.xise to launch ISE.

Double-click on "Generate Programming File" in the process window pane, this will rebuild the hardware system (it will take a few minutes).

The build will generate two output files - top.bit (the bit file without program) and ipcore_dir\microblaze_mcs_v1.3_bd.bmm (information about the BRAMs used for holding the program). 

Those two files needs to be copied to the Arduino system at <waveplayer>\arduino-1.5.2-mcs\hardware\saanlima\microblaze_mcs\variants\pipistrello_LX45\bitstreams

 

Next step is to compile and upload the waveplayer code to Pipistrello using the arduino IDE.  Go to <waveplayer>\arduino-1.5.2-mcs and double-click on arduino.exe to launch the arduino IDE.

Select "Pipistrello LX45 Microblaze_mcs" as the board in the Tools->Board pulldown menu

Open the waveplayer.ino sketch using the File->Open... pulldown menu

Click on the "Upload" button, this will compile the sketch and upload the bitfile (with the program added) to Pipistrello (make sure you have the board hooked-up to the PC).

Once the bit file is uploaded the sd-card will be scanned for wave files and any file that has a valid wave-file header will be played.

The program only accepts wave files that has this header: https://ccrma.stanford.edu/courses/422/projects/WaveFormat/

(some wave file has additional information in the header, like song and artist name, which the current program wont accept)

Link to comment
Share on other sites

Building this from scratch I get an error in bitgen:

 

Command Line: bitgen -intstyle ise -f top.ut top.ncd
ERROR:Bitgen:190 - Unable to read BRAM data file
   'J:/Documents/Projects/Pipistrello_v2.0/mb_mcs_lx9/ipcore_dir/mb_bootloop_le.
   elf'.

 

Probably a reference to directory on your system. That .elf file is present in the ISE project but I cant find just what file contains the reference to it.

Link to comment
Share on other sites

Yeah, you need to tell ISE where that file is on your system.

 

Try to type this command in the Tcl console:

microblaze_mcs_data2mem ipcore_dir/mb_bootloop_le.elf

 

(If the Tcl console is not visible, select View -> Panels -> Tcl Console in the menu.)

 

If that doesn't work then type this in the Tcl console:

source ipcore_dir/microblaze_mcs_setup.tcl

 

Hope this helps

Link to comment
Share on other sites

The tcl commands worked:

 

Command>microblaze_mcs_data2mem ipcore_dir/mb_bootloop_le.elf

microblaze_mcs_data2mem: Found 1 MicroBlaze MCS core.

microblaze_mcs_data2mem: Using bootloop for microblaze_mcs_v1_3

microblaze_mcs_data2mem: Added "-bd" options to bitgen command line.

microblaze_mcs_data2mem: Running "data2mem" to create simulation files.

microblaze_mcs_data2mem: Bitstream does not exist. Not running "data2mem" to update bitstream.

microblaze_mcs_data2mem: Done.

Command>source ipcore_dir/microblaze_mcs_setup.tcl

microblaze_mcs_setup: Found 1 MicroBlaze MCS core.

microblaze_mcs_setup: Existing ngdbuild "-bm" option unchanged.

microblaze_mcs_setup: Done.

 

Then the bitfile was generated with no errors.

 

Thanks for your help!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.