## The Hardest Bug I Never Solved

I agreed to four hours.

Four hours to help hunt down and kill a bug. A terrible malicious bug that was eating away at this project, wreaking havoc upon the foundations of a critical feature, and draining time randomly from every one of eight firmware engineers on this project. Quite honestly, I can’t remember the last time it took more than an hour or two for me to locate, isolate, and fix a firmware bug. Surely I could help find and solve this issue within four...

## Wye Delta Tee Pi: Observations on Three-Terminal Networks

December 23, 2018

Today I’m going to talk a little bit about three-terminal linear passive networks. These generally come in two flavors, wye and delta.

Why Wye?

The town of Why, Arizona has a strange name that comes from the shape of the original road junction of Arizona State Highways 85 and 86, which was shaped like the letter Y. This is no longer the case, because the state highway department reconfigured the intersection

## The Least Interesting Circuit in the World

It does nothing, most of the time.

It cannot compute pi. It won’t oscillate. It doesn’t light up.

Often it makes other circuits stop working.

It is… the least interesting circuit in the world.

What is it?

About 25 years ago, I took a digital computer architecture course, and we were each given use of an ugly briefcase containing a bunch of solderless breadboards and a power supply and switches and LEDs — and a bunch of

## Servo Troubleshooting notes

October 4, 2018

Servo Troubleshooting

Ostendorff

Forcing a servo to rotate when off can damage it.

Malfunction:Servo makes a grinding noise or acts erratic

Probable Cause

Corrective Action

Source

Examine gears for broken teeth

Replace gears

General

Malfunction:Servo Jitters

Probable Cause

Corrective Action

Source

Dirty potentiometer

...

## Linear Feedback Shift Registers for the Uninitiated, Part XVIII: Primitive Polynomial Generation

Last time we figured out how to reverse-engineer parameters of an unknown CRC computation by providing sample inputs and analyzing the corresponding outputs. One of the things we discovered was that the polynomial $x^{16} + x^{12} + x^5 + 1$ used in the 16-bit X.25 CRC is not primitive — which just means that all the nonzero elements in the corresponding quotient ring can’t be generated by powers of $x$, and therefore the corresponding 16-bit LFSR with taps in bits 0, 5,...

## Sensors Expo - Trip Report & My Best Video Yet!

This was my first time at Sensors Expo and my second time in Silicon Valley and I must say I had a great time.

Before I share with you what I find to be, by far, my best 'highlights' video yet for a conference/trade show, let me try to entertain you with a few anecdotes from this trip.  If you are not interested by my stories or maybe don't have the extra minutes needed to read them, please feel free to skip to the end of this blog post to watch the...

## R1C1R2C2: The Two-Pole Passive RC Filter

July 28, 20181 comment

I keep running into this circuit every year or two, and need to do the same old calculations, which are kind of tiring. So I figured I’d just write up an article and then I can look it up the next time.

This is a two-pole passive RC filter. Doesn’t work as well as an LC filter or an active filter, but it is cheap. We’re going to find out a couple of things about its transfer function.

First let’s find out the transfer function of this circuit:

Not very...

## Linear Feedback Shift Registers for the Uninitiated, Part XVII: Reverse-Engineering the CRC

July 7, 20181 comment

Last time, we continued a discussion about error detection and correction by covering Reed-Solomon encoding. I was going to move on to another topic, but then there was this post on Reddit asking how to determine unknown CRC parameters:

I am seeking to reverse engineer an 8-bit CRC. I don’t know the generator code that’s used, but can lay my hands on any number of output sequences given an input sequence.

This is something I call the “unknown oracle”...

## Making a connection 1

In order for your system to control devices, you must be able to connect it to those devices.

Besides different sizes based on wire size, there are a few different styles of connectors that can be used.  There are also weather-resistant terminals that can be used if needed.

Ring

(Parks, 16)

- used for circuits that you don’t want to become easily disconnected

- ground wire attached to a stud

Push-On

- can be used on relay terminals

(Parks, 18)

- could be...

## Linear Feedback Shift Registers for the Uninitiated, Part XVI: Reed-Solomon Error Correction

June 19, 2018

Last time, we talked about error correction and detection, covering some basics like Hamming distance, CRCs, and Hamming codes. If you are new to this topic, I would strongly suggest going back to read that article before this one.

This time we are going to cover Reed-Solomon codes. (I had meant to cover this topic in Part XV, but the article was getting to be too long, so I’ve split it roughly in half.) These are one of the workhorses of error-correction, and they are used in...

