Electronics for Newbies: Tying up loose ends

The 'tying up loose ends' is not to say I'm nearly finished. More that in order to make progress I had to fix some bugs where I'd not paid attention to detail.

First, I wired up the data buses to my SIO and the buffers/latches that I'll use to drive an SD Card interface, hoping to incrementally wire them in to everything else. The machine then stopped working. I could tell something was nastily amiss as the current consumption had gone up non-trivially, and I was a bit worried I'd burnt something out.

Once I wired the chips up to power and hardwired their 'chip select' lines to disable them, everything started working. Phew. No need to unsolder and replace major components (all the more worrying given the rat's-nest of my construction).

My assumption that the I/O lines of unpowered chips were effectively disconnected was, well, pretty darn wrong. My mental model had the I/O lines, well, 'go hi-Z' in that case, I think I assumed that an unpowered output stage would not do anything, but even a simple CMOS model could have the output transistors acting as pass transistors to the power rails, which would then allow cross-talk between the bits. For I/O circuitry of realistic complexity, with all that anti-latch-up and anti-static protection, I'm sure all kinds of interesting things could happen.

Once the system was working again, I tested the interrupt part of the CTC (timer) circuitry, which I previously hadn't exercised. The interrupt only triggered once. What I'd failed to do is re-enable the interrupt during the interrupt handler. While the system support prioritised interrupts, you do need to re-enable the maskable interrupt explicitly, it seems.

My test code displayed the contents of a memory location, which was updated by a timer interrupt. Except, it flickered weirdly all over the place. Turns out I'd failed to make my 'display contents of memory location on LEDs' code update the display fast enough, so I was getting a certain amount of aliasing of the actual updates. I switched to a loop continually reading the variable, and the output now looks lovely.

So, everything's working nicely as I pay attention to the details. Making these mistakes wasn't great of me, but it fortunately wasn't too hard to debug. Next up, getting that serial I/O working.

Posted 2013-11-14.