1 / 28

Microcomputer Systems 1 Final Project 2009

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.

ranger
Download Presentation

Microcomputer Systems 1 Final Project 2009

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Microcomputer Systems 1Final Project 2009 By Ryan Pugliesi

  2. 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. The Red is the Input Channel The Blue is the Output Channel BF533 EZ-Kit Lite

  3. 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.

  4. Initialization.c

  5. Initialization.h : EBIU and Flash Memory External Bus Interface Unit Setup (EBIU) Flash • 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;

  6. 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

  7. Initialization.h : DMA and SPORT0 DMA 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

  8. 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.

  9. Talkthrough.h

  10. 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

  11. 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

  12. 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

  13. 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

  14. Main.c

  15. 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

  16. Process_data.c

  17. 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

  18. 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.

  19. 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.

  20. 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

  21. 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.

  22. 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

  23. 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.

  24. My Program

  25. 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.

  26. 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.

  27. Demonstration

  28. END

More Related