In this lab, we will program the FPGA on the Nexys2 board to generate a wailing audio siren using a digital to analog converter (DAC). This will require us to format our digital audio sequence into a serial stream that can be used to drive an outboard DAC.
- We will be using a 16-bit stereo Digital to Analog Converter module PmodI2 S which plugs into one of the PMOD connectors on the Nexys2 board. The module and its connections are shown in Figure 1
- The DAC converts “left” and “right” 16-bit digital data streams into two analog left and right channel signals which can be used to drive a stereo speaker system
- The DAC employs an oversampled Delta-Sigma Modulator to convert the digital data into analog format
- Plug the PmodI2 S module into PMOD jack JA on the Nexys4 board (Figure 2)
- Plug the module into the top row of sockets on JA
- Using the same project settings from the previous labs, create a new project titled 'Siren'.
- Shown in Initial Project Setup in Lab 3
- Create a new source titled 'dac_if'
- Shown in Initial Project Setup in Lab 3
- Code found in Figure 3
- Create another source titled 'tone'
- Create another source titled 'wail'
- Create a top level source titled 'siren'
- Code found in Figure 6
- This is the top level that hooks it all together. In this module:
- The constants lo_tone, hi_tone and wail_speed define the parameters of the siren
- The 20-bit timing counter tcount is used to generate all the necessary timing signals
- The module wail is instanced to generate the 16-bit signed audio sequences data_L and data_R
- These sequences are then sent to an instance of dac_if to convert them to the required serial stream
- Primary outputs of this top level module go directly to the DAC
- Add an Implementation Constraint source file titled 'siren'
- Highlight the 'siren.vhd' module in the Hierarchy window and run Synthesis
- Run Implementation
- Generate Bitstream
- Plug in the device if it is not already and Vivado should detect the board
- Click Program Device and load the generated bitstream onto the board
- If you cannot click Program Device, click Open Target first
- Plug the DAC Module into either a speaker or headphones.
If everything was correctly setup, you should be hearing a siren, similar to the siren sound on a police car.
How to set up the bitstream:
http://users.wpi.edu/~rjduck/Nexys4DDR%20Vivado%20VHDL%20Decoder%20Tutorial.pdf
How to Connect The Nexys A7 to your computer:
https://github.com/Digilent/Nexys-A7-100T-GPIO
Dr. Ackland's Lab Manual:
http://personal.stevens.edu/~backland/Courses/Course487_Spring_18_files/Labs/Lab5.pdf
GitHub:
https://github.com/kevinwlu/dsd