LP filter using demo assembly app for SYMPHONY SOUNDBITE

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LP filter using demo assembly app for SYMPHONY SOUNDBITE

1,528 Views
carrejans
Contributor I

Hello,

 

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:

 

 

PROCESS_AUDIO:

 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 

  rts

 

 

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
0 Kudos
3 Replies

465 Views
JohnnyChen
NXP Employee
NXP Employee

You have misunderstood the structure of I/O buffer.

 

For you code, input buffer in X space should be:

 

L1,L2,L3,L4;Ls1,Ls2,Ls3,Ls4;C1,C2,C3,C4;Lb1,Lb2,Lb3,Lb4

 

Actually, it's something like below:

L0,Ls0,C0,Lb0;L2,Ls2,2C,Lb2;L3,Ls3,C3,Lb3;L4,Ls4,C4,Lb4

 

So, all r0+ or r0- should be (r0)+n0, (r0)-n0

 

Please note before return from this sub processing, r0 should keep unchanged. You can push it into stack at the begining and restore at the end of this sub routine.

 

Actually the buffer structure in this template can be updated to you desired way which can be easy understood, however you need to update rx/tx isr.

 

I attached another simple passthru code with FIR processing for 371. Please note to add AKM codec setup code into it if you want to play it with Soundbite.

Message Edited by JohnnyChen on 2009-08-07 06:07 PM
0 Kudos

465 Views
carrejans
Contributor I

Thank you for helping me out.

 

I always thought that when you put a value into a n-register; it would add it's value automaticaly when you increment it's r-register.

 

so r0+ actually means r0+4 when n0=4

 

Is my assumption wrong?

0 Kudos

465 Views
carrejans
Contributor I

I will attach the whole project here:

 

 

0 Kudos