Matthew Eshleman (@MatthewEshleman)

Matthew loves to bring electronic devices to life through the magic and discipline of embedded software architecture, development, and engineering. With 20+ years of software and firmware development experience, Matthew has run the gamut, solving software problems in complex high volume consumer electronics to tiny, but deceptively complex, microcontroller based devices. More details here: Matthew Eshleman Consulting

UML Statechart tip: Handling errors when entering a state

Matthew Eshleman March 8, 20204 comments

This is my second post with advice and tips on designing software with UML statecharts. My first entry is here.

It has been nearly 20 years since I first studied UML statecharts. Since that initial exposure (thank you Samek!), I have applied event driven active object statechart designs to numerous projects [3]. Nothing has abated my preference for this pattern in my firmware and embedded software projects. Through the years I have taken note of a handful of common challenges when...


The Hardest Bug I Never Solved

Matthew Eshleman December 27, 20189 comments

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


Tenderfoot: How to Write a Great Bug Report

Matthew Eshleman May 31, 20184 comments

I am an odd sort of person. Why? Because I love a well written and descriptive bug report. I love a case that includes clear and easy to follow reproduction steps. I love a written bug report that includes all the necessary information on versions, configurations, connections and other system details. Why? Because I believe in efficiency. I believe that as an engineer I have a duty to generate value to my employer or customer. Great bug reports are one part of our collective never-ending...


Tenderfoot: Embedded Software and Firmware Specialties

Matthew Eshleman August 20, 201711 comments

Once upon a time (seven years ago) I answered a question on Stack Overflow. Then Stephane suggested I turn that answer into a blog post. Great idea! This post dives deeper into the original question: “Is it possible to fragment this field (embedded software and firmware) into sub-fields?”

This post represents a detailed and updated response to my original Stack Overflow answer. I hope this post provides guidance and useful information to the “tenderfoots” in the...


Tenderfoot: Recommended Reading

Matthew Eshleman June 28, 20171 comment

Twenty years ago I read Code Complete by Steve McConnell. And then read it again. And again. And again. Of all the books I have read during my career, I believe this was the book that catapulted me from a young electrical engineer to a young and aspiring embedded software engineer. So to all the ‘tenderfoots’ embarking upon an embedded systems and especially embedded software and firmware career, this entry is for you.

First, I would certainly recommend that all engineers read and read...


Tenderfoot: Introduction to Magic (Numbers that is...)

Matthew Eshleman May 10, 20173 comments

Once upon a time, while participating in a source code review, I stumbled across the following C code in a header file:

