Debugging software with an oscilloscope
Today, for the first time, I debugged software with an oscilloscope. Takes a bit more thinking through than printf()…
Smart people start playing with microcontrollers using something like Arduino where they have a serial connection, then scale it down after it works. Not me. I started with an ATtiny85 with 8 pins, put a two channel scope on it, and started reasoning from the waveforms I saw. Fortunately, I had debugged the surrounding circuit without the CPU in it already so that I could concentrate on the microprogram.
So rewarding when I got it working right!
Would have been even more rewarding if I hadn’t then made a stupid mistake transferring the circuit from the breadboard to perfboard. :-)
John Pitney May 31, 2014 20:07
When I started playing with microcontrollers, the only scope I had was a Tek 465, which isn’t much good for debugging. I picked up an Open Bench Logic Sniffer, and things got better.
Michael K Johnson May 31, 2014 20:13
Right now I have a borrowed DSO - thanks +Adam Chasen for the loan while I decide what I want to buy… Trying to decide how serious I want to be about this. Proper bench power supply, function generator, logic analyzer, scope; starting to look like this could really start to add up after a while. :-)
John Pitney May 31, 2014 20:17
Add up for sure! Dev Board Disease can be hard to cure.
Curtis Olson May 31, 2014 21:55
A while ago I bought a poscope4 (cheap usb scope that uses a windows app as it’s display.) Fortunately I have XP running in a virtual machine. The poscope doesn’t support super high data rates, but for many things it does the trick well enough. It’s certainly fast enough to watch servo PWM pulses and see serial io traffic going by (although probably not quite quick enough to reliably pick out bits at fast data rates.) I one time wrote a super simple auto/manual autopilot switching app for a little atiny … maybe a dozen lines of code, but each of those was hard fought because the processor was already installed on the board with minimal ins/outs so I had to get pretty creative to debug and test what was going on. Hardware sure is fun when it works, but also can sure be frustrating when it doesn’t (and I’m usually not smart enough with hardware to troubleshoot very deep into the design.)
Michael K Johnson May 31, 2014 22:13
I’m looking at an Owon scope since it has ethernet and VGA out and I’ve seen some good reviews. Seems to be a generation ahead of other relatively inexpensive scopes for the same price point.
Brian Lane May 31, 2014 23:10
A DSO? That’s cheating ;)
Richard Hughes June 01, 2014 04:54
+Michael K Johnson I can recommend the Owon scopes; never used the Ethernet but the spec\price ratio is very good.
Michael K Johnson June 01, 2014 17:37
+John Pitney the Open Bench Logic Sniffer looks interesting. It wouldn’t have worked for this project since I was watching 15V signals, but it’s on my list of interesting toys now. And Bus Pirate, for that matter. ☺
John Pitney June 01, 2014 19:00
15V would fry an OBLS for sure.
Imported from Google+ — content and formatting may not be reliable