## Ancient History

The other day I was downloading an IDE for a new (to me) OS. When I went to compile some sample code, it failed. I went onto a forum, where I was told "if you read the release notes you'd know that the peripheral libraries are in a legacy download". Well damn! Looking back at my previous versions I realized I must have done that and forgotten about it. Everything changes, and keeping up with it takes time and effort.

When I first started with microprocessors we...

## Steering an autonomous vehicle - two basic ways

While there are many types of steering mechanisms, for now, I will be concentrating on two of them.

The first is known as Ackerman-type steering. On a rear-wheel-drive four-wheeled car, the rear wheels push the vehicle while the two front wheels pivot left and right, either by using a servo or a geared motor, to steer the vehicle. Understeer is when the vehicle tries to push through the turn too wide, possibly causing the vehicle to drive off the outside of the course. ...

## Dealing With Fixed Point Fractions

Fixed point fractional representation always gives me a headache because I screw it up the first time I try to implement an algorithm. The difference between integer operations and fractional operations is in the overflow. If the representation fits in the fixed point result, you can not tell the difference between fixed point integer and fixed point fractions. When integers overflow, they lose data off the most significant bits. When fractions overflow, they lose data off...

## A quick look at the Line Follower Vehicle

In its most basic form, a Line Following Vehicle (LFV) consists of a line sensor, a vehicle, some way to process the signal, and batteries.

A basic line can consist of black 3/4" electrical tape on a white background. Other lines consist of a white line on a black background. While usually solid, a line can consist of dashes and even change between colors. Turns are generally sweeping and gradual, but can include angles. Each of these changes adds a layer of difficulty to the...

## Analyzing the Linker Map file with a little help from the ELF and the DWARF

When you're writing firmware, there always comes a time when you need to check the resources consumed by your efforts - perhaps because you're running out of RAM or Flash or you want to optimize something. The map file generated by your linker is a useful tool to aid in the resource analysis. I wanted to filter and sort the data generated in an interactive way so I wrote a C# WinForms application that reads the data from the map and presents it in a list view (using the awesome

## Mathematics and Cryptography

The mathematics of number theory and elliptic curves can take a life time to learn because they are very deep subjects. As engineers we don't have time to earn PhD's in math along with all the things we have to learn just to make communications systems work. However, a little learning can go a long way to helping make our communications systems secure - we don't need to know everything. The following articles are broken down into two realms, number theory and elliptic...

## Global Variables vs. Safe Software

It seems that Reddit's programming and technology subreddits have only recently caught up to 2013. If you take a look, you'll find plenty of discussion and controversy surrounding a 2013 blog post from Safety Research & Strategies Inc. regarding the software failings behind Toyota's unintended acceleration problems.

The article is a good overview, but for full credit you should read the writeups, presentations and testimony from

## Elliptic Curve Digital Signatures

A digital signature is used to prove a message is connected to a specific sender. The sender can not deny they sent that message once signed, and no one can modify the message and maintain the signature. The message itself is not necessarily secret. Certificates of authenticity, digital cash, and software distribution use digital signatures so recipients can verify they are getting what they paid for.

Since messages can be of any length and mathematical algorithms always use fixed...

## Margin Call: Fermi Problems, Highway Horrors, Black Swans, and Why You Should Worry About When You Should Worry

“Reports that say that something hasn’t happened are always interesting to me, because as we know, there are known knowns; there are things we know that we know. There are known unknowns; that is to say, there are things that we now know we don’t know. But there are also unknown unknowns — there are things we do not know we don’t know.” — Donald Rumsfeld, February 2002

Today’s topic is engineering margin.

XKCD had a what-if column involving Fermi...

## Elliptic Curve Key Exchange

Elliptic Curve Cryptography is used to create a Public Key system that allows two people (or computers) to exchange public data so that both sides know a secret that no one else can find in a reasonable time. The simplest method uses a fixed public key for each person. Once cracked, every message ever sent with that key is open. More advanced key exchange systems have "perfect forward secrecy" which means that even if one message key is cracked, no other message will...

## 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...

## Important Programming Concepts (Even on Embedded Systems) Part VI : Abstraction

