It’s very tempting to assume that a system is going to behave as perfectly in the field as it does on the engineering bench. During development, embedded software is written under the best of conditions. The developer knows, or at least has their own concept of, how the system is supposed to work. Things usually … Continue reading 3 Strategies for Handling Errors in Embedded Software
Category: C Concepts
3 Explicit Programming Tips C Developers Should Follow
You know what they say when you ASSUME, you make an ASS out of U and ME. That’s exactly what developers are doing when they implicitly write their code and ASSUME that other developers can read minds across space and time. Embedded systems developers should be as Explicit as possible in order to avoid ASSUME … Continue reading 3 Explicit Programming Tips C Developers Should Follow
Is the war between C and C++ Over?
Back when I was an engineering student and a budding young engineer, it wasn’t unusual to open (yes physically open) the latest edition of embedded systems magazine and find articles that were contributing to the raging war between C and C++. Each side would present their cases as to why one language was better than … Continue reading Is the war between C and C++ Over?
Using Callbacks with Interrupts
On a weekly basis, I receive a fair number of emails with questions about how to design embedded systems. One question that seems to be asked more frequently than others is how to write a configurable driver that uses callbacks with interrupts. If a developer is writing a driver that will be reused in multiple … Continue reading Using Callbacks with Interrupts
5 Techniques to Delay Code Execution
An interesting problem that often comes up in embedded software implementation is figuring out how to delay code execution. Sometimes a developer might just want there to be a 10-microsecond delay to allow an I/O line to stabilize before reading it or may want a specified time period between reads to debounce it. In this … Continue reading 5 Techniques to Delay Code Execution
7 Steps to Create a Stack Monitor
One of the most painstaking bugs to hunt down in an embedded system is when the stack overflows its boundaries and starts to overwrite memory regions that are nearby. The symptoms of stack overflow usually appear randomly when just the perfect storm of interrupts and function calls are occurring which leads them to be difficult … Continue reading 7 Steps to Create a Stack Monitor
7 Steps to Create a Reusable Debounce Algorithm
A quick google search reveals that there are over 212,000 websites that examine how to debounce a button. After examining a number of them it is obvious that these implementations are not meant for reuse. The implementations and strategies often lack scalability, the ability to debounce multiple buttons easily and portability. They are tightly coupled … Continue reading 7 Steps to Create a Reusable Debounce Algorithm
Using strstr to Parse JSON Messages
When I first started to write embedded applications in C, microcontrollers were not very powerful, and we rarely ever parsed or worked with human readable text. Instead, we often generated packetized data where each byte in the message represented some specific type of information that we would then quickly decode on the fly as it … Continue reading Using strstr to Parse JSON Messages
10 Pain-free Steps to Configure an Interrupt Controller
Properly setting up interrupts on a microcontroller isn’t easy. The number of times an engineer has setup interrupts in their career doesn’t seem to make a difference. Configuring interrupts always has some gotcha hidden away that leaves the developer scratching their head and seeking answers in an obscure data sheet or online code snippet. Thankfully … Continue reading 10 Pain-free Steps to Configure an Interrupt Controller
5 Tips for Getting Started with Digital Signal Processing (DSP) on Arm Cortex®-M CPUs
Digital signal processing (DSP) provides developers with the ability to clean-up and analyze complex signals in a flexible and cost-efficient manner all from software. When developers typically think about DSP, they often picture expensive, dedicated processors, but modern microcontrollers, such as the Arm Cortex-M processors, now include DSP extensions that allow DSP algorithms to be … Continue reading 5 Tips for Getting Started with Digital Signal Processing (DSP) on Arm Cortex®-M CPUs