How to debug almost anything
(but mostly hardware)
Foreword
We’re all here to learn and we all make mistakes! The nice thing about this field is that most of these are easily fixable. Just say “well I f’d that up” and move on.
You’ll even find relics of board surgery in commercial products.
In my experience ego is the largest time waster and cause of fried boards.
When to ask for help!
Pattern recognition
Show stoppers
Soft problems
Is it powered on? Is it soldered?
Milling issues
Debugging actually starts before your board is even milled especially if you’re using mods!
DRC (Design Rule Check)
Ideal vs real
How’s this look?
Blue lines are cutting passes
Red are rapids to link the passes
Ideal vs Real
What’s this look like in person?
�
Spotting issues
Back lighting and magnification tips
Continuity testing*
*sometimes multimeters lie to you especially when big caps are involved
Cold joints
Look for sharp edges
Almost always solved with heat and maybe flux/new solder
Very in depth guide to issue causation and parameter tuning
Flying probe
Orientations
ICs, FETs, Diodes, some caps, and others have a defined orientation. Always check datasheets to make sure you’ve got it in the right way. Sometimes the dot can be hard to see so I shine a light at a steep angle. When in doubt use a scope.
LEDs can be especially annoying
TI is kinda mean
Connections
Sometimes it just boils down to cable A should be going to point B or something like that
Much more prone when it gets later into the evening
TX/RX swap
For some reason in UART connections you hook TX of one device to RX of the next device and vice versa.
You speak into someone’s ears not their mouth
This is one of the few standards that operates this way. C'est la vie
Table connecting underlying issue with observed problem (cause - effect)
Flow chart?
Now, on to the fun stuff!
How do we fix some of the larger issues?
Board surgery!
Magnet wire
Pros
Cons
Red or clear insulating layer (non-solderable)
Shiny copper (solderable)
Strain relief!
Cutting traces/bridges
Did you accidentally connect vdd and vddcore?
Milling issue leave some wispy copper causing shorts?
No worries just slice it!
Just be careful to not cut other traces too
External caps/resistors
Can add smoothing, pullup/pulldown, etc.
Easter Egg
Credit- Zach Fredin for this lovable monstrosity
A suggested process
Test Equipment
Digital Multimeters
Be wary, sometimes these can lie to you generally because of big caps that you’re charging or small transistors that you’re enabling
Multimeter functions
DC Voltages
In DC voltage mode we can verify pin states or regulator outputs
Resistance
0.L short for Overload means not connected
Note the units at the bottom!
Continuity test
Super useful for finding shorts on your board and verifying joint integrity
Make sure your board is unplugged!
Need to press mode button to get buzzer on
Oscilloscopes
Decoding Serial example
Let’s say we have 2 devices and we want to send messages between them.
Flipping individual pins is fine for very small complexity projects but prone to a number of issues ( what happens if you unplug one etc)
Serial is a nice robust solution that is easy to decode (It’s just ascii!)
Idle start 0 0 0 1 0 1 1 0
This is LSB so once you have 8 bits flip the order
00010110 becomes 01101000
Consult an ascii table
So 01101000 is an h!
Now this is clunky. Is there a better way?
Decoding on a scope
Setup specifics
Match the baud rate (115200 for me)
Idle high (on TX)
Mode:uart
No parity
Order: LSB
Notes on I2C scanning
Ie my sensor is from amazon who the heck knows what its address is
#include <Wire.h> �void setup()�{� Wire.begin();� Serial.begin(9600);� while (!Serial); // wait for serial monitor� Serial.println("\nI2C Scanner");�} �void loop()�{� byte error, address;� int nDevices;� Serial.println("Scanning...");� nDevices = 0;� for(address = 1; address < 127; address++ )� {� // The i2c_scanner uses the return value of the Write.endTransmisstion to see if a device did acknowledge the address.� Wire.beginTransmission(address);� error = Wire.endTransmission();�
if (error == 0)� {� Serial.print("I2C device found at address 0x");� if (address<16)� Serial.print("0");� Serial.print(address,HEX);� Serial.println(" !");� nDevices++;� }� else if (error==4)� {� Serial.print("Unknown error at address 0x");� if (address<16)� Serial.print("0");� Serial.println(address,HEX);� } � }� if (nDevices == 0)� Serial.println("No I2C devices found\n");� else� Serial.println("done\n");� � delay(5000); // wait 5 seconds for next scan�}�
USB oscilloscope/Logic analyzer
(portable test equipment)
Bulky and hard to take with you everywhere
Analog signal processing circuit
Signal sampling/processing
Display/Control
Display/Control
Run on a laptop?
Analog signal processing circuit
Signal sampling/processing
A tiny equipment?
USB
A corner of CBA
Oscilloscope, spectrum analyzer,
signal generator, power supply,
…
A corner of CBA
Can we put all these equipments in pocket?
A corner of CBA
No (if you want the same performance).
Yes (you just need a moderate performance).
Not advertisement. Just want to let you know there are some fancy tools that can make your life easier.
Debugging workflows
Common Hardware Problems
Question | Try This First |
Is this wire connected ? | Multimeter connection check |
Is the solder bleeding ? | Multimeter dis-connection check |
Is this device connected properly ? | Check device pinout |
Is this device getting power ? | Multimeter voltage check |
Is this device sending anything back to me? / Am I sending anything to it ? | Oscilloscope |
How are these pins supposed to communicate ? | Find a working example and measure signals using Oscilloscope |
Is this device getting enough power ? | Check its output pins using Oscilloscope |
| |
Common Software Problems
Question | Try This First |
Is this code even being executed ? | In that code, try turning on the onboard LED (digitalWrite) |
Is this IF statement being executed ? | In that code, try turning on the onboard LED (digitalWrite) |
What is the value of this Variable ? | Serial.print |
What data did I just receive ? | Serial.print (if you have Serial; if not, use the onboard LED) |
Is my Arduino sending/receiving data on a pin ? | Check the pin using Oscilloscope |
Are the serial wires working ? | Check the pinout diagram, and check the pin using Oscilloscope |
| |
| |
In circuit debugging
Break points
Supported in Arduino 2.X IDE
Requires additional debugger