Earlier articles:

- Part I: Idempotence
- Part II: Immutability
- Part III: Volatility
- Part IV: Singletons
- Part V: State Machines

We have come to the last part of the Important Programming Concepts series, on abstraction. I thought I might also talk about why there isn’t a Part VII, but decided it would distract from this article — so if you want to know the reason, along with what’s next,

## Choosing a Microcontroller for Your Vehicle

There are many things to take into consideration when choosing a microcontroller or microprocessor for your autonomous vehicle.

Voltage

Some processors run on 5V and others use 3.3V. Be sure to check the documentation before you buy. Make sure your supply has a high enough amp rating that your microcontroller doesn't lose pwer.

Power

Can the system run using batteries? Large, automotive sized vehicles can be run from large batteries or inverters in the vehicle. Smaller...

## Linear Feedback Shift Registers for the Uninitiated, Part VIII: Matrix Methods and State Recovery

Last time we looked at a dsPIC implementation of LFSR updates. Now we’re going to go back to basics and look at some matrix methods, which is the third approach to represent LFSRs that I mentioned in Part I. And we’re going to explore the problem of converting from LFSR output to LFSR state.

Matrices: Beloved Historical DregsElwyn Berlekamp’s 1966 paper Non-Binary BCH Encoding covers some work on

## C Programming Techniques: Function Call Inlining

IntroductionAbstraction is a key to manage software systems as they increase in size and complexity. As shown in a previous post, abstraction requires a developper to clearly define a software interface for both data and functions, and eventually hide the underlying implementation.When using the C language, the interface is often exposed in a header '.h' file, while the implementation is put in one or more corresponding '.c' files.

First, separating an interface from its...

## Linear Feedback Shift Registers for the Uninitiated, Part V: Difficult Discrete Logarithms and Pollard's Kangaroo Method

Last time we talked about discrete logarithms which are easy when the group in question has an order which is a smooth number, namely the product of small prime factors. Just as a reminder, the goal here is to find \( k \) if you are given some finite multiplicative group (or a finite field, since it has a multiplicative group) with elements \( y \) and \( g \), and you know you can express \( y = g^k \) for some unknown integer \( k \). The value \( k \) is the discrete logarithm of \( y \)...

## Optimizing Optoisolators, and Other Stories of Making Do With Less

It’s been a few months since I’ve rolled up my sleeves here and dug into some good old circuit design issues. I started out with circuit design articles, and I’ve missed it.

Today’s topic will be showing you some tricks for how to get more performance out of an optoisolator. These devices — and I’m tempted to be lazy and call them “optos”, but that sounds more like a cereal with Greek yogurt-covered raisins — are essentially just an LED...

## Lost Secrets of the H-Bridge, Part II: Ripple Current in the DC Link Capacitor

In my last post, I talked about ripple current in inductive loads.

One of the assumptions we made was that the DC link was, in fact, a DC voltage source. In reality that's an approximation; no DC voltage source is perfect, and current flow will alter the DC link voltage. To analyze this, we need to go back and look at how much current actually is being drawn from the DC link. Below is an example. This is the same kind of graph as last time, except we added two...

## C++ on microcontrollers 4 – input pins, and decoding a rotary switch

This blog series is about the use of C++ for modern microcontrollers. My plan is to show the gradual development of a basic I/O library. I will introduce the object-oriented C++ features that are used step by step, to provide a gentle yet practical introduction into C++ for C programmers. Reader input is very much appreciated, you might even steer me in the direction you find most interesting.

So far I...

## Using XML to describe embedded devices (and speak to them)

This article discusses one of the typical development cycles in embedded device and communication design and presents a possible, light weight solution using the free DClib/netpp framework.

The challengeAssume we're faced with the design of an embedded device, be it a simple SoC unit or a more complex, uC controlled engine with various attached peripherals. From first prototype to the market, the following development cycle is typically walked through:

## Levitating Globe Teardown, Part 2

