Debugging noisy clock signal, part 1
Posted on Tue 27 May 2025 in MUPS16
Following on from the last investigation into the mysterious decrement bugs I decided I'd done as much debugging as I could with just my old Saleae logic analyser, and took the plunge and bought an oscilloscope. I'm surprised I've managed to get away without having one for so long.
Once that arrived, I took a look at the performance of the clock to see if I could work out why it was apparently misbehaving. I tried a whole range of tweaks, and managed to improve it to the point where it looks like it's behaving like a clock should. Note that all of these were done with the clock disconnected from the CPU.
This was the extremely unflattering view of the clock that greeted me the first time I hooked it up (quite a shock after looking at the digital traces for so long):
This really does not look like a clock should, and it was no surprise that the system was playing up. Note also that while the initial investigation was into the spike on the falling edge of the clock, this one shows a similar one on the rising edge. Still, there are enough other obvious problems with this that there were plenty of things to try. The first step was to try improving the power distribution between my power supply and the breadboards, in case that was the issue:
This made no appreciable difference. Next was to add a 1μF capacitor across the power rail. This was a major improvement:
The initial spike is gone, and the noise is significantly reduced. Note the frequency also changed significantly, which was interesting. Odd side effects of 555 timers on breadboards.
Next I added more decoupling caps, so that every breadboard had at least 4. That made no appreciable difference at all. Neither did removing the LED, just in case that was causing issues (clutching at straws a bit here). Testing out some suggestions from helpful people on Discord, I tried adding a 47Ω resistor in series with the output to smooth it out a bit:
This was a slight improvement, with the overshoot reduced (particularly on the trailing edge). At this point I tried a whole slate of tweaks with more decoupling, tinkering with the value of the smoothing resistor, etc., which resulted in only a tiny incremental improvement:
What did suddenly make a big difference in reducing the bounce was changing from using the crocodile clip for ground on my oscilloscope to a spring:
With this, the clock looks like something that's not too terrible, considering it's on breadboards. Time to hook it back up to the CPU and see if things are fixed.