Real Time Spectrogram

Similar documents
SHA1 decoder EDA385. Erik Hogeman, Niklas Hjern, Jonas Vistrand, October 31, 2013

VT100 { Project Proposal

Aircraft Combat. A mini game.

FPGA PAINT. Design of Embedded Systems, Advanced Course. Faculty of Engineering (LTH) Lund University, Sweden. November 30 th, 2010

Digital Signal Processing for Analog Input

COE758 Digital Systems Engineering

Project Report Two Player Tetris

Backing Up Firmware from Dallas Semiconductor DS5002FP

EITF35 - Introduction to Structured VLSI Design (Fall 2017) Course projects

LogiCORE IP AXI Video Direct Memory Access (axi_vdma) (v3.00.a)

Chapter 5 - Input / Output

Computer Architecture Review. ICS332 - Spring 2016 Operating Systems

LogiCORE IP AXI Video Direct Memory Access v4.00.a

LogiCORE IP AXI Video Direct Memory Access (axi_vdma) (v3.01.a)

EE 459/500 HDL Based Digital Design with Programmable Logic

Recommended Design Techniques for ECE241 Project Franjo Plavec Department of Electrical and Computer Engineering University of Toronto

Building an Embedded Processor System on Xilinx NEXYS3 FPGA and Profiling an Application: A Tutorial

Block Diagram. mast_sel. mast_inst. mast_data. mast_val mast_rdy. clk. slv_sel. slv_inst. slv_data. slv_val slv_rdy. rfifo_depth_log2.

ECE532 Design Project Group Report Disparity Map Generation Using Stereoscopic Camera on the Atlys Board

Fantastic Computer Design Report

Stepmania (AKA HA-DI-DI-R)

Designing Embedded AXI Based Direct Memory Access System

1 MALP ( ) Unit-1. (1) Draw and explain the internal architecture of 8085.

Mapping Multi-Million Gate SoCs on FPGAs: Industrial Methodology and Experience

Simulated 16-bit Intel Microprocessor

VHDL introduction Notes

Introduction. Overview. Top-level module. EE108a Lab 3: Bike light

Introduction to OS. Introduction MOS Mahmoud El-Gayyar. Mahmoud El-Gayyar / Introduction to OS 1

475 Electronics for physicists Introduction to FPGA programming

Laboratory Memory Components

Xilinx Tutorial Basic Walk-through

Project Gummi. 16-bit Microprocessor

CPU offloading using SoC fabric Avnet Silica & Enclustra Seminar Getting started with Xilinx Zynq SoC Fribourg, April 26, 2017

SUB-SYSTEM BOARD 5562 Campbell (MAXREFDES4#): 16-Bit High-Accuracy 4-20mA Input Isolated Analog Front End (AFE)

Yet Another Implementation of CoRAM Memory

LogiCORE IP AXI DMA (v3.00a)

LogiCORE IP AXI DMA v6.02a

LogiCORE IP AXI Video Direct Memory Access v5.00.a

XiNES Design Document. XiNES is a Nintendo Entertainment System simulator coded in pure VHDL

CS/EE 3710 Computer Architecture Lab Checkpoint #2 Datapath Infrastructure

Interfacing a PS/2 Keyboard

Resource-ecient Dynamic Partial Reconguration on FPGAs

Efficiency and memory footprint of Xilkernel for the Microblaze soft processor

LogiCORE IP AXI DMA v6.01.a

THE CPU SPENDS ALMOST ALL of its time fetching instructions from memory

Introduction to ARM LPC2148 Microcontroller

An FPGA Project for use in a Digital Logic Course

LogiCORE IP AXI Video Direct Memory Access (axi_vdma) (v2.00.a)

Outline Introduction System development Video capture Image processing Results Application Conclusion Bibliography

08 - Address Generator Unit (AGU)

Visible Light Communication with FPGAs

Fast dynamic and partial reconfiguration Data Path

CS 101, Mock Computer Architecture

V8-uRISC 8-bit RISC Microprocessor AllianceCORE Facts Core Specifics VAutomation, Inc. Supported Devices/Resources Remaining I/O CLBs

QUIZ Ch.6. The EAT for a two-level memory is given by:

MICROPROCESSOR AND MICROCONTROLLER BASED SYSTEMS

I also provide a purpose-built ADC/DAC board to support the lab experiment. This analogue I/O board in only needed for Part 3 and 4 of VERI.

I Introduction to Real-time Applications By Prawat Nagvajara

Homework 9: Software Design Considerations

OLED Engineering Kits User Manual

Input-Output Organization

How to use the IP generator from Xilinx to instantiate IP cores

Xilinx Platform Studio tutorial

Laboratory Finite State Machines and Serial Communication

Bryce Lightning (Network Rendering)

Chapter 5 Embedded Soft Core Processors

Operating system Dr. Shroouq J.

CSCE 236 Embedded Systems, Spring 2012 Quiz/Test 2

FPGA for Complex System Implementation. National Chiao Tung University Chun-Jen Tsai 04/14/2011

Lecture 5: Computing Platforms. Asbjørn Djupdal ARM Norway, IDI NTNU 2013 TDT

Xilinx Vivado/SDK Tutorial

LogiCORE IP AXI DMA (v4.00.a)

Stereo Vision IP Core

Lesson 5: Verifying RAMs with the Fluke 9010A Version 1.03

icroprocessor istory of Microprocessor ntel 8086:

RAID prototype system introduction. SATA-IP RAID prototype system for Xilinx FPGA. 3 September 2018 Design Gateway Page 1.

FPGA-BASED DATA ACQUISITION SYSTEM WITH RS 232 INTERFACE

TOPIC: Digital System Design (ENEL453) Q.1 (parts a-c on following pages) Reset. Clock SREG1 SI SEN LSB RST CLK. Serial Adder. Sum.

Animations involving numbers

Group 10 Programmable Sensor Output Simulator Progress Report #2

Adding the ILA Core to an Existing Design Lab

Cisco Series Internet Router Architecture: Packet Switching

Channel FIFO (CFIFO) (v1.00a)

System Verification of Hardware Optimization Based on Edge Detection

Multi MicroBlaze System for Parallel Computing

ΗΥ220 Εργαστήριο Ψηφιακών Κυκλωμάτων

Method We follow- How to Get Entry Pass in SEMICODUCTOR Industries for 3rd year engineering. Winter/Summer Training

FPGA Design Challenge :Techkriti 14 Digital Design using Verilog Part 1

CPSC 483 Computer System Design. Coff- Biweekly Report 4. April 26, 2004

OPERATING SYSTEMS CS136

Network. Department of Statistics. University of California, Berkeley. January, Abstract

8/16/12. Computer Organization. Architecture. Computer Organization. Computer Basics

Tutorial StellarIP Interface To AXI Interface

FPGA Guitar Multi-Effects Processor

Simplifying FPGA Design for SDR with a Network on Chip Architecture

3. Controtlto specify the mode of transfer such as read or write 4. A control to start the DMA transfer

Lecture-15 W-Z: Increment-Decrement Address Latch:

ZedboardOLED Display Controller IP v1.0

ADPCM: Adaptive Differential Pulse Code Modulation

Avnet S6LX16 Evaluation Board and Maxim DAC/ADC FMC Module Reference Design

Transcription:

Real Time Spectrogram EDA385 Final Report Erik Karlsson, dt08ek2@student.lth.se David Winér, ael09dwi@student.lu.se Mattias Olsson, ael09mol@student.lu.se October 31, 2013

Abstract Our project is about visualizing sound using an FPGA board, a monitor and an A/D converter to read the source. The visualization is a spectrogram, a graph showing frequency and intensity over time. To get a signal from the time domain to the frequency domain we use a Fast Fourier Transform algorithm. In the end we learned that writing our own components was not as easy as we thought and it saves a lot of work to adjust your architecture to use premade IP cores instead.

Contents 1 Introduction 2 2 Architecture 3 2.1 Hardware............................. 3 AD Converter........................... 3 Fast Fourier Transform...................... 4 VGA Module........................... 4 2.2 Software.............................. 5 3 User Manual 6 4 Problems 7 A/D Converter.......................... 7 Fast Fourier Transform...................... 7 VGA Module........................... 7 5 Lessons Learned 7 6 Contributions 8 7 Final Result 8 8 References 9 1

1 Introduction The project is about visualizing sound on a monitor through the use of a Nexys 3 spartan 6 FPGA. There is an analog signal as input that is converted with the AD-Converter, this signal is then processed with the FFT algorithm. Our initial thoughts were to write most of the components from scratch (see [Figure 1]), since we thought this would save area on the FPGA. This was however a mistake as it took a long time to write and debug the hardware. Instead we looked at which IP cores were available to us and decided to change architecture as to use those IP cores. We wrote a custom VGA and memory controller, and we wrote a wrapper to convert the FFT core for use with FSL instead of AXI4-Stream. The AXI_IIC was instantiated through XPS (see [Figure 2]). Figure 1: Proposed architecture Figure 2: Final architecture 2

2 Architecture 2.1 Hardware Below you will see a table outlining the utilization of our hardware. The percentages are of the entire project, not of the FPGA capability. Slices Slice Registers BRAMs Component Count Percentage Count Percentage Count Percentage VGA 64 2.7% 65 1.6% 8 25.8% ADC 262 10.2% 338 8.3% 0 0% FFT 616 25.6% 2147 52.3% 7 22.6% Microblaze 903 37.5% 1010 24.6% 16 51.6% Other components 565 24% 544 13.2% 0 0% Total 2410 4104 31 AD Converter Figure 3: AD converter schematic The signal input consists of an audio source connected to a PMOD AD2 from Digilent with some external circuitry. The PMOD contains a AD7991 12-bit A/D converter which communicates over an I2C interface. The I2C interface requires external pullups to communicate at a high enough rate since the internal pullups are to weak for the short rise time required for a sample rate of approximately 40kHz. The input signal needs to be modied to t the converter's input range, this is done with a simple circuit that adds a DC oset to the signal without aecting the audio source ([Figure 3]). The A/D converter is congured to convert from channel 0 and use supply voltage as reference, all other parameters are kept at their default values. 3

When the converter receives a read request over the i2c bus, it responds with 2 bytes of information. The rst byte starts with 2 zeros, 2 channel identier bits and the 4 most signicant bits of the conversion result, the second byte contains the remaining bits of the conversion result. Conversion value register Byte 1: 0 0 CH0 CH1 D11 D10 D9 D8 Byte 2: D7 D6 D5 D4 D3 D2 D1 D0 Fast Fourier Transform The Fast Fourier Transform algorithm is generated with Xilinx Core Generator tool. It has a 32 bit input signal and a 32 bit output signal, 16 bits for the real value and 16 bits for the imaginary value. The phase factor (a factor that's multiplied in every step of the FFT) is 16 bits so that should need an output length of 48 bits, this is avoided by using the scaling option to scale the numbers down. The FFT generated by Xilinx Core Generator uses the Axi4-Stream protocol to communicate. The MicroBlaze processor supports the AXI4-Stream protocol as well as the FSL protocol, but it can only use one of them, so either everything is AXI4-stream or everything is FSL. This causes an incompatability with the other cores in our project, because they are using the FSL protocol. To solve this incompatibility we have written a wrapper for the core that converts the protocol from Axi4-Stream to FSL. In addition to the conversion we also cut the output signal in half, since one of the properties of a Fourier Transform is that it is symmetrical around the middle point. The FFT we use have 256 points, but only outputs the 128 rst of the result to save a little bit of time while fetching the data. VGA Module The VGA module contains a VGA controller, some BRAM for video memory and a Finite State Machine for the memory interface. The VGA controller generates the timing signals and counters for the current screen position. Simplied, the FSM has three states; Draw_Pixels, Read_FSL, and IDLE. Draw_Pixels is the state that is responsible for putting and holding the correct pixel color on the RGB port of the VGA. Outside of this state the RGB port is set to a constant 0, meaning black color. This state is exited 4

when we are outside of our visible resolution, from this state we go to the Read_FSL-state. Read_FSL is where a new column of pixels is read. Because the FSL bus is 32 bits wide, but the memory is only 8 bits, we need to do this in 4 clock cycles, and increment the memory address between each of those cycles. To avoid unnecessary data movement the memory is made cyclic, and a signal is kept to keep track of where in the memory the rst column is. We place the new column that we read to the left of the previously newest column, and then we decrease the signal to indicate the new rst column. From this state we jump to the IDLE -state as soon as we are done reading from the FSL-bus. IDLE is the starting state. It is also used as a wait-state between READ_FSL and Draw_Pixels. From this state we jump to Draw_Pixels when the VGAcontroller indicates that it is the start of a new screen. Figure 4: VGA module FSM 2.2 Software Our software runs on the Microblaze CPU as a standalone process, meaning we do not have any threads or interrupts. The software starts by initializing the AD-converter to tell it which channel to use. After that it goes in to the main loop as illustrated in [Figure 5]. The loop reads values from the AD-converter, sends those values through the FFT core via FSL and nally sends the result to the VGA module. The VGA module only reads 128 pixel values every time it is done drawing on the screen, so the waiting time in the software will be waiting for the FSL queue to empty so that it can transfer the new results. 5

3 User Manual Figure 5: Software owchart 1. Connect A/D Converter with pull-ups and DC-centering: This component is described earlier in this report. 2. Connect monitor: connect a VGA cable from the FPGA VGA port to the monitor. 3. Connect the programming and power cable to the Nexys 3 board 4. Turn on the power to the board 5. Open Digilent Adept and nd the le download.bit included in our project 6

6. Press program in the Adept interface 4 Problems A/D Converter It took us some time to get the hardware for the A/D converter to work. As mentioned previously some pullups needed to be soldered on to the IIC bus to get it to work at a high enough rate. In addition to this the PMOD AD2 converter only works on positive voltages, but the line-in source delivers voltages centered around the zero point. This was solved by soldering a DC oset on to the circuit before the A/D converter. Fast Fourier Transform At rst we intended to implement our own FFT algorithm since we could not nd any other way. This was very tedious work and in the end it took up almost all of the space of the FPGA board, the best we could get working was a 32 point FFT. Later on though we found that Xilinx Core Generator could generate an FFT core for us, and this worked very well. VGA Module The initial plan was to write the memory controller from scratch and use the RAM memory, we soon found that this approach was too slow for us. To solve this we rst tried to enable burst mode of the memory, but the problem still remained. After that we tried enabling page mode [2], this made the data stream not constant so a buer was introduced. This solved the timing problem but instead our VHDL hardware became too big to t in the FPGA. The solution was to use the BRAM instead of the RAM. The BRAM is smaller and faster, which means our timing problem was solved, unfortunately it also meant that we could not print on the full resolution of the VGA screen as we rst intended. 5 Lessons Learned This project has taught us a lot of things, for example the Xilinx toolchain and ecient workow with it. We have learned how to build an entire project with both hardware and software and how to connect them together. Developing hardware is a much slower process than developing software, it is hard to debug and having a good test bench is very important. If the whole 7

project is compiled and a bug shows up it's hard to know where it came from, so proper testing should be done on small pieces rst. 6 Contributions Most things AD-related is done by David, this includes constructing the hardware and writing the software to communicate with it. The early, self implemented, as well as the nal wrapped Fast Fourier Transformis written by Erik. The early version of the VGA Module with built in DMA (which was working in simulation but not tested or used) was written by Mattias. And this nal report is written by the group members equally. 7 Final Result The sample rate is determined by the communication frequency of the I2C bus, which is set to 800kHz, this should give a sample rate of 44.44 khz but this is not veried, the system detects 20kHz input signals indicating that it is atleast 40kHz. If the external pullups are too weak for the specied communication frequency it could lead to a lower sampling rate. The target sample rate of 44.1 khz would contain 735 sample points for every frame. The A/D converter only reads 256 samples, of the 735 avaliable, which means it might miss some information. This could be improved by using a larger FFT or repeating the process multiple times per frame, but it did not seem to be a problem. The sampling process starts when the fo buer of the last iteration is emptied, which happens when the VGA module has nished drawing a frame. The result is then put in the fo buer and the VGA module puts it into the bram when it is done with the current frame. The time requiered for this process is the time to position the VGA to begin drawing a new frame and draw a complete frame, which in our case is 25.3 ms. See a picture of the nal result in [Figure 6], unfortunately it is rather blurry because our camera is not fast enough to capture the moving image. 8

Figure 6: Final result 8 References http://www.digilentinc. com/data/products/nexys3/nexys3_rm.pdf 1. Digilent, Nexys3 Board Reference Manual, https://www.micron.com/~/media/documents/ Products/Data%20Sheet/DRAM/Mobile%20DRAM/PSRAM/16mb_burst_cr1_ 0_p23z.pdf 2. CellularRam Memory, 9