Part 1 of this article was really more of an extended (and cynical) product review. In this part of the article, I actually take things apart (sometimes a bit more suddenly than I meant to) and show you some innards.First the globe. I knew there was a magnet in there someplace, because it's obviously plastic and it also attracts metal. I had intended to gently part the globe at the glue bond along the equator. I started by trying to gently flex the thing on my work...

## Second-Order Systems, Part I: Boing!!

I’ve already written about the unexciting (but useful) 1st-order system, and about slew-rate limiting. So now it’s time to cover second-order systems.

The most common second-order systems are RLC circuits and spring-mass-damper systems.

Spring-mass-damper systems are fairly common; you’ve seen these before, whether you realize it or not. One household example of these is the spring doorstop (BOING!!):

(For what it’s worth: the spring...

## Oscilloscope review: Hameg HMO2024

Last year I wrote about some of the key characteristics of oscilloscopes that are important to me for working with embedded microcontrollers. In that blog entry I rated the Agilent MSOX3024A 4-channel 16-digital-input oscilloscope highly.

Since then I have moved to a different career, and I am again on the lookout for an oscilloscope. I still consider the Agilent MSOX3024A the best choice for a...

## Have You Ever Seen an Ideal Op-Amp?

Somewhere, along with unicorns and the Loch Ness Monster, lies a small colony of ideal op-amps. Op-amp is short for operational amplifier, and we start our education on them by learning about these mythical beasts, which have the following properties:

- Infinite gain
- Infinite input impedance
- Zero output impedance

And on top of it all, they will do whatever it takes to change their output in order to make their two inputs equal.

But they don't exist. Real op-amps have...

## Lost Secrets of the H-Bridge, Part II: Ripple Current in the DC Link Capacitor

In my last post, I talked about ripple current in inductive loads.

One of the assumptions we made was that the DC link was, in fact, a DC voltage source. In reality that's an approximation; no DC voltage source is perfect, and current flow will alter the DC link voltage. To analyze this, we need to go back and look at how much current actually is being drawn from the DC link. Below is an example. This is the same kind of graph as last time, except we added two...

## How to Give Persistent Names To USB-Serial Devices on Ubuntu 14.04

If you have a bunch of USB-serial devices connected to your dock station and you needed to bind your USB-serial devices under static names so that all the USB-serial devices don't get to be assigned to random names by "udev" manager when you re-plug your laptop to the dock station, follow the instructions below. I will share the udev rules I created as a reference and give the step by step instructions to achieve persistent naming. All the steps worked on my Ubuntu 14.04...

## Mutex vs. Semaphore - Part 1

It never ceases to amaze me how often I see postings in forums asking the difference between a semaphore and a mutex. Probably what baffles me more is that over 90% of the time the responses given are either incorrect or missing the key differences. The most often quoted response is that of the “The Toilet Example (c) Copyright 2005, Niclas Winquist” . This summarises the differences as:

- A mutex is really a semaphore with value 1

No, no, and no again....

## Stairway to Thévenin

This article was inspired by a recent post on reddit asking for help on Thévenin and Norton equivalent circuits.

(With apologies to Mr. Thévenin, the rest of the e's that follow will remain unaccented.)

I still remember my introductory circuits class on the subject, roughly as follows:

(NOTE: Do not get scared of what you see in the rest of this section. We're going to point out the traditional approach for teaching linear equivalent circuits first. If you have...

## Ada 2012 for ARM M3/M4 Released for Download

Previous Ada TutorialsAda 2012 Comes to ARM Cortex M3/M4

It's Here!Great news - AdaCore now has their initial ARM Ada port available on their download site. You can get it by going to http://libre.adacore.com/download/ and working your way to the page titled "Download GNAT GPL and SPARK GPL Editions". There, under "Select Configurations" you will see ARM ELF for Linux and for Windows. Those are the ones you want.

Porting the Ada...

## Went 280km/h (174mph) in a Porsche Panamera in Germany!

Those of you who've been following my blog lately already know that I am going through some sort of mid-life crisis that involves going out there to meet people and make videos. It all started with Embedded World early this year, then continued at ESC Boston a couple of months ago and the latest chapter just concluded as I returned from Germany after spending a week at SEGGER's headquarters to produce a video to highlight their 25th anniversary.