Upload
ranger
View
59
Download
2
Embed Size (px)
DESCRIPTION
Microcomputer Systems 1 Final Project 2009. By Ryan Pugliesi. When producing audio output from the BlackFin Processor we can use three channels of stereo output. For my project, I restricted it to only using one channel. Each channel has a left and a right output signal. - PowerPoint PPT Presentation
Citation preview
MICROCOMPUTER SYSTEMS 1FINAL PROJECT 2009By Ryan Pugliesi
BF533 EZ-KIT LITEWhen producing audio output from the BlackFin Processor we can use three channels of stereo output. For my project, I restricted it to only using one channel. Each channel has a left and a right output signal.
The Red is the Input Channel The Blue is the Output Channel
BF533 EZ-KIT LITE In order to perform audio interfacing we must
make use of the AD1836 Audio Codec. Although it has two modes of operation, I only use its time-division multiplex (TDM) mode. This operates at a 48 kHz sampling rate
The SPORT (or Serial Port) is used as a data channel
The Flash IO pins are 8-bit ports. Ports A and B were used. Each Port has a set of registers known as: Direction, Data In and Data Out.
INITIALIZATION.C
INITIALIZATION.H : EBIU AND FLASH MEMORY
The initialization of the EBIU enables the asynchronous memory banks, thus allowing the processor to access the Flash A memory
First we had to set the IO pin direction bit to 1, making it function as an output*pFlashA_PortA_Dir = 0x1;
Then, we had to set the corresponding pins to the LEDs to 1, thus giving us the binary code 0011 1111 which is 3f in hex. This allows us to use LED 4
though 9*pFlashA_PortB_Dir = 0x3f;
External Bus Interface Unit Setup (EBIU) Flash
INITIALIZATION.H : AUDIO CODEC AND THE ENABLING OF THE DMA AND SPORT0 Audio Codec
It will compress and decompress digital audio software for implementation while retaining the quality of the sound
Initialization of the AD1836 It first resets both the Analog to Digital Converter (ADC) and
the Digital to Analog Converter (DAC) It sets up, configures, and enables the Serial Peripheral
Interface (SPI) port as the master as well as configures and enables the Direct Memory Access (DMA).
Then it waits until the DMA transfers are finished before disables itself
Enable_DMA_SPORT0 It enables the DMA As well as, setting up the Serial Port 0 for the transmitting and
receiving of data
INITIALIZATION.H : DMA AND SPORT0
Init_DMA Sets DMA1 to receive
data from SPORT0 RX While DMA2 transmits
the data to SPORT0
Init_SPORT0 Sets up receive and
transmit configuration
DMA SPORT0
INITIALIZATION.H : INTERRUPTS AND FLAGS An interrupt is when the processor is running
and an outside event causes the program’s synchronous instruction flow to change. The Event Controller manages these activities by employing a two-level control mechanism. The System Interrupt Controller (SIC) is used for
mapping for the interrupt sources to the Core Event Controller (CEC), which then prioritizes each event
Programmable Flags are set up to be used as these interrupts. So if a button is pressed the program will know exactly what to do.
TALKTHROUGH.H
TALKTHROUGH.H This is the program’s header file, which is
comprised of many different define and include statements, the initialization of many global variables, and several function prototypes that allow us to use the functions, later implemented in the code
TALKTHROUGH.H : DEFINE CONSTANTS The define constants include:
Pointers to specific registers that configure Data Out and Direction for the registers for FlashA, Port A and B memory.
Constants used to modify registers that configure the codec for the Analog to Digital and the Digital to Analog Converter.
A few statements that modify the controls for the ADC/DAC codec, SPI, SPORT0, and DMA
TALKTHROUGH.H : GLOBAL VARIABLES These variables were used through out the
code so it was vital to initialize them in the header file as external integers. They included: Places to store the channel10 left and right input
and output data Buffer arrays to hold the newly received and
soon to be transmitted data Counters for the push buttons and other
functions throughout the code
TALKTHROUGH.H : FUNCTION PROTOTYPES It allows the program to use:
The initialization functions described earlier The functions that determine if an interrupt
occurs. (found within the file, ISR.c) The functions that actually perform operations
based on each specific interrupt
MAIN.C
MAIN.C After initializing several global variables and
configuring the Codec AD1836 with its array of registers, the main function begins. Within this function: It initializes the System Configuration Register All the function from the file, Initialization.c, are
called A while-loop that continues until the program is
halted or reset
PROCESS_DATA.C
PROCESS_DATA ( ) It connects the input, iChannel0LeftIn and
iChannel0RightIn, to output, iChannel0LeftOut and iChannel0RightOut, as well as, store the input in two other channels, Left and Right, that can be later used in the code to output the original unmodified input data
LOW AND HIGH PASS FILTERS In my code I used two Finite Impulse
Response (FIR) filters. The first is a low pass filter that allows us to hear
only the low frequencies sometimes called the bass.
The second was a high pass filter that allowed us to hear the high frequencies which can be referred to as the treble.
LOW AND HIGH PASS FILTERS CONTINUED Using the “fdatool” found in MATLAB, we are able
to create low pass and high pass filters. We can view the graphs and change the variables in order to produce different variations of the same type of filter. The generated code gives us the filter coefficients
which we will use in the implementation of our program. I chose have these values be put into an array with data type “short”. Both the left and right inputs of Channel0 are put into new
variables of the array with data type “short”. The input data is originally 24 bits long and that is why we used integers to store the data. This is made possible by having it bitwise shift 8 to the right because the “short” data type has only 16 bits, so it is necessary to do this or the audio output will get plenty of feedback because of the loss of data.
LOW AND HIGH PASS FILTERS CONTINUED The code has two sets of indexes
one to index the position in the arrays one to be used in a for-loop.
Within the for-loops lies the implementation of the filters.
x is the input signal y is the output signal h are the filter coefficients k is the number of filter coefficients
LOW AND HIGH PASS FILTERS CONTINUED Every time LowPassFilter( ) or
HighPassFilter( ) is called, it takes the input, discussed previously, and stores it into a new array which is called the delay. It then clears the summation variables and loops over both the coefficients and the input delays, accumulating a value by multiplying the coefficients by the delay samples . It then sets this value to be the output.
LIGHTS ( ) The Lights function is used as a major part of this
code. The program is written so that it would check the iChannel0LeftOut. If the sound intensity is higher or lower than the given bounds, then certain lights will turn on. The higher the intensity, the more lights will go on, starting from LED4 to LED9.
The by adjusting the value of the pointer, “*pFlashA_PortB_Data”, is how we can change the order of the lights. It is changed by adjusting the combination of ones and zeroes for the in the binary code then converting it back to Hex. The red zeroes are not used. While the output of LED4 is controlled by the right-most bit. LED 5 is the to the left of that, and so on and so forth. 0000 0000 -> 0x00
VOLUME( ) This function is a simple volume controller.
When the programmable flag PF11 is pressed a global variable is incremented by 1. This variable is called the Volume_counter. It is initialized to be 3 in the main.c file so the volume starts off at a moderate level. When this function gets called it takes the input data, before it runs through the program, and multiplies it by this counter. The counter goes up to 5 before it is reset to a
value of 1.
MY PROGRAM
MY PROGRAM Originally upon building the code, LED4 through
9 will display just the intensity of the outputted audio data. The louder the music, the more lights will turn on. (from left to right) : this is the default setting. When the programmable flag PF8 is pushed once,
the LEDs will display the intensity of the bass of the audio output while continually playing the unfiltered sound. If pressed again, the program will refer to its default setting.
When PF9 is pushed once, the LEDs will display the intensity of the treble of the audio output while continually playing the unfiltered sound. If pressed again, the program will again return to its default setting.
MY PROGRAM CONTINUED If PF10 is pressed once, then the speakers will
play the bass output as well as the LEDs displaying the intensity the filtered output. If pressed again, the speakers will play the treble output and also display the intensity using the LEDs. However, if pressed a third time, the program will again go back to the default setting.
As described before when PF11 is pressed a global variable is incremented by 1. This variable is called the Volume_counter. It is initialized to be 3 so the volume starts off at a moderate level. The input data multiplied by this counter therefore increasing the volume. The maximum value the counter can reach is 5 and it is reset to 1 when it try to go to 6.
DEMONSTRATION
END