Help, My Serial Data Has Been Framed: How To Handle Packets When All You Have Are Streams
Today we're going to talk about data framing and something called COBS, which will make your life easier the next time you use serial communications on an embedded system -- but first, here's a quiz:
Quick Diversion, Part I: Which of the following is the toughest area of electrical engineering? analog circuit design digital circuit design power electronics communications radiofrequency (RF) circuit design electromagnetic...10 Circuit Components You Should Know
Chefs have their miscellaneous ingredients, like condensed milk, cream of tartar, and xanthan gum. As engineers, we too have quite our pick of circuits, and a good circuit designer should know what's out there. Not just the bread and butter ingredients like resistors, capacitors, op-amps, and comparators, but the miscellaneous "gadget" components as well.
Here are ten circuit components you may not have heard of, but which are occasionally quite useful.
1. Multifunction gate (
Analog-to-Digital Confusion: Pitfalls of Driving an ADC
Imagine the following scenario:You're a successful engineer (sounds nice, doesn't it!) working on a project with three or four circuit boards. More than even you can handle, so you give one of them over to your coworker Wayne to design. Wayne graduated two years ago from college. He's smart, he's a quick learner, and he's really fast at designing schematics and laying out circuit boards. It's just that sometimes he takes some shortcuts... but in this case the circuit board is just something...
Modulation Alternatives for the Software Engineer
Before I get to talking about modulation, here's a brief diversion.
A long time ago -- 1993, to be precise -- I took my first course on digital electronics and processors. In that class, we had to buy a copy of the TTL Data Book* from Texas Instruments.
If you have any experience in digital logic design you probably know that TTL stands for Transistor-transistor logic (thereby making the phrase "TTL Logic" an example of RAS...
Complexity in Consumer Electronics Considered Harmful
I recently returned from a visit to my grandmother, who lives in an assisted living community, and got to observe both her and my frustration first-hand with a new TV. This was a Vizio flatscreen TV that was fairly easy to set up, and the picture quality was good. But here's what the remote control looks like:
You will note:
- the small lettering (the number buttons are just under 1/4 inch in diameter)
- a typeface chosen for marketing purposes (matching Vizio's "futuristic" corporate...
Which MOSFET topology?
A recent electronics.StackExchange question brings up a good topic for discussion. Let's say you have a power supply and a 2-wire load you want to be able to switch on and off from the power supply using a MOSFET. How do you choose which circuit topology to choose? You basically have four options, shown below:
From left to right, these are:
High-side switch, N-channel MOSFET High-side switch, P-channel MOSFET Low-side switch, N-channel...Thermistor signal conditioning: Dos and Don'ts, Tips and Tricks
In an earlier blog entry, I mentioned this circuit for thermistor signal conditioning:
It is worth a little more explanation on thermistor signal conditioning; it's something that's often done poorly, whereas it's among the easiest applications for signal conditioning.
The basic premise here is that there are two resistors in a voltage divider: Rth is the thermistor, and Rref is a reference resistor. Here Rref is either R3 alone, or R3 || R4, depending on the gain...
Real-time clocks: Does anybody really know what time it is?
We recently started writing software to make use of a real-time clock IC, and found to our chagrin that the chip was missing a rather useful function, namely elapsed time in seconds since the standard epoch (January 1, 1970, midnight UTC).Let me back up a second.A real-time clock/calendar (RTC) is a micropower chip that has an oscillator on it that keeps counting time, independent of main system power. Usually this is done with a lithium battery that can power the RTC for years, so that even...
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...
Byte and Switch (Part 1)
Imagine for a minute you have an electromagnet, and a microcontroller, and you want to use the microcontroller to turn the electromagnet on and off. Sounds pretty typical, right?We ask this question on our interviews of entry-level electrical engineers: what do you put between the microcontroller and the electromagnet?We used to think this kind of question was too easy, but there are a surprising number of subtleties here (and maybe a surprising number of job candidates that were missing...
Organizational Reliability
I was cleaning out my email inbox at work today and ran across something I had forwarded on to a friend a few years ago, which I thought I would share, for those of you who are working in the engineering world.
Below is a handout I got about 10 years ago from Doug Field, an executive now at Apple. Doug is a superb and inspiring leader, whom I had the opportunity to work with briefly.
The following is a bit of a diversion from the topics I usually post, but is some good food for thought for...
Racing to Sleep
Today we’re going to talk about low-power design.
Suppose I’m an electrical engineer working with wildlife biologists who are gathering field data on the Saskatchewan ringed-neck mountain goat. My team has designed a device called the BigBrotherBear 2000 (BBB2000) with a trip cable and a motor and a camera and a temperature sensor and a hot-wire anemometer and a real-time clock and an SD card and a battery and a LoRa transceiver. The idea is something like...
Painting with Light to Measure Time
Recently I was faced with a dilemma while working from home. I needed to verify an implementation of first-order sigma-delta modulation used to adjust LED brightness. (I have described this in more detail in Modulation Alternatives for the Software Engineer.) I did not, however, have an oscilloscope.
And then I remembered something, about a technique called “light painting”: basically a long-exposure photograph where a...
You Will Make Mistakes
</scorpion>: FAILAnyone out there see the TV pilot of Scorpion? Genius hacker squad meets Homeland Security in a fast-paced thriller to save hundreds of airplanes from crashing after LAX air traffic control software upgrade fails and they didn’t save a backup of the old version (ZOMG!!!) so thousands of people are going to die because the planes… well, they just can’t land! They just can’t. Even if the weather is sunny and calm and there could quite possibly...
Book Review: "Turing's Cathedral"
My library had Turing’s Cathedral: The Origins of the Digital Universe by George Dyson on its new acquisitions shelf, so I read it. I’d recommend the book to anyone interested in the history of computing.
Turing’s Cathedral primarly covers the period in early computing from 1940-1958, and bridges a gap between a few other popular books: on the historic side, between Richard Rhodes’s
Definite Article: Notes on Traceability
Electronic component distibutor Digi-Key recently announced part tracing for surface-mount components purchased in cut-tape form. This is a big deal, and it’s a feature that is a good example of traceability. Some thing or process that has traceability basically just means that it’s possible to determine an object’s history or provenance: where it came from and what has happened to it since its creation. There are a...
April is Oscilloscope Month: In Which We Discover Agilent Offers Us a Happy Deal and a Sad Name
Last month I wrote that March is Oscilloscope Month, because Agilent had a deal on the MSOX2000 and MSOX3000 series scopes offering higher bandwidth at lower prices. I got an MSOX3034 oscilloscope and saved my company $3500! (Or rather, I didn't save them anything, but I got a 350MHz scope at a 200MHz price.)
The scope included a free 30-day trial for each of the application software modules. I used my 30-day trial for the serial decode + triggering module, to help debug some UART...
Thoughts on Starting a New Career
I recently completed a 16-year stint at an engineering company. I started there fresh out of college in June 1996. This June I just started a new career as an applications engineer in the area of motor drives at Microchip Technology in Chandler, Arizona. The experience I had in switching jobs was a very enlightening one for me, and has given me an opportunity to reflect on my career. I want to share some of that reflection with you.
Disclaimer: the opinions expressed in this and other blogs...
Implementation Complexity, Part II: Catastrophe, Dear Liza, and the M Word
In my last post, I talked about the Tower of Babel as a warning against implementation complexity, and I mentioned a number of issues that can occur at the time of design or construction of a project.
The Tower of Babel, Pieter Bruegel the Elder, c. 1563 (from Wikipedia)
Success and throwing it over the wallOK, so let's say that the right people get together into a well-functioning team, and build our Tower of Babel, whether it's the Empire State Building, or the electrical grid, or...
Oh Robot My Robot
Oh Robot! My Robot! You’ve broken off your nose! Your head is spinning round and round, your eye no longer glows, Each program after program tapped your golden memory, You used to have 12K, now there is none that I can see, Under smoldering antennae, Over long forgotten feet, My sister used your last part: The chip she tried to eat.
Oh Robot, My Robot, the remote controls—they call, The call—for...
Scorchers, Part 2: Unknown Bugs and Popcorn
This is a short article about diminishing returns in the context of software releases.
Those of you who have been working professionally on software or firmware have probably faced this dilemma before. The scrum masters of the world will probably harp on terms like the Definition of Done and the Minimum Viable Product. Blah blah blah. In simple terms, how do you know when your product is ready to release? This is both an easy and a difficult question to answer.
What makes...
Painting with Light to Measure Time
Recently I was faced with a dilemma while working from home. I needed to verify an implementation of first-order sigma-delta modulation used to adjust LED brightness. (I have described this in more detail in Modulation Alternatives for the Software Engineer.) I did not, however, have an oscilloscope.
And then I remembered something, about a technique called “light painting”: basically a long-exposure photograph where a...
Garden Rakes Revisited: The Hall of Shame
A little while ago, I wrote about what I call the “garden rakes” syndrome in software, where there are little bugs or pitfalls lying around like sloppy garden rakes that no one has put away, and when you use these software programs, instead of zooming around getting things done, you’re either tripping over the garden rakes or carefully trying to avoid them. Either way, you lose focus on what you’re really trying to work on, and that causes a big hit in...
Reading and Understanding Profitability Metrics from Financial Statements
Whoa! That has got to be the most serious-minded title I’ve ever written. Profitability Metrics from Financial Statements, indeed. I’m still writing Part 2 of my Supply Chain Games article, and I was about to mention something about whether a company is profitable, when I realized something that didn’t quite fit into the flow of things, so I thought I’d handle it separately: how are you supposed to know what I mean, when I say a company is profitable? And how am I...
In Memoriam: Frederick P. Brooks, Jr. and The Mythical Man-Month
It is with some sadness that I have read that Fred Brooks has passed away. Brooks (1931 - 2022) worked at IBM and managed a large team developing the IBM System/360 computers in the early 1960s. Brooks was thirty years old at the start of this project. He founded the Computer Science Department at UNC Chapel Hill in 1964, at the age of thirty-three, acting as its department chair for twenty years. He remained at IBM until 1965, however. During this one-year...
Definite Article: Notes on Traceability
Electronic component distibutor Digi-Key recently announced part tracing for surface-mount components purchased in cut-tape form. This is a big deal, and it’s a feature that is a good example of traceability. Some thing or process that has traceability basically just means that it’s possible to determine an object’s history or provenance: where it came from and what has happened to it since its creation. There are a...
Modeling Gate Drive Diodes
This is a short article about how to analyze the diode in some gate drive circuits when figuring out turn-off characteristics --- specifically, determining the relationship between gate drive current and gate voltage during turn-off of a power transistor.
Ten Little Algorithms, Part 7: Continued Fraction Approximation
In this article we explore the use of continued fractions to approximate any particular real number, with practical applications.
Linear Feedback Shift Registers for the Uninitiated
In 2017 and 2018 I wrote an eighteen-part series of articles about linear feedback shift registers, or LFSRs:
div.jms-article-content ol > li { list-style-type: upper-roman } Ex-Pralite Monks and Finite Fields, in which we describe what an LFSR is as a digital circuit; its cyclic behavior over time; the definition of groups, rings, and fields; the isomorphism between N-bit LFSRs and the field \( GF(2^N) \); and the reason why I wrote this seriesTurn It On Again: Modeling Power MOSFET Turn-On Dependence on Source Inductance
This is a short article explaining how to analyze part of the behavior of a power MOSFET during turn-on, and how it is influenced by the parasitic inductance at the source terminal. The brief qualitative reason that source inductance is undesirable is that it uses up voltage when current starts increasing during turn-on (remember, V = L dI/dt), voltage that would otherwise be available to turn the transistor on faster. But I want to show a quantitative approximation to understand the impact of additional source inductance, and I want to compare it to the effects of extra inductance at the gate or drain.