# Re: Re: iir filter implementation

Looks like a homework problem. Learning how to debug is really

something important to understand. The first question you _always_

ask of any electronic problem is: "Is it plugged in?" In this case, you

are looking at power supplies, but even those have a source of power.

Another way to look at that question is to ask "Are the source voltages

good?" When you have multiple power supplies, you need to make sure all

of them are at spec.

After you have good power, you then check the major components. In the

case of the charging circuit, you have a clue that it is too hot. What

does that mean? P = I*V, so either there is too much current or too much

voltage. Why would there be too much current? Look at a typical Li-ion

charging circuit and think about the current flow in each part of the

circuit - and what would happen if someone dropped a screwdriver across a

couple of pins.

How does a buck converter work? How is efficiency measured? Once you can

think about what is going on, you can think about how to change it.

Patience, persistence, truth,

Dr. mike

On Thu, 10 Jan 2013, Willer Justinvil wrote:

> Happy New Year to all!

Dear all, I have two questions that I need to answer it's related to Li-Ion battery charging circuit and Buck converter power supply. I have some ideas, but I thought maybe the group might have suggestions. Here are the questions any suggestion would be greatky appreciated.

1. A Li-Ion battery charging circuit on a design you are

testing is turning on and off unexpectedly. You notice the charging

circuit is getting hot to touch. Describe how you would go about

diagnosing this circuit and what incremental steps you would take in

checking the design.

2. You are testing a buck converter switching power supply on a

microcontroller-based circuit board, and you are observing an efficiency

of ~ 80%. Describe some ways you can improve the efficiency of the circuit.

Thanks,

WJ

________________________________

From: Mike Rosing

To: Amit Kumar Verma

Cc: Kuppala Sridhar ; "a..."

Sent: Thursday, April 26, 2012 12:45 PM

Subject: Re: [adsp] Re: iir filter implementation

You can use the view->debug windows->image viewer to see the data from a

2d array directly. You can only process one memory location at a time,

but you can do a 2D array easily.

Patience, persistence, truth,

Dr. mike

On Thu, 26 Apr 2012, Amit Kumar Verma wrote:

> Dear friends,

>

> Kindly let me know whether it is possible to process 2-D arrays directly ( I mean without converting the data to 1-D variables) in visual DSP directly.

>

> Also kindly let me know how to go about plotting 2-d data in visual dsp.

>

> eagerly waiting for your reply.

>

> regards.

>

> amit

>

> ________________________________

> From: Kuppala Sridhar

> To: mailto:adsp%40yahoogroups.com

> Sent: Saturday, 24 March 2007 2:19 AM

> Subject: Re: [adsp] Re: iir filter implementation

> hello Bernhard,

> as per ur suggestions, i have made changes with respect to the sign change of the filter coefficients. But even then my frequency response is not proper.please see the code below whether any bug is there.

>

> #define FRAMESIZE 1 /* stereo */

> #define SECTIONS 1 /* Number of second-order sections (biquads) */

> /* Each channel will be filtered by SECTIONS biquads */

> /*********** ********* ********* ********* ********* ********* ********* ******/

> .section /dm seg_dmda;

>

> .var inbuf[FRAMESIZE] ; /* All of the channels in each frame are processed */

> /* when

> the last channel arrives and the */

>

> .var outbuf[FRAMESIZE] ; /* double-buffering feeds the SPORT as needed */

> /* tag data to check if ever assigned a value */

>

> .var delaybuf[SECTIONS* 4]; /* Holds intermediate variables (state) for the */

> /* IIR. Each of the two compute units needs */

> /* storage for w[x-1] and w[x-2] for

> each */

> /* biquad section. */

>

> /*********** ********* ********* ********* ********* ********* ********* ******/

> .section /pm seg_pmda;

>

> /* Coefficients are ordered a2,a1,b2,b1 and coefficients for PEx are */

> /* immediately followed by those for PEy. Repeat the sequence for each */

> /* successive cascaded biquad

> pair. */

>

> .var coefficients[ SECTIONS* 8] > {

> 1.341081473676422 , - 0.571654398453466,

> 1.994354460540368 , 0.999999999999998 ,

> };

>

> /*********** ********* ********* ********* ********* ********* ********* ******/

> .section /pm seg_pmco;

> _initializeAlgorith mDataStructures:

>

> m1=1; /* modifiers=2 for SIMD reads & writes */

> m2=1;

> m8=1;

>

> /* Not using circular addressing with any of the pointers, so */

> /* we must ensure that it is disabled by setting length = 0

> */

>

> l3=0; /* i3 points to inbuf */

> l4=0; /* i4 points to outbuf */

>

> /* i0 and i1 are pointer into delaybuf */

> /* and track w[n-1] and w[n-2] */

>

> l0=4; /* w[n-1], w[n-2] for PEx, PEy */

> l1=0;

>

> l8=0; /* i8 points to the coefficient buffer */

>

> /* zero the delay line */

>

> r0=SECTIONS;

> b0aybuf;

> f2=0;

>

> lcntr=r0, do clear until

> lce; /* for each section, do: */

> dm(i0,m2) /* clear w[n-1] and w[n-2] */

> clear: dm(i0,m2)

>

> rts;

>

> _initializeAlgorith mDataStructures. end:

> cascaded_biquad:

> bit set mode1 CBUFEN;// // Enable SIMD mode

> b0 = delaybuf;

> b1 = b0;

> b3 = inbuf;

> b4 = outbuf;

> b9 = coefficients;

> r0 = SECTIONS;

>

>

> f8=dm(i3,m1) ; // read inbuf

> r12=r12 xor r12, f2=dm(i0,m1) , f4=pm(i8,m8) ;

> lcntr=r0, do quads until lce;

> f12f4, f8f12, f3=dm(i0,m1) , f4=pm(i8,m8) ;

> f12f4, f8f12, dm(i1,m1) f4=pm(i8,m8) ;

> f12f4, f8f12, f2=dm(i0,m1) ,

> f4=pm(i8,m8) ;

> quads: f12f4, f8f12, dm(i1,m1) f4=pm(i8,m8) ;

> f8f12;

> rts (db);

> dm(i4,m1)

> bit clr mode1 CBUFEN ;// // disable SIMD mode

>

> _Cascaded_IIR_ Filter_SIMD. end:

>

> Holzmayer.Bernhard@ Foerstergroup. de wrote:

> hai mike,

>>> thanks for u

> r reply.

>>> i have also implemented with single biquad but this is not responding the way the frquency response in the matlab was.

>>

>> Hello Kuppala,

>>

>> here are some additional hints, which might be helpful or not:

>>

>> 1) be aware that Matlab specifies the coefficient differently from how it is usually done in books or code libraries. Usually they differ in sign.

>> Check the algorithm thoroughly.

>>

>> If you select coefficients with easy numbers like 0.0 0.5 or 1.0 where appropriate, you can calculate the biquad manually and check if you get the same results.

>>

>> 2) Depending on the cut-off frequency and the sampling frequency, you might run into wrongly calculated coefficients (precision issue).

>> For one biquad and a low-pass filter stage, keeping the relation

>> Fc/Fs > 0.001 should be safe.

>> Check the coefficients. Be cautious, if the values are very close to 0.0 or 1.0 or -1.0

>>

>> 3) Check what your compiler does. If

> it calculates the biquad based on 16 bit wide values, the algorithm will fail or at least provide a distorted result. Even 32bit wide values might be unsufficient, depending on type and algorithm.

>> Keep in mind, that IIR filters do infinite recursions on the calculated values. This means, that errors might increase at every cycle.

>> If you can watch the algorithm in a debugger, look for sign changes (values around zero) and maybe saturation or rollover effects at the border of the value range (>=1.0, <=-1,0 ).

>>

>> Good luck.

>> Bernhard

>>

>> ________________________________

> Here’s a new way to find what you're looking for - Yahoo! Answers