AnsweredAssumed Answered

LP filter using demo assembly app for SYMPHONY SOUNDBITE

Question asked by Jan Carremans on Aug 4, 2009
Latest reply on Aug 8, 2009 by Jan Carremans



I'm using a Symphony Soundbite development board. (dsp56371)

I'm using the assembly sourcecode, you can find on the Freescale website.

I'm trying to make a simple Low Pass filter. (just 4th order; and only 1 left channel)

But it is not working properly. I get a very thick sine wave at the output. There seems to be some kind of LP filtering; but not that correct, I think.

I designed a LP with 4 taps using some software. Cutoff was around 2kHz, but at my scope it starts to lessen at 10kHz; to get zero around 24kHz.


So, there are 2 problems, I think. The filtering is not at correct values; and the resulting sinewave is very thick. (looks like 2 sine waves, phase shifted a little bit from each other; and then the spaces in between them are full)




I put the coefficients in my code like this (at the end of the file):



org y:$100
S_01 dc $1D0984
  ; .226853
S_02 dc $1CE104  ; .225617
S_03 dc $1CE104  ; .225617
S_04 dc $1D0984  ; .226853


Here is the code, I made in the PROCESS_AUDIO routine:




move x0,x:(r7)+ ; preserve x0 before processing
move r6,x:(r7)+   ; also preserve r6 and m6 (not necessary, I think)
move m6,x:(r7)+

move #coeff,r6 ; r6 is pointer to begin of coefficient
move #modulo,m6 ; we put the modulo on 3 (#taps-1)

clr a x:(r0)-,x0 y:(r6)+,y0 ; clear reg a; put last sample x(n) into x0; decrement r0, so it points to x(n-1)
; put first coeff h(1) of filter into y0
rep #taps-1  ; repeat next instruction 3 times (#taps-1)
mac  x0,y0,a  x:(r0)-,x0 y:(r6)+,y0
; multiply coeff with sample and keep adding
macr x0,y0,a  ; do the same mac one last time (4th time); and round
move a,x:(r0+TX_BUFF_BASE-RX_BUFF_BASE) ; put the result in the output buffer -> a = h(1)*x(n) + h(2)*x(n-1) + h(3)*x(n-2) + h(4)*x(n-3)
clr a    (r0)+   ; clear a (not necessary); increment r0, so it points to the oldest sample x(n-3)
; |-> Is incrementing of r0 necessary???; but if I leave out this code, I get even weirder result

move x:-(r7),m6  ; restore x0,r6 and m6 after processing
move x:-(r7),r6
move x:-(r7),x0




Somewhere at the beginning of the code, I put these constants:



taps equ 4         ;#taps
modulo equ 3 ;#taps-1
coeff equ y:$100 ;adress of table with filter coeff



Also, I changed the keep in the  sb_isr_esais.asm file



keep equ 4  ; 4 = current sample plus past 3 samples for each channel


If anyone could help me with this problem; I would be very thankfull.





Maybe, someone designed a filter, using the demo assembly program of Freescale?



Thank you very much.




Message Edited by carrejans on 2009-08-04 02:03 PM
Message Edited by carrejans on 2009-08-04 02:03 PM