EEL 4924 Electrical Engineering Design (Senior Design) Team Baudiophile. Wireless Headphones

Similar documents
Interfacing CMA3000-D01 to an MSP430 ultra low-power microcontroller

Interfacing CMR3000-D01 to an MSP430 ultra low-power microcontroller

ECE2049: Embedded Computing in Engineering Design C Term Spring 2018

CPE 323: MSP430 Serial Communication

CPE 323 Introduction to Embedded Computer Systems: MSP430 System Architecture An Overview

Timers and Clocks CS4101 嵌入式系統概論. Prof. Chung-Ta King. Department of Computer Science National Tsing Hua University, Taiwan

University of Texas at El Paso Electrical and Computer Engineering Department. EE 3176 Laboratory for Microprocessors I.

2.996/6.971 Biomedical Devices Design Laboratory Lecture 6: Microprocessors II

CPE/EE 323 Introduction to Embedded Computer Systems Homework V

임베디드시스템기초 (# ) #11. Serial Communications 한림대학교전자공학과이선우

4 Degrees of Freedom MEMS Sensor Improvements

CPE 325: Embedded Systems Laboratory Laboratory #11 Tutorial Analog-to-Digital Converter and Digital-to-Analog Converter

MSP430. More on MSP430

ECE2049: Embedded Computing in Engineering Design C Term Spring 2018 Lecture #20: Using SPI The DAC

Design and development of embedded systems for the Internet of Things (IoT) Fabio Angeletti Fabrizio Gattuso

Embedded Systems. 3. Hardware Software Interface. Lothar Thiele. Computer Engineering and Networks Laboratory

Copyright 2015 by Stephen A. Zajac & Gregory M. Wierzba. All rights reserved..spring 2015.

GWK5Mx 2.4GHz Wireless Audio Module

// Conditions for 9600/4=2400 Baud SW UART, SMCLK = 1MHz #define Bitime_5 0x05*4 // ~ 0.5 bit length + small adjustment #define Bitime 13*4//0x0D

MSP430F149 P3.4/UTXD0 P3.5/URXD0 P1.5 P1.6 P1.7 MSP430F149 P1.0 P5.4 P5.3 P5.2 P5.1. Figure B-1. BSL Replicator Block Diagram

IV B.Tech. I Sem (R13) ECE : Embedded Systems : UNIT -4 1 UNIT 4

Network Embedded Systems Sensor Networks Fall Hardware. Marcus Chang,

Name: Clint Furrer Project Number: TI003 Project Description: Safety Walking Lights. Description:

WiFi Shield. User Guide

DEVBOARD3 DATASHEET. 10Mbits Ethernet & SD card Development Board PIC18F67J60 MICROCHIP

VLSI AppNote: VSx053 Simple DSP Board

Hands-On: Implementing an RF link with MSP430 and CC1100

ECE Microcontrollers. Serial Peripheral Interface (SPI) & NRF24 Radio

Getting Started with the MSP430 LaunchPad

Infineon C167CR microcontroller, 256 kb external. RAM and 256 kb external (Flash) EEPROM. - Small single-board computer (SBC) with an

Serial Peripheral Interface Bus SPI

Lab 1: I/O, timers, interrupts on the ez430-rf2500

Why embedded systems?

RF4431 wireless transceiver module


University of Texas at El Paso Electrical and Computer Engineering Department. EE 3176 Laboratory for Microprocessors I.

Digital Circuits Part 2 - Communication

Audio Controller i. Audio Controller

User Manual of NRF24L01 Breakout Board

Add-on box for old stereo systems. Team #40: Tong Zhao, Chutian Shao, Ziyang Liu ECE 445 Project Proposal - Spring 2017 TA: Jose Sanchez Vicarte

Texas Instruments Mixed Signal Processor Tutorial Abstract

EEL4914 Senior Final Design Report Beatbox Sensei

ZigBee Compliant Platform 2.4G RF Low Power Transceiver Module for IEEE Standard. DATA SHEET Version B

AVR XMEGA Product Line Introduction AVR XMEGA TM. Product Introduction.

@databasescaling Wednesday, 18 th April 2013

MeshConnect. Voice over

Final Report 26 April 2012

ECGR 4101/5101, Fall 2016: Lab 1 First Embedded Systems Project Learning Objectives:

GWBMA0x Bluetooth Audio module

ECE2049: Embedded Computing in Engineering Design C Term Spring 2019 Lecture #22: MSP430F5529 Operating Mode & the WDT

What is an Interrupt?

Wireless Audio Processor with Tri-Band Support and Embedded Multi-Channel USB 2.0 Audio Controller

Arduino Uno R3 INTRODUCTION

AIM: To create a project for implement a wireless communication protocol on an embedded system- ZigBee.

Introduction to Microcontroller Apps for Amateur Radio Projects Using the HamStack Platform.

CM5000 DATASHEET v0.1

Wireless Audio Module WMA-9600 WMA-9601 WMA-9602

PIC-I/O Multifunction I/O Controller

CN310 Microprocessor Systems Design

CHAPTER 1 - World of microcontrollers

Serial Peripheral Interface (SPI)

Using peripherals on the MSP430 (if time)

Freescale and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their

Stereo applications using the OutCast System

Fall. Accelerometer RGB LED control Vishal Shah Rebel Sequeira Pratiksha Patil Pranali Dhuru Chris Blackden. George Mason University

Design of a Simple 3-Lead ECG Acquisition System Based on MSP430F149

File: /media/j/texas/my msp430/g3tr/g3tr.c Pagina 1 di 5

BLE MODULE SPECIFICATIONS

Homework 9: Software Design Considerations

UART TO SPI SPECIFICATION

Project Title: Design and Implementation of IPTV System Project Supervisor: Dr. Khaled Fouad Elsayed

XMEGA Series Of AVR Processor. Presented by: Manisha Biyani ( ) Shashank Bolia (

Serial Peripheral Interface (SPI) Last updated 8/7/18

PL1167. Low Power High Performance Single Chip 2.4GHz Transceiver. Product Description: Key Features: Applications: Pin Configuration:

EE445L Fall 2010 Final Version A Page 1 of 10

MSP430 Microcontroller Basics

Product Specification

CPE 325: Embedded Systems Laboratory Laboratory #7 Tutorial MSP430 Timers, Watchdog Timer, Timers A and B

Product Specification

nblue TM BR-MUSB-LE4.0-S2A (CC2540)

Microcontrollers and Interfacing week 10 exercises

RF4432 wireless transceiver module

ECE2049 Homework #2 The MSP430 Architecture & Basic Digital IO (DUE Friday 9/8/17 at 4 pm in class)

Stereo applications using the OutCast Jr. System

Two Wire Interface (TWI) also commonly called I2C

AKG K912 Cordless Stereo 900MHz Headphone System

There are a few places where you typically encounter S/PDIF signals.

ECE 480 Team 5 Introduction to MAVRK module

BT2540 Bluetooth 4.0 BLE (CC2540) Module Users Manual

An SPI Temperature Sensor Interface with the Z8 Encore! SPI Bus

EE445L Fall 2012 Quiz 2B Page 1 of 6

UNIT IV SERIAL COMMUNICATIONS

AppNote-US2400-EVB Low Power 2.4GHz Transceiver

BT 31 Data Sheet. Amp ed RF Technology Inc.

Wireless Sensor Networks (WSN)

AN HI-3200 Avionics Data Management Engine Evaluation Board Software Guide

MOD-ZIGBEE-PIR sensor development board USER S MANUAL All boards produced by Olimex LTD are ROHS compliant

BT-22 Product Specification

Agriculture Wireless Temperature and Humidity Sensor Network Based on ZigBee Technology

ECE2049: Embedded Computing in Engineering Design C Term Spring 2018 Lecture #15: More ADC Examples

Transcription:

EEL 4924 Electrical Engineering Design (Senior Design) Final Design Report 25 April 2012 Team Baudiophile Wireless Headphones Team Members: Name: Stephen Brewer Name: Eli Chen Project Abstract Our project is a wireless headphone that utilizes a transmitter and receiver to wirelessly transmit audio signals to the user s headphones. Our system will have a transmitter unit on the audio source, and a portable, battery powered unit for the receiver where any 3.5 mm headphones may be plugged in. Wireless headphones will be useful for users who would like the freedom of moving around a room while listening to a TV or stationary mp3 player. 1

Table of Contents Project Features and Objectives...3 Cost Objective...4 Competing Product...5 Concept and Technology Selection...6 Flowcharts and Diagrams...7 Parts List...8 Separation of Work...9 Gannt Chart...10 Appendix A: Schematics...11 Appendix B: PCBs...14 Appendix C: Project Code...16 Appendix D: Equalizer Simulations...28 2

Project Features and Objectives The main objective for this project is to wirelessly and continuously transmit an audio signal to a pair of headphones. Our first objective is to establish a wireless link between our transmitter and receiver, and accurately send and receive an accurate digital data stream at at least 1.41 Mbps (uncompressed CD quality), without interference. We will use external audio A/D and D/A converters for the analog-digital conversion. Another design goal would be for the receiver to be small as well as low-power, using AA batteries. Estimated battery life of 200 hours Range of 40 yards LoS There will be several technical challenges. We would need our receiver unit to have an efficient low-power design for longer battery life and a better user experience. Another challenge would be in getting the microcontroller to process in the audio data outputted from a source and send the data in a compatible form to a transmitter at an acceptable data rate. The outcome is to have any headphones plugged into the receiver be able to clearly receive audio from the source of the transmitter, i.e. a ipod. The receiver will also include user input to change equalization and volume. 3

Cost Objective We re aiming to have the price of our wireless headphones be under $250. There are a few similar existing products available on the market that are rather expensive, so making the product with a lower price and better value is a goal that we have in mind. Unlike the existing products, which have everything built and packaged into a set of headphones, our product will be a packaged device in which the user can plug in any pair of preexisting headphones they own and start listening. Also, we are aiming to use a display for user input, where the user can change volume and equalizer settings. Similar products sold by Sony and Sennheiser currently cost between $120 and $300. 4

Competing Product, Sennheiser RS 170 Headphones, MSRP $279.95 5

Concept and Technology Selection Most of the effort went into selecting the proper transceivers that would ensure accurate transmission of audio (stereo) data. In order for to do this, several factors need to be considered. The transceivers will need to be able to continuously transmit an audio stream to be received at a receiver end. The RF transceivers we are considering operate at 2.4GHz. In order to transmit uncompressed CD quality audio, 16 bits resolution at 44.1kHz sampling frequency is needed. This means that a 1.41Mbps rate is needed at a minimum for the specifications of the transceivers (not including overhead). Another factor is to have the transceiver consume as little power as possible, since the receiver will be used in a portable application. Also, to avoid overcomplication of the wireless portion of this project, the transceivers are purchased as a wireless module that has the transceiver and antenna on a PCB already, so that RF PCB design will not be necessary. Among our considerations were the Nordic nrf24l01+, nrf24z1 and various Zigbee transceivers. Nordic transceivers nrf24z1 were chosen, which operate at 1.536 Mbps for LPCM audio in 2.4 GHz RF band. It also has a Quality of Service engine (QoS) that ensures audio quality, i.e. retransmitting lost packets. Other parts needed are ADC s and DAC s that can match the 44.1kHz sampling rate needed, 16 bit resolution, as well as having at least 2 channels to take in stereo input. Therefore, the WM8737 was chosen for the ADC, and the TLV320DAC23 was chosen for the DAC. The microcontroller chosen was an MSP430, which can control the transceivers and ADC/DAC. The digital portion functions off of 3.3V. Analog components will be needed to create an equalizer circuit. We want to be able to adjust the bass and treble independently for an optimized sound for the user. Cutoff frequencies for the 3 bands would be 100 Hz, 1kHz, and 10kHz. The analog portion functions off of 6V. A stereo headphone amplifier controls the volume. The headphone amplifier would need to be matched impedance-wise to a pair of headphones. There are 3.5mm headphone jacks both on the output of the receiver unit and the input of the transmitter unit. 6

Flowcharts and Diagrams Block diagram 7

Parts List 2x Nordic nrf24z1 module 2x TI MSP430 1x WM8717 ADC 1x TLV320DAC23 DAC 2x TLV2450 2x LM386 Estimated build cost: ~$90 8

Separation of Work Eli Interface components together (ADC to transmitter, receiver to microcontroller to DAC) Establishing a consistent wireless link between the two tranceivers Microcontroller coding (communication with peripherals) Stephen Equalizer circuit stage Headphone Amplifier and output stage Packaging Both Voltage Regulator PCB design and soldering 9

Gantt Chart 10

Appendix A: Schematics Transmitter Schematic Receiver Schematic 11

EQ Schematic 12

Headphone Amplifier Schematic Voltage Regulator Schematic 13

Appendix B: PCBs Transmitter PCB Receiver PCB 14

Equalizer PCB Headphone Amplifier PCB Voltage Regulator PCB 15

Appendix C: Project Code Flowchart Transmitter: 16

Receiver main.c (for tx) #include "main.h" unsigned char State; char slaveoutbuf[slavebufsize]; to Z1 slave char slaveinbuf[slavebufsize]; from Z1 slave to MCU // Global data buffer from MCU // Global data buffer void main(void) volatile unsigned int i; init_timer(); init_port(); init_spi(); nrf24z1_slavedisable(); wm8737_slaveenable(); wm8737_slavedisable(); //P1OUT = BIT6; //Reset slave _delay_cycles(d10ms); 17

wm8737_init(); _delay_cycles(d10ms); nrf24z1_slaveenable();//p1out &= ~BIT5; nrf24z1_slavedisable();//p1out = BIT5; // Out=0. Now with SPI signals initialized, // Out=1. reset slave delay_cycles(d200ms); // Wait for slave to initialize, 200ms nrf24z1_initrfchregisters(); //Set up address, AFH, and Frequency Hopping Table Init_ATXRegs(); //TX Initialization Init_ARXRegs(); //RX Initialization nrf24z1_write(rxmod, RXRFEN); // Enable RF on RX nrf24z1_write(txmod, MCLK12288 INTFI2S TXRFEN); //Enable RF on TX nrf24z1_forcerelink(); while(1) if(state == POWER_ON_RESET) //nrf24z1_initslaveinterface(); // Delay 200ms delay_cycles(d200ms); State = INIT_ATX; else if(state == INIT_ATX) //Configure to establish link with RX Init_ATXRegs(); Init_ARXRegs(); nrf24z1_initrfchregisters(); nrf24z1_forcerelink(); State = ESTABLISH_LINK; else if(state == ESTABLISH_LINK) //LED_STATUS = BLINK_LED1; //LED_STATUS = LED_OFF; if(nrf24z1_haslink()) // Send control data to the ARX through control channel nrf24z1_toggletxcstate(); while(nrf24z1_read(txcstate) == 0x01) Blink_LED1(); nrf24z1_togglerxcstate(); while(nrf24z1_read(rxcstate) == 0x01) 18

Blink_LED1(); nrf24z1_togglelnkcstate(); while(nrf24z1_read(lnkcstate) == 0x01) Blink_LED1(); State = LINK_ACTIVE; else State = ESTABLISH_LINK; else if(state == LINK_ACTIVE) LED_STATUS = LED2; //StatusLED2_State = LED_BLINK; if(!nrf24z1_haslink()) State = ESTABLISH_LINK; nrf24z1_haslink(); Main.c(for rx) #include "main.h" void main(void) volatile unsigned int i; //unsigned test; init_timer(); //Stop WDT, 8MHz init_port(); // Set up port pins init_spi(); //Initialize SPI, run at 1MHz nrf24z1_slavedisable(); //make sure Z1 turned off so SPI bus used only by TLV tlv320_slaveenable(); tlv320_slavedisable(); //P1OUT = BIT6; //Reset slave _delay_cycles(d10ms); 19

tlv320_init(); //Initialize TLV _delay_cycles(d10ms); nrf24z1_slaveenable();//p1out &= ~BIT5; initialized, nrf24z1_slavedisable();//p1out = BIT5; // Out=0. Now with SPI signals // Out=1. reset slave delay_cycles(d200ms); // Wait for slave to initialize, 200ms nrf24z1_initrfchregisters(); //Set up address, AFH (adaptive frequency hopping), and Frequency Hopping Table Init_ATXRegs(); //TX Initialization Init_ARXRegs(); //RX Initialization nrf24z1_write(rxmod, RXRFEN); // Enable RF on RX nrf24z1_write(txmod, MCLK12288 INTFI2S TXRFEN); //Enable RF on TX nrf24z1_forcerelink(); //force a re-link while(1) nrf24z1.c #include "msp430g2553.h" #include "nrf24z1.h" void nrf24z1_forcerelink(void) // Force relink unsigned char reg = nrf24z1_read(lnkmod); nrf24z1_write(lnkmod, reg FORCE_CONF); void nrf24z1_setaddress(unsigned char a0, unsigned char a1, unsigned char a2, unsigned char a3, unsigned char a4) nrf24z1_write(addr0, a0); nrf24z1_write(addr1, a1); nrf24z1_write(addr2, a2); nrf24z1_write(addr3, a3); nrf24z1_write(addr4, a4); void Init_ATXRegs(void) // Enable RF, MCLK = 12.288MHz, I2S, enable DD input // nrf24z1_write(txmod, MCLK12288 INTFI2S TXRFEN DDEN); // Normal I2S master, 1 clock before data with 16bits 20

nrf24z1_write(i2scnf_in, I2SMASTER); // Set audio rate to 48k (scale of 1) nrf24z1_write(txsta, TXRATE_USER TXRATE_48 SCALE_ONE); // Digital audio 16-bit PCM nrf24z1_write(txfmt, PCM16); // Full TX power nrf24z1_write(txpwr, N0DBM); // High transmit latency nrf24z1_write(txlat, LAT_HIGH); // No reset nrf24z1_write(txreso, NORESO); // No sleep timer nrf24z1_write(txlti, 0x00); nrf24z1_write(txwti, 0x00); //Development purposes, set to master since no ADC //nrf24z1_write(i2scnf_in, I2SMASTER); void Init_ARXRegs(void) // Normal I2S master nrf24z1_write(i2scnf_out, 0x00); // Full power nrf24z1_write(rxpwr, N0DBM); // No master interface on ARX nrf24z1_write(rxdcmd, ARX_NO_INTF); // No reset nrf24z1_write(rxreso, NORESO); // No sleep timer nrf24z1_write(rxlti, 0x00); nrf24z1_write(rxwti, 0x00); // ARX with Serial slave interface nrf24z1_write(rxsta, (0x00 <<6)); // Enable RF on ARX // nrf24z1_write(rxmod, RXRFEN); void nrf24z1_initrfchregisters(void) // Set address nrf24z1_setaddress(0x85, 0x34, 0xA2, 0x38, 0x92); // Setup AFH 21

nrf24z1_write(nbch, 16); nrf24z1_write(nach, 26); nrf24z1_write(nlch, 26); nrf24z1_write(lnketh, 255); nrf24z1_write(lnkwth, 255); // Setup Frequency Hopping table: nrf24z1_write(ch0, 0x06); nrf24z1_write(ch1, 0x1C); nrf24z1_write(ch2, 0x34); nrf24z1_write(ch3, 0x4C); nrf24z1_write(ch4, 0x18); nrf24z1_write(ch5, 0x30); nrf24z1_write(ch6, 0x48); nrf24z1_write(ch7, 0x14); nrf24z1_write(ch8, 0x2C); nrf24z1_write(ch9, 0x44); nrf24z1_write(ch10, 0x10); nrf24z1_write(ch11, 0x28); nrf24z1_write(ch12, 0x40); nrf24z1_write(ch13, 0x0C); nrf24z1_write(ch14, 0x24); nrf24z1_write(ch15, 0x3C); nrf24z1_write(ch16, 0x08); nrf24z1_write(ch17, 0x20); nrf24z1_write(ch18, 0x38); nrf24z1_write(ch19, 0x04); nrf24z1_write(ch20, 0x1E); nrf24z1_write(ch21, 0x36); nrf24z1_write(ch22, 0x4E); nrf24z1_write(ch23, 0x1A); nrf24z1_write(ch24, 0x32); nrf24z1_write(ch25, 0x4A); nrf24z1_write(ch26, 0x16); nrf24z1_write(ch27, 0x2E); nrf24z1_write(ch28, 0x46); nrf24z1_write(ch29, 0x12); nrf24z1_write(ch30, 0x2A); nrf24z1_write(ch31, 0x42); nrf24z1_write(ch32, 0x0E); nrf24z1_write(ch33, 0x26); nrf24z1_write(ch34, 0x3E); nrf24z1_write(ch35, 0x0A); nrf24z1_write(ch36, 0x22); nrf24z1_write(ch37, 0x3A); void nrf24z1_write(unsigned char addr, unsigned char data) nrf24z1_slaveenable(); _delay_cycles(d500); // 500us delay send_byte(addr&0x7f); _delay_cycles(d500); 22

send_byte(data); _delay_cycles(d500); nrf24z1_slavedisable(); _delay_cycles(d500); unsigned char nrf24z1_read(unsigned char addr) unsigned char value; nrf24z1_slaveenable(); _delay_cycles(d500); // 500us delay send_byte(addr 0x80); _delay_cycles(d500); // 500us delay value = send_byte(0x00); _delay_cycles(d500); // 500us delay nrf24z1_slavedisable(); _delay_cycles(d500); // 500us delay return value; unsigned char nrf24z1_haslink(void) char cnt = 4; while(cnt--!= 0) // Check for link multiple times to prevent false-positive // Nordic uses this method in their examples if((unsigned char)(nrf24z1_read(lnksta) & 0x01)!= 0x01) return 0; _delay_cycles(d500); // 500us delay return 1; TLV320.c #include "TLV320.h" void tlv320_write(uint8_t addr, uint16_t data) tlv320_slaveenable(); send_byte(((addr&0x7f)<<1) ((data & 0x100)? 0x01:0x00) ); send_byte((uint8_t)data); _delay_cycles(d10); tlv320_slavedisable(); 23

void tlv320_init(void) tlv320_write(tlv320_reset, TLV320_RESET_TRIGGER); /* tlv320_write(tlv320_left_input, TLV320_LRS_UPDATE_DISABLE TLV320_L_IN_MUTE); tlv320_write(tlv320_right_input, TLV320_RLS_UPDATE_DISABLE TLV320_R_IN_MUTE); //leave at default values LRS disabled, LIM muted */ //Power down tlv320_write(tlv320_power_down, TLV320_POWER_ON TLV320_CLOCK_OFF //ON TLV320_OSC_OFF //ON TLV320_OUTPUTS_ON TLV320_DAC_ON TLV320_LINE_INPUT_OFF); //Set sampling rate tlv320_write(tlv320_ana_audio_path, TLV320_DAC_SEL_ON TLV320_BYPASS_DISABLED); tlv320_write(tlv320_dig_audio_path, TLV320_DAC_MUTE_DISABLED //TLV320_DEEMP_DISABLED); TLV320_DEEMP_48KHZ); tlv320_write(tlv320_sample_rate, TLV320_CLKOUT_DIV1 TLV320_CLKIN_DIV1 //TLV320_SAMPLING_RATE_44KHZ TLV320_SAMPLING_RATE_48KHZ TLV320_BOSR_256FS TLV320_CLK_MODE_NORMAL); //with MCLK = 12.288MHz, 48KHZ, 0000b, BOSR = 0, CLKIN=0 FILTER TYPE 1 //I2S master tlv320_write(tlv320_audio_format, TLV320_MS_SLAVE TLV320_LR_SWAP_DISABLED TLV320_LR_PHASE_LRCIN_LOW TLV320_INPUT_WORD_32BIT TLV320_DATA_FORMAT_I2S); tlv320_write(tlv320_dig_intf, TLV320_INTERFACE_ACTIVE); //Headphone tlv320_write(tlv320_left_hp_vol, TLV320_LRS_HP_UPDATE_DISABLE TLV320_L_ZERO_CROSS_OFF 0x60); //TLV320_L_HP_VOL_0dB); tlv320_write(tlv320_right_hp_vol, TLV320_RLS_HP_UPDATE_ENABLE TLV320_R_ZERO_CROSS_OFF 0x60); //TLV320_R_HP_VOL_0dB); 24

TxMSP.c #include "MSP430G2553.h" #include "TxMSP.h" void init_timer() WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer if (CALBC1_16MHZ ==0xFF CALDCO_16MHZ == 0xFF) while(1); // If calibration constants erased // do not load, trap CPU!! BCSCTL1 = CALBC1_8MHZ; // Set DCO to 8MHz, use MCLK DCOCTL = CALDCO_8MHZ; void init_spi() UCA0CTL1 = UCSWRST; UCA0CTL0 = UCCKPH + UCMSB + UCMST + UCSYNC; // 3-pin, 8-bit SPI master, CPOL = 0, CPHA = 0/UCCKPH = 1 UCA0CTL1 = UCSSEL_2; // SMCLK UCA0BR0 = 0x08; // /8. Clock prescaler setting of the Baud rate generator. UCA0BR1 = 0; // The 16-bit value of (UCAxBR0 + UCAxBR1 256) forms the prescaler value. UCA0MCTL = 0; // No modulation UCA0CTL1 &= ~UCSWRST; // **Initialize USCI state machine** //IE2 = UCA0RXIE; // Enable USCI0 RX interrupt void init_port() P1OUT = 0x00; P1DIR = BIT0 + BIT5 + BIT6; P1SEL = BIT1 + BIT2 + BIT4; P1SEL2 = BIT1 + BIT2 + BIT4; // P1 setup for LED & reset output // LED1 + RST(SSN) + LED2 //Select pins for USI SPI //Send and receive a single byte through the SPI interface unsigned char send_byte(unsigned char txword) unsigned char in; UCA0TXBUF = txword; //send byte to transmit buffer // _delay_cycles(10); while (!(IFG2 & UCA0TXIFG)); // USCI_A0 TX buffer ready? Loop until SPI transmit done // _delay_cycles(10); in = UCA0RXBUF; //byte received in buffer stored in variable _delay_cycles(d500); //500us return in; //return byte received // Run the shift registers through MCU master SPI port to Z1 slave SPI port // DOC: Interrupts must be off during this function! void mcu_spicycle(char startadr, char endadr) 25

extern char slaveinbuf[]; slave to MCU extern char slaveoutbuf[]; to Z1 slave int n=0; // Global data buffer from Z1 // Global data buffer from MCU if (endadr - startadr < SLAVEBUFSIZE) // Assume that SPI interface can do autoinc access spi_start(); // Turn on active low chip select send_byte(startadr); // Send the start address with command bit while (startadr++ <= endadr) slaveinbuf[n] = send_byte(slaveoutbuf[n++]); // Shift register action spi_end(); // Turn off active low chip select unsigned char SPI_TransmitByte(unsigned char byte) unsigned char in; UCA0TXBUF = byte; while (!(IFG2 & UCA0TXIFG)); in = UCA0RXBUF; // delay_cycles(50); return in; // USCI_A0 TX buffer ready? WM8737.c #include "wm8737.h" void wm8737_write(uint8_t addr, uint16_t data) wm8737_slaveenable(); send_byte(((addr&0x7f)<<1) ((data & 0x100)? 0x01:0x00) ); send_byte((uint8_t)data); _delay_cycles(d10); wm8737_slavedisable(); void wm8737_init(void) wm8737_write(wm8737_reset,0); wm8737_write(wm8737_audio_format, WM8737_AUDIO_FORMAT_FORMAT_I2S WM8737_AUDIO_FORMAT_WL_32_BITS WM8737_AUDIO_FORMAT_LRP_I2S_POL_NOT_INVERTED WM8737_AUDIO_FORMAT_MS_SLAVE WM8737_AUDIO_FORMAT_SDODIS_ENABLE); wm8737_write(wm8737_left_pga, //0xFF WM8737_LEFT_PGA_LINVOL_0_DB WM8737_LEFT_PGA_LVU_LATCH); 26

wm8737_write(wm8737_right_pga, //0xFF WM8737_RIGHT_PGA_RINVOL_0_DB WM8737_RIGHT_PGA_RVU_LATCH); wm8737_write(wm8737_audio_path_l, WM8737_AUDIO_PATH_L_LINSEL_LINPUT1 WM8737_AUDIO_PATH_L_LMICBOOST_13_DB WM8737_AUDIO_PATH_L_LMBE_DISABLE WM8737_AUDIO_PATH_L_LMZC_IMMEDIATELY WM8737_AUDIO_PATH_L_LPZC_IMMEDIATELY WM8737_AUDIO_PATH_L_LZCTO_256_DIV_FS); wm8737_write(wm8737_audio_path_r, WM8737_AUDIO_PATH_R_RINSEL_RINPUT1 WM8737_AUDIO_PATH_R_RMICBOOST_13_DB WM8737_AUDIO_PATH_R_RMBE_DISABLE WM8737_AUDIO_PATH_R_RMZC_IMMEDIATELY WM8737_AUDIO_PATH_R_RPZC_IMMEDIATELY WM8737_AUDIO_PATH_R_RZCTO_256_DIV_FS); wm8737_write(wm8737_power_mgmt, WM8737_POWER_MGMT_VMID_ON WM8737_POWER_MGMT_VREF_ON WM8737_POWER_MGMT_AI_ON WM8737_POWER_MGMT_PGL_ON WM8737_POWER_MGMT_PGR_ON WM8737_POWER_MGMT_ADL_ON WM8737_POWER_MGMT_ADR_ON WM8737_POWER_MGMT_MICBIAS_OFF); wm8737_write(wm8737_alc1, WM8737_ALC1_ALCSEL_STEREO WM8737_ALC1_MAXGAIN_POS_30_DB WM8737_ALC1_NEG_18_DB); wm8737_write(wm8737_alc2, WM8737_ALC2_HLD_0_MS WM8737_ALC2_ALCZCE_DISABLE); wm8737_write(wm8737_alc3, WM8737_ALC3_ATK_8_MS WM8737_ALC3_DCY_33_MS); /*wm8737_write(wm8737_noise_gate, WM8737_NOISE_GATE_NGAT_ENABLE WM8737_NOISE_GATE_NGTH_NEG_60_DB);*/ 27

Appendix D: LT SPICE Simulations Equalizer Circuit Equalizer- High Pass Filter at Full Gain 28

Equalizer- High Pass Filter at Full Attenuation Equalizer- Band Pass Filter at Full Gain 29

Equalizer- Band Pass Filter at Full Attenuation Equalizer- Low Pass Filter at Full Gain 30

Equalizer- Low Pass Filter at Full Attenuation Equalizer- All Filters in middle setting 31

Headphone Amplifier Circuit and Simulation 32