Technical discussions about the TI C54x DSPs (including the c5401, c5402, c5402a, c5404, c5407, c5409, c5409a, c5410, c5410a, c5416, c5420, c5421, c5441, c549, c5470 and c5471).
|
Hey guys what is going on. I am trying to implement an FIR filter and i am following one of the demos that came with the evaluation board. The only problem is that I do not get a filtered output on the speaker. I do not get anything. I have properly connected the speaker to the out jack and the microphone to the in jack. Can somebody tell me why I get no output. Or what am I doing wrong?. Here is the main code and associated files that I have. Thanks for your help. ********************************************************************** * (C) COPYRIGHT TEXAS INSTRUMENTS, INC. 1996 * ********************************************************************** * FILE NAME: highpass.asm * * * * HISTORY: This program is originally written in TMS320C5x * * * * DESCRIPTION: This is an 80 tap FIR hiph pass filter. * * The filter can be tested by using the * * random noise generator. Fcut for this filter is: * * * * Fcut = 2520*Fs/9.6k * * * * where Fs is the sampling frequency and the units * * are in Hertz. The sampling frequency, Fs can be * * programed via the ACO1init.asm program. * * * * * Last Modified: This program was last modified 8-14-96 * ********************************************************************** ; RANDOM NOISE GENERATOR ; -> A random noise generator is included in this code to allow the user ; to hear the differences in the filtered output or see them using a ; spectrum analyzer. The random noise generator can be bipassed by placing ; a semicolon ; at the leftmost column of every asm staement of the Random ; Noise Generator. ; .title "High pass filter" .mmregs .width 80 .length 55 .setsect ".text",0x1800,0 ; these assembler directives specify .setsect ".data",0x0200,1 ; the absolute addresses of different .setsect "vectors",0x0180,0 ; sections of code .sect "vectors" ; interrupt vector table resides at .copy "hp_vecs.asm" ; location 0x0180 .sect ".data" seed .word 07e6dh ; seed for random variable temp .word 0 XN .word 0,0,0,0,0,0,0,0,0,0 ; 80 data locations for 80 XN1 .word 0,0,0,0,0,0,0,0,0,0 ; stage delay line. XN2 .word 0,0,0,0,0,0,0,0,0,0 ; XN3 .word 0,0,0,0,0,0,0,0,0,0 ; XN4 .word 0,0,0,0,0,0,0,0,0,0 ; XN5 .word 0,0,0,0,0,0,0,0,0,0 ; XN6 .word 0,0,0,0,0,0,0,0,0,0 ; XN7 .word 0,0,0,0,0,0,0,0,0 ; XNLAST .word 0 ; OUTPUT .word 0 ; extra word for the bit bucket .sect".text" .copy "hp_coeff.asm" .copy "hp_ac01.asm" start: intm = 1 ; disable all interrupts dcall AC01INIT ; initialize Analog interface. DP = #0 nop pmst = #01a0h ; Interrupt pointer maps vectors to page #3 (3*128=180h) sp = #0ffah ; stack pointer located in Communications Kernal imr = #240h ; unmask TDM RINT and HPIINT(host port interface) intm = 0 ; enable all interrupts WAIT: goto WAIT ; wait for receive interrupt. receive: DP = #seed ; This sets Data Memory Page Pointer ; to page XN, which is defined ; earlier in the program. ;--------- random noise Generator (P-5cs Modulator)------------------- a = @seed << 1 a = @seed ^ a @temp = a << 2 a = @temp ^ a a = #8000h & a a = a + @seed << 16 @seed = hi(a) << 1 a = @seed << 11 a = a & #0fffch << 15 repeat(#12) a = a <<C -1 ;-------- get sample and run through lowpass filter --------- b = DRR1 ; LOAD ACCUMULATOR WITH WORD ; RECEIVED FROM AIC! @XN = A << 0 ; STORE THE VALUE OF RECEIVED ; WORD TO VARIABLE XN! AR0 = #XNLAST ; LOAD AR0 WITH ADDRESS OF LAST ; DELAY ELEMENT! A = #0 ; ZERO ACCUMULATOR A! repeat(#79) ; Repeat next instructions 80 times. macd(*AR0-,h0,A) ; Compute FIR output. @OUTPUT = hi(A) << 0 ; Store the filtered input into ; variable OUTPUT. A = @OUTPUT << 0 ; OUTPUT ==>Accumulator A A = #0FFFCh & A ; TWO LSB's MUST BE ZERO FOR AIC! DXR1 = A ; SEND TO TRANSMIT REGISTER! return_enable ; Enable interrupts and return ; from interrupt. transmit: return_enable ; Enable interrupts and return ; from interrupt. .end * (C) COPYRIGHT TEXAS INSTRUMENTS, INC. 1996 * ********************************************************************** * * * File: HP_COEFF.ASM - Filter coeffs for the highpass filter. * * * ********************************************************************** ; filter coefficients highpass @ fcut=2520hz h0 .word 0 h1 .word -22 h2 .word 4 h3 .word 25 h4 .word -9 h5 .word -32 h6 .word 18 h7 .word 40 h8 .word -32 h9 .word -49 h10 .word 53 h11 .word 56 h12 .word -81 h13 .word -60 h14 .word 118 h15 .word 58 h16 .word -164 h17 .word -46 h18 .word 219 h19 .word 20 h20 .word -218 h21 .word 25 h22 .word 350 h23 .word -93 h24 .word -423 h25 .word 190 h26 .word 497 h27 .word -327 h28 .word -569 h29 .word 516 h30 .word 638 h31 .word -784 h32 .word -699 h33 .word 1184 h34 .word 749 h35 .word -1858 h36 .word -787 h37 .word 3335 h38 .word 811 h39 .word -10376 h40 .word 15554 h41 .word -10376 h42 .word 811 h43 .word 3335 h44 .word -787 h45 .word -1858 h46 .word 749 h47 .word 1184 h48 .word 699 h49 .word 638 h50 .word 516 h51 .word -569 h52 .word -327 h53 .word 497 h54 .word 190 h55 .word -423 h56 .word -93 h57 .word 350 h58 .word 25 h59 .word -281 h60 .word 20 h61 .word 219 h62 .word -46 h63 .word -164 h64 .word 58 h65 .word 118 h66 .word -60 h67 .word -81 h68 .word 56 h69 .word 53 h70 .word -49 h71 .word -32 h72 .word 40 h73 .word 18 h74 .word -32 h75 .word -9 h76 .word 25 h77 .word 4 h78 .word -22 h79 .word 0 ;********************************************************************* ****** ; * ; File: HP_AC01.ASM -> AC01 Initialization Routine 10.Jul.96 * ; * ;********************************************************************* ****** .width 80 .length 55 .title "AC01 Initialization Program" .mmregs ********************************************************************** ***** * Certain AC01 registers can be initialized using a conditional assembly * constant. By setting the constant REGISTER to the appropriate value, the * assembler will either include initialization for certain registers or * ignore register initialization. * * The constant REGISTER should be set to include the following AC01 register: * * REGISTER (binary) = * * 0000 0000 0000 0001 -> initialize Register 1 (A Register) * 0000 0000 0000 0010 -> initialize Register 2 (B Register) * 0000 0000 0000 0100 -> initialize Register 3 (A' Register) * 0000 0000 0000 1000 -> initialize Register 4 (Amplifier Gain- Select) * 0000 0000 0001 0000 -> initialize Register 5 (Analog Configuration) * 0000 0000 0010 0000 -> initialize Register 6 (Digital Configuration) * 0000 0000 0100 0000 -> initialize Register 7 (Frame-Sync Delay) * 0000 0000 1000 0000 -> initialize Register 8 (Fram-Sync number) * * Any combination of registers can be initialized by adding the binary * number to the REGISTER constant. For example to initalize Registers 4 * and 5, REGISTER = 18h. Upon assembly, only code for register 4 & 5 * initialization is included in the AC01INIT module. When called the * module will load the REG4 and REG5 values into internal AC01 registers. * * * Register 4 is always loaded to get a 6db input gain. This sets full- scale * to 3v(p-p input) due to the single-ended AC01 configuration. * * ********************************************************************** ****** * Registers 1, 2 and 5 have been modified from the original code. The * sampling frequency is determined by the following relationship: * * Fs = Mclk/(A*B*2) * * where A and B are the lower 8 bits of registers 1 and 2 respectively and * Mclk is the master clock frequency of the Analog Interface Circuit. This * results in a sampling frequency of: * * Fs = 10M/(24h*fh*2) = 10e6/(36*15*2) = 9259 Hz * * The other change to register 5 has removed the highpass filter from the * signal path. ********************************************************************** ****** REGISTER .set 1bh ; Powerup default values: REG1 .set 112h ;* 112h REG2 .set 20fh ;* 212h REG3 .set 300h ; 300h REG4 .set 409h ;* 405h REG5 .set 503h ;* 501h REG6 .set 600h ; 600h REG7 .set 700h ; 700h REG8 .set 801h ; 801h AC01INIT: xf = 0 ; reset ac01 intm = 1 ; disable all int service routines tcr = #10h ; stop timer imr = #280h ; wakeup from idle when TDM Xmt int tspc = #0008h ; stop TDM serial port tdxr = #0h ; send 0 as first xmit word tspc = #00c8h ; reset and start TDM serial port xf = 1 ; release ac01 from reset ; --------------- Register init's ------------------------------ .eval REGISTER & 1h, SELECT ; if REG1 then include this source .if SELECT = 1h ; a = #REG1 ; load Acc A with REG1 value call REQ2 ; Call REQ2 subroutine .endif .eval REGISTER & 2h, SELECT ; if REG2 then include this source .if SELECT = 2h a = #REG2 call REQ2 .endif .eval REGISTER & 4h, SELECT ; if REG3 then include this source .if SELECT = 4h a = #REG3 call REQ2 .endif .eval REGISTER & 8h, SELECT ; if REG4 then include this source .if SELECT = 8h a = #REG4 call REQ2 .endif .eval REGISTER & 10h, SELECT ; if REG5 then include this source .if SELECT = 10h a = #REG5 call REQ2 .endif .eval REGISTER & 20h, SELECT ; if REG6 then include this source .if SELECT = 20h a = #REG6 call REQ2 .endif .eval REGISTER & 40h, SELECT ; if REG7 then include this source .if SELECT = 40h a = #REG7 call REQ2 .endif .eval REGISTER & 80h, SELECT ; if REG8 then include this source .if SELECT = 80h a = #REG8 call REQ2 .endif return REQ2 ifr = #080h ; clear flag from IFR tdxr = #03h ; request secondary when AC01 starts idle(1) ; wait for primary to xmit tdxr = a ; send register value to serial port ifr = #080h ; clear flag from IFR idle(1) ; wait for secondary to xmit tdxr = #0h ; send neutral state in case last init ifr = #080h ; clear flag from IFR idle(1) ; wait for neutral state to xmit return ; return from subroutine ; ********************************************************************** ***** ; File: HP_VECS.ASM -> Vector Table for the 'C54x DSKplus 10.Jul.96 ; ; ********************************************************************** ***** ; The vectors in this table can be configured for processing external and ; internal software interrupts. The DSKplus debugger uses four interrupt ; vectors. These are RESET, TRAP2, INT2, and HPIINT. ; * DO NOT MODIFY THESE FOUR VECTORS IF YOU PLAN TO USE THE DEBUGGER * ; ; All other vector locations are free to use. When programming always be sure ; the HPIINT bit is unmasked (IMR=200h) to allow the communications kernel and ; host PC interact. INT2 should normally be masked (IMR(bit 2) = 0) so that the ; DSP will not interrupt itself during a HINT. HINT is tied to INT2 externally. ; ; ; .title "Vector Table" .mmregs .width 80 .length 55 reset goto #80h ;00; RESET * DO NOT MODIFY IF USING DEBUGGER * nop nop nmi return_enable ;04; non-maskable external interrupt nop nop nop trap2 goto #88h ;08; trap2 * DO NOT MODIFY IF USING DEBUGGER * nop nop .space 52*16 ;0C-3F: vectors for software interrupts 18- 30 int0 return_enable ;40; external interrupt int0 nop nop nop int1 return_enable ;44; external interrupt int1 nop nop nop int2 return_enable ;48; external interrupt int2 nop nop nop tint return_enable ;4C; internal timer interrupt nop nop nop brint return_enable ;50; BSP receive interrupt nop nop nop bxint return_enable ;54; BSP transmit interrupt nop nop nop trint dgoto receive ;58; TDM receive interrupt nop nop txint return_enable ;5C; TDM transmit interrupt nop nop nop int3 return_enable ;60; external interrupt int3 nop nop nop hpiint goto #0e4h ;64; HPIint * DO NOT MODIFY IF USING DEBUGGER * nop nop .space 24*16 ;68-7F; reserved area |