## Delayed printf for real-time logging

You often debug by adding a few printfs and looking at the logs. In some real-time/low-level contexts though, you don't have time for text formatting.

You don't want prints to affect timing too much, because then timing-related bugs you're chasing might disappear. And you certainly don't want the system to stop functioning altogether because prints cause it to miss real-time deadlines.

A common alternative to prints is more "raw" logging - an event buffer, where event is a union keeping...

## Lost Secrets of the H-Bridge, Part III: Practical Issues of Inductor and Capacitor Ripple Current

We've been analyzing the ripple current in an H-bridge, both in an inductive load and the DC link capacitor. Here's a really quick recap; if you want to get into more details, go back and read part I and part II until you've got equations coming out of your ears. I promise there will be a lot less grungy math in this post. So let's get most of it out of the way:

Switches QAH and QAL are being turned on and off with pulse-width modulation (PWM), to produce an average voltage DaVdc on...

## Introduction to Microcontrollers - More On Interrupts

September 25, 2013

A Little More Detail About The Interrupt Mechanism

It's time to look a little closer at what happens in an interrupt request and response.  Again this is in general terms, and different microcontroller designs may do things somewhat differently, but the basics remain the same.  Most but not all interrupt requests are latched, which means the interrupt event sets a flag that stays set even if the interrupt event then goes away.  It is this latched flag...

## The habitat of hardware bugs

The Moscow apartment which little me called home was also home to many other creatures, from smallish cockroaches to biggish rats. But of course we rarely met them face to face. Evolution has weeded out those animals imprudent enough to crash your dinner. However, when we moved a cupboard one time, we had the pleasure to meet a few hundreds of fabulously evolved cockroaches.

In this sense, logical bugs aren't different from actual insects. You won't find...

## Two Capacitors Are Better Than One

I was looking for a good reference for some ADC-driving circuits, and ran across this diagram in Walt Jung’s Op-Amp Applications Handbook:

And I smiled to myself, because I immediately remembered a circuit I hadn’t used for years. Years! But it’s something you should file away in your bag of tricks.

Take a look at the RC-RC circuit formed by R1, R2, C1, and C2. It’s basically a stacked RC low-pass filter. The question is, why are there two capacitors?

I...

## VHDL tutorial - A practical example - part 1 - Hardware

May 18, 20111 comment

In previous posts I described some simple VHDL examples.  This time let's try something a little more complex. This is part one of a multiple part article.  This is intended to be a detailed description of one of several initial designs that I developed for a client.  This design never made it into a product, but a similar design was used and is currently being produced.  As a considerable amount of work was put into this effort, I decided to share this design...

## Byte and Switch (Part 2)

In part 1 we talked about the use of a MOSFET for a power switch. Here's a different circuit that also uses a MOSFET, this time as a switch for signals:

We have a thermistor Rth that is located somewhere in an assembly, that connects to a circuit board. This acts as a variable resistor that changes with temperature. If we use it in a voltage divider, the midpoint of the voltage divider has a voltage that depends on temperature. Resistors R3 and R4 form our reference resistance; when...

## Lazy Properties in Python Using Descriptors

November 7, 2017

This is a bit of a side tangent from my normal at-least-vaguely-embedded-related articles, but I wanted to share a moment of enlightenment I had recently about descriptors in Python. The easiest way to explain a descriptor is a way to outsource attribute lookup and modification.

Python has a bunch of “magic” methods that are hooks into various object-oriented mechanisms that let you do all sorts of ridiculously clever things. Whether or not they’re a good idea is another...

## Cortex-M Exception Handling (Part 1)

This article describes how Cortex-M processors handle interrupts and, more generally, exceptions, a concept that plays a central role in the design and implementation of most embedded systems. The main reason of discussing this topic in detail is that, in the past few years, the degree of sophistication (and complexity) of microcontrollers in handling interrupts steadily increased, bringing them on a par with general-purpose processors.

## Already 3000+ Attendees Registered for the Upcoming Embedded Online Conference

February 14, 2020

Chances are you already know, through the newsletter or banners on the Related sites, about the upcoming Embedded Online Conference.

Chances are you also already know that you have until the end of the month of February to register for free.

And chances are that you are one of the more than 3000 pro-active engineers who have already registered.

But If you are like me and have a tendency to do tomorrow what can be done today, maybe you haven't registered yet.  You may...