struct Foo { //various structure fields char string_buffer[45+3]; //buffer requires about 45 bytes };

My right eyebrow raised, I took a note, and continued with the code review, only to later stumble into this line of code in the body of a C function:

char * temp_string_buffer = (char*) malloc(45+3);

Again, I took a note on this function, and continued...


Favorite Tools: C++11 std::array

Matthew Eshleman February 26, 20172 comments

Many embedded software and firmware projects must be developed to high standards of reliability. To meet these reliability requirements, firmware project teams will consider many design tradeoffs. For example, an engineering team may avoid or outright ban the use of dynamic memory allocation, a feature typically accessed via the C library call "malloc" or the C++ allocator "new". When authoring software under such...


Favorite Tools: C++11 User-defined literals

Matthew Eshleman November 14, 20161 comment

In many software domains units of measurement are frequently critical to the software's data processing requirements. Those same units, or rather the use of the wrong units, are often the source of bugs and disastrous mistakes. Although useful for other purposes, user-defined literals are an excellent addition to the C++11 standard and handy when working with units of measurement.

Suppose a device measures velocity. To help prevent errors, the software specification requires...


Surprising Linux Real Time Scheduler Behavior

Matthew Eshleman November 5, 2016

I have recently been helping with embedded software design and development for a data acquisition and visualization device. The software executes within an embedded Linux context and consists of various animated user interfaces rendering the acquired data.

The data is received via a UART and a SPI connection. During project development we noticed poor UART data latency issues during heavy user interface animations. For this product to properly meet its acquisition requirements, the UART...


Favorite Tools - Look Up Tables

Matthew Eshleman October 22, 20163 comments

As we grow in our engineering careers, we must continually add new tools to our collective tool kits. One favorite tool in my toolkit will be obvious to many experienced embedded software engineers. I still remember learning this approach early in my career via code written by colleague David Starling. The tool in question: 

Look up tables 

Look up tables simplify code and improve firmware maintenance. What is a look up table? A look up table is often nothing more complex than a...


Re: FAT32 SD card support in Embedded Systems

Reply posted 3 months ago (02/21/2023)
Yes, I've encountered this too. In my case the product was using embedded Linux, so we just enabled the additional filesystem in our kernel setup, etc, and then...

Re: Advice on Re-schooling?

Reply posted 1 year ago (03/03/2022)
I agree with Jacob:  C skills are still valuable and useful.Beyond what others note, if considering self employment, look for a firm or two to help bring you...

Re: How to build a network of tiny micros?

Reply posted 1 year ago (02/08/2022)
Those RGB LED strips are great, and a good example here.I played around with those here:https://github.com/mattheweshleman/FreeRTOSEsp32Ac...Modeling the LEDs like...

Re: How to build a network of tiny micros?

Reply posted 1 year ago (02/07/2022)
Many years ago, actually my first professional firmware effort, involved a 9bit serial multidrop bus communication design.It was nice, because the first byte would...

Re: Wifi module prefered interface

Reply posted 2 years ago (10/08/2021)
Echo what 'hodgec' stated. I've used both in multiple projects. The AT commands can be OK, but there are always limitations and depends upon what application functionality...

Re: Why CRC with EPROM?

Reply posted 2 years ago (06/27/2021)
jmford94 and others have given the primary reasons. Other items/raw notes not explicitly noted:Using a CRC or other checksum (I personally use one per logical grouping...

Re: Communication protocol suggestions

Reply posted 2 years ago (03/22/2021)
I've seen something similar with SPI, which is probably what I would try to use today on first glance, mainly because it is nice to have the master provide the clock,...

Re: What are the odds? (Random Numbers)

Reply posted 2 years ago (02/01/2021)
...

Re: How do you test Ethernet? (Manufacturing)

Reply posted 2 years ago (12/08/2020)
Thank you, good to know! Do you know of any good description of using/performing the external loop back test?

Re: How do you test Ethernet? (Manufacturing)

Reply posted 2 years ago (12/08/2020)
Good to know, thank you!

How do you test Ethernet? (Manufacturing)

New thread started 2 years ago
Hi all,During manufacturing, I am curious how different groups test Ethernet interfaces on their embedded products (when applicable), such as 1000BASE-T.Is testing...

Re: Assert() If You Test Pre/Post Conditions

Reply posted 3 years ago (11/13/2020)
I don't have a specific recommendation on assert friendly frameworks. Chances are you might need a build option to replace the standard assert with a macro that...

Re: Assert() If You Test Pre/Post Conditions

Reply posted 3 years ago (11/05/2020)
Hi Daniel,TDD is an excellent tool to add to your engineering skill set. I personally love it.I think for most consumer grade firmware/software projects with typical...

Re: So, You Want to be an Engineering Manager?

Reply posted 3 years ago (10/03/2020)
My boss back in my Toshiba days was a good example of an excellent engineering manager. I even wrote an example of his style here:https://covemountainsoftware.com/2016/11/07/it-mak...Basically:Hire...

Re: How to Get and Keep a Job

Reply posted 3 years ago (09/24/2020)
One of our standard interview questions (not my idea) was:"What would you say if I told you that you are not qualified for this position?"And it was always our last...

Re: Energy managment

Reply posted 3 years ago (08/25/2020)
Gains power through what source? Solar? Electric? How often? How long must the system operate without a recharge? Worst case time periods? I'm not a battery expert,...

Re: Advice on resetting local function variables

Reply posted 3 years ago (06/28/2020)
'waydan' beat me to it, that is exactly what I was going to refer you to too... my example code would be nicely aligned to Samek's section 1 on Encapsulation.Good...

Re: Advice on resetting local function variables

Reply posted 3 years ago (06/27/2020)
Hi, Anytime we put a static variable inside a function, we are creating two issues:A possible thread safety issue, if the method/function was to ever be used in...

Re: To Cast, or Not to Cast

Reply posted 3 years ago (06/26/2020)
The compiler will do it automatically. This topic is about integer promotion rules and implicit type conversions, which are involved, but for the most part follow...

Re: To Cast, or Not to Cast

Reply posted 3 years ago (06/26/2020)
I haven't used the Arduino tools in many years. Check the project's compiler settings. It likely compiled fine due to the lack of enabled warnings as errors.  uint32_t...

Re: To Cast, or Not to Cast

Reply posted 3 years ago (06/26/2020)
Is this C or C++ (I'm assuming C)?Is this a 16bit or 32bit platform? (i.e. what is the size of the int)So, for example, if I try to compile that code for gcc MSP430,...

Re: Software Bugs

Reply posted 3 years ago (05/27/2020)
Feasible: Maybe.Economical: Doubtful.It would have more bugs, since more lines of code would be required. Note the second bullet point.Via:https://www.youtube.com/watch?v=tcyb1lpEHm0&t=825sBest...
I would "second" 'sdbranam's vote for Samek's solutions. I think pairing his QF framework with FreeRTOS will give you a great deal of flexibility.I've applied Samek's...

Re: Embedded Development Predictions for 2020-2029

Reply posted 3 years ago (01/09/2020)
Must generally predict more of the same, where same means:Mostly C code based projects (55-70%) (sigh)Fragmented as it has been. Because each product, business...

Re: Digital PID controller in velocity form

Reply posted 4 years ago (08/09/2019)
I would second mr_bandit's advice.I recently implemented a PID controller with many of the features you mention, but it is owned by my client. But, one thing I did,...

Re: Todo List: Improvements to the Related Sites

Reply posted 4 years ago (05/02/2019)
My vote is for:User profile (show some info - short bio for example - when clicking on a username)Especially in comments on a blog, it is confusing for me to have...

Re: self-learning embedded curriculum

Reply posted 5 years ago (09/19/2018)
Hello!Samek has an extensive YouTube series that may be helpful, although I haven't personally viewed them. See here.However, Samek's books have been very influential...

Re: Wanting to get back into Embedded Systems

Reply posted 5 years ago (05/10/2018)
>> 1. What are the popular processors today; I'm thinking ArmMy opinion: the most popular processor is the processor the customer has already decided upon...

Re: Bit error rate (bit off topic)

Reply posted 5 years ago (03/01/2018)
BER for what particular device or communication scheme or ?? How are you testing and measuring?I spent many many many hours doing BER testing for various RF digital...
With a son of mine currently in college, I have to ask: since when do universities worry about costs?   :-)Silliness aside, it can be very tempting to specify...
The volatile keyword is certainly important for any embedded software or firmware engineer to understand. For many years this was a key question I would ask during...
Tough subject! I would say the recipe for selecting a microcontroller involves mixing: one part: business one part: art one part: resources on hand two parts:...

Re: Multi-language support

Reply posted 6 years ago (09/04/2017)
Another possibility is to maintain all strings in a spreadsheet, write a macro or two in the spreadsheet to export all the strings with unique enumerated values...

Re: Azure IoT Hub UDP Implementation (NB-IoT)

Reply posted 6 years ago (07/19/2017)
Interesting, thanks. NB-IoT is supposed to achieve most of its power savings from the "narrow band LTE" physical/cell layer, it seems strange to restrict support...

Re: Azure IoT Hub UDP Implementation (NB-IoT)

Reply posted 6 years ago (07/19/2017)
There are many options here. I've worked with several GSM modules, which one is this?For example, MQTT is very light weight and requires a TCP socket, so might be...

Re: How to write professional looking test document ?

Reply posted 6 years ago (03/02/2017)
I'm not entirely sure by what is meant by "professionally". MS Word and/or Excel will certainly help a team author and track test cases just fine, but obviously...
Hi Tim,If I understand your concern, I agree with you: while(1) style loops that are just checking bit flags or event flag variables are problematic, and quickly...
Another point: consider a change in architecture.Instead of 3 tasks, perhaps reduce the architecture to a single task with with 3 freertos timer events feeding...
The mutex should be working.... chances are the code is still missing some location where the bit array is manipulated.If the code passes the bit array as a parameter...

Re: GSM-GPS Combined module.

Reply posted 6 years ago (02/04/2017)
I also worked with Telit cellular modules in the 2G and 3G families, some with and some without integrated GNSS (GPS). They work fine, but as noted, tend to be pricier. If...

Re: Quick Tip for the Embedded Systems Engineer

Reply posted 7 years ago (10/21/2016)
Use the compiler to catch your errors before running the code on the target. Create and use "static asserts" to catch common code maintenance issues during compile...

Use this form to contact MatthewEshleman

Before you can contact a member of the *Related Sites:

  • You must be logged in (register here)
  • You must confirm you email address