Search This Blog

Showing posts with label debug. Show all posts
Showing posts with label debug. Show all posts

Saturday, 15 June 2013

The Catches – Microcontroller Embedded I2C Module: My First Encounter with Errata-sheet

 
When I first started doing design works, there was this particular project that required me to communicate through I2C. It was my virgin experience using Microcontroller with embedded I2C engine– and it did not works well – errors occur intermittently – I spent 2 week checked and rechecked my codes, bus waveforms – start , stop, acknowledge conditions – every single thing that I could think of…

There was so much frustration, finally I told myself that enough is enough and there must be something else going wrong instead of my code – and Google long enough – I found out that there’s something called “Errata sheet”. And true enough – looking for the errata of that silicon revision on manufacturer’s website it showed that there was a bug in the silicon – and it proposed some work-around, plugged the workaround in and everything works accordingly Smile

Lesson learnt –
Before choosing a controller or similar devices – always read the errata (if it has one) for the stuffs that related to you, and newly released devices might be more happening that you would expect!



Monday, 3 June 2013

The Catches: Safety Valve of Electrolytic Capacitor

Whether one believes in luck or not, for me there is no deniable that at times luck play a crucial part in life.

I remember my lucky escape from getting injured dealing with a boost converter with electrolytic capacitor. It was a brand new design – a boost that generate 100V. Something was not right – it could not go up to 100V – so I was having this board vised up ( to see what a “vise” is, go to http://en.wikipedia.org/wiki/Vise) is  to ease probing on each side – with those cap facing me (bad bad choice).

While I my face was inches away from the board – one of the cap exploded and shooting up hot boiling oily substance right pass me, hitting my cubicle wall about 1 meter way – it turns out that wrong part was installed – it was a 48V part.

It could at best cause some burnt on my not so handsome face – or at worst blinded me… come to think about that – I was simply lucky enough to escape un-injured and extremely thankful. To show you what i meant, i managed to find just a similar end result from wiki (http://en.wikipedia.org/wiki/Electrolytic_capacitor) as shown below:
image
Lesson learnt – those weak points being built on top of the capacitor can is the “safety valve” – it is designed to open up (“explode”) under overheat – overvoltage condition – never ever face the valve toward you or anybody else.





Sunday, 26 May 2013

The Catches: Voltage follower that rings

In my first year doing circuit design – I was evaluating a circuit that contains a voltage follower op-amp – something that I didn’t quite happy with is the amount of overshoot on the step input. Digging through all the information – I found out that not op-amp are suitable for being a voltage follower. And in fact – for a voltage feedback op-amp to be used as voltage follower – it will state “unity gain stable” in the datasheet.
image
 
image
 
Lesson learnt –
There are certain amp that are not meant to be unity gain stable – mainly for fast response – read the datasheet before using them.





Wednesday, 22 May 2013

The Catches: Boost Converter that don’t last

This happen about second year i started hands-on design – it was a 100V boost converter – most of the time the prototype works well – but every once a while – it stop working  after a large “blak” sound.

So tracing back on the switching waveforms – voltage, current I deduced that the inductance was not right – VL = L * (di/dt) relationship does not hold – drop in another piece – and it start working again.

Being curious as I am (luckily), I check the resistance of the inductor and compared to the new part (did not have LCR meter on hand). The resistance is much lower lower than the number stated in datasheet.

As the failure made me very un-comfortable – I went Google around – and it turns out that inductor does have voltage rating (although not mentioned in the datasheet of the one I was using), so the design was flawed in the first case – luckily it was found out earlier than later (it pays for being curious), else can’t even imagine what it would do in the field. Changing the part to high voltage part – and it work out solid!

For more details, refer to previous post: http://electroniccircuitdesignsharing.blogspot.com/2012/12/inductor-voltage-rating.html

Lesson –
Inductor does have voltage rating – due to the insulation coating of the windings, and the way wires being wound – and the inductor intended for high voltage operation will have working voltage stated in the datasheet – else don’t use it at high voltages.

Always look for the root-cause – it will save your ass






Saturday, 20 April 2013

About Debugging Guidelines

In debugging – sometimes I got carried away with my “instinct”, although mostly it get me to the right conclusion in a short time – it is definitely too much of “black magic” to the newbies.
So my humble advice to the beginners is to think about every circuit or IC as a functional block – define the boundary yourself or from a schematic – make sense of the circuit does. To state the obvious, in a typical circuit block:
  • will have a function name in the schematic - this contains important info regarding what the block supposed to do
  • will generally has input, output, supply and control signals
identify which is which will generally give you a sense of how to debug the block
clip_image002
Once you know that the input/output relationship does not hold (assuming that you understand what the block supposed to do), here are some of the steps that might helps
  1. Bias the circuit so that the block will have known state (or consider overwrite the input from a known source), use DMM to confirm all the DC pins, starting with supplies pins.
  2. Confirm the input output relationship – if it is not correct, break this block into smaller block and repeat the process (take a look at binary search debugging post: http://electroniccircuitdesignsharing.blogspot.com/2013/02/debugbinary-search.html).
  3. If the block is already an IC, check for part number, orientation, cold solder join, missing solder joints before “accusing” it as faulty part.
  4. remember that sometimes certain failure mode needs more than a DMM to be used (see http://electroniccircuitdesignsharing.blogspot.com/2012/06/why-oscilloscope-is-needed-for-circuit.html) , so if DMM cannot give you convergence, you should consider to use another instrument (depending on what this block supposed to do).
so good luck with your troubleshooting!




Saturday, 16 February 2013

Debug–Binary Search

Sometimes, debugging of complicated circuits is an unavoidable task. To ease this process, some concept about binary search will proves to be helpful.
The idea about debugging using binary search as follow:
  • For a know series of circuit block that give un-expected result - always try to determine which half the the series that cause the problem
  • Repeat the iteration till faulty block found
For example:
In the diagram shown below, let x be the input, and output of each block be yn, where n is the block number, and block 15 coloured in red is the faulty block.
image
start: y16/x is not expected
  1. confirm y8/x is expected or not
  2. since y8/x is expected, we know the faulty block should be some where from block 9 to block 16, evaluate y12/y8
  3. since y12/y8 is working, faulty block should be some where from block 13 to block 16, evaluate block y14/y12
  4. y14/y12 is still working, faulty block should be some where from block 15 to block 16
thus regardless of where the faulty block is, the search terminate fast. In this example, if you were to use linear search method by evaluating from block #1 , block #2… , it will take you more time.

Sunday, 3 February 2013

Debug – Inverting Op Amp

image
Let’s say you measured Vin = –1V, but Vout way off +1V, now what can be wrong? How do you debug it? Below are some suggestions for you to consider:
  • check the supply to see if the supplies are correct
  • visual inspect for
    • wrong polarity
    • wrong part (if manual assembly involved)
    • missing solder or “cold” solder
  • check if wrong resistors being loaded - power down – measure resistance of R1, R2 to see if any of R1, R2 is larger than 1KOhm – since this is in-circuit measurement – we don’t expect to see 1KOhm, but we definitely expect 1KOhm or less, since parallel resistance of any resistors is the minimum of those.
  • check if oscillation occurs - if everything looks good – get hold of a scope and confirmed there’s no oscillation on either pins mentioned above
  • check if op-amp already sourcing too much current - lift output pin, insert a small resistance resistor from pin to pad, measure the voltage drop to see if the amp is sourcing or sinking more that datasheet stated. It is possible that the next stage is demanding more current than expected.
So good luck with your troubleshooting Smile

Saturday, 12 January 2013

Wolverine versus Real Life Capacitor

If you watch X-Men comics or movies, you know that Wolverine self heals, its his power. Believe it or not, some real life capacitor types also selfheal (if the damage is not too serious) – now is that amazing or what?
read more about this fantastic characteristic on links below:
http://en.wikipedia.org/wiki/Types_of_capacitor
http://www.ehow.com/list_7686462_self-healing-properties-capacitors.html
Marvelwolverine.jpg
picture from http://en.wikipedia.org/wiki/Wolverine_(comics)

Saturday, 29 December 2012

Inductor Voltage Rating

Have you ever wonder that when you read through datasheet for inductors, you rarely see the voltage rating?
Shown in picture below are some common inductors seen.
image
The fact is, inductor does have voltage rating, the winding wire have a fix thickness of insulation coating, if high enough voltage is applied across the inductor, although momentary and the current is within the specification limit, the insulation will breakdown and short to adjacent wire. From personal experience, normally inductor voltage is about 60V, unless specifically stated in datasheet. Maximum voltage allowed is usually depends on insulation thickness of wire used, and whether the windings overlap.
If you does wonder whether your inductor has insulation breakdown, the easiest way is to measure DC resistance, depending of actual short, the resistance will be a lot or somewhat lower than a good one. Alternately, if you have a LCR meter, you can use it to measure the inductance instead, in this case, expect faulty inductor to have lower inductance (less winding over the magnetic core).



Friday, 6 July 2012

Debug - Op amp virtual ground probing with DMM

Watch out when probing op amp virtual ground, as the DMM loading will modify the feedback element of the inverting op amp. See http://electroniccircuitdesignsharing.blogspot.com/2012/05/feedback-loop-element-identification.html on how to identify the feedback element of inverting op amp.

Saturday, 16 June 2012

Why oscilloscope is needed for circuit debugging

As handy as a DMM can be, unfortunately it cannot shows you circuit oscillation. DMM has a very slow response, for example, if the circuit shown below oscillate at frequency above 1kHz or more, DMM will just give the average reading, in this case -1V. Since you are expecting -1V, you would think that the circuit is all fine. But the oscillation will give faulty result to other stages. And at times like these, you will make the wrong conclusion and spend days on debugging.



Friday, 8 June 2012

Debug - DMM loading

DMM are not ideal ( ideal cases rarely happen in real life :) )

Friday, 4 May 2012

Debugging - In Circuit R measurement

Shown below are the points for consideration when measuring resistance on board (no power applied). As it can be seen, the conclusion is that when you measured some resistance higher than expected, then mostly the resistor has the wrong value. And most of the time we can only compare the value to a known good board.