Welcome to the first edition of the Embedded Artistry Newsletter! It's a monthly newsletter of curated and original content to help you build better embedded systems. This newsletter is intended to supplement the website and covers topics not mentioned there.
This month we'll be covering:
- One of the best books I've found on debugging
- A great introductory embedded programming book
cmocka, a C unit testing framework
- Particle Development Kits
- Nordic nRF5x SoCs
- Marvell MW300 SoC
- Shenzhen in the 1980s: Any guesses?
- Articles I recommend reading
Debugging: The 9 Indispensable Rules
The official title of this book is quite a mouthful: Debugging: The 9 Indispensable Rules for Finding Even the Most Elusive Software and Hardware Problems, by David J. Agans.
Agans distills debugging techniques down to nine essential rules and includes engineering war stories that demonstrate these principles. Here's the full list:
- Understand the System
- Make it Fail
- Quit Thinking and Look
- Divide and Conquer
- Change One Thing at a Time
- Keep an Audit Trail
- Check the Plug
- Get a Fresh View
- If You Didn't Fix it, It Ain't Fixed
This book helped me crystallize my debugging strategy and provided the language I now use to describe techniques that I practice. This book also reinforced the importance of techniques that I occasionally follow but can become lax on. I'm certain many of you are similarly guilty of violating the principles of "Change One Thing at a Time" and "Keep an Audit Trail"!
I highly recommend reading this book if you want to improve your debugging chops and engineering skills. Even veteran debuggers will likely learn a thing or two.
Making Embedded Systems: Design Patterns for Great Software
Making Embedded Systems: Design Patterns for Great Software is a beginner-friendly firmware book that explains basic firmware principles and patterns. The author, Elicia White, is a firmware consultant and creator of Embedded.fm. White introduces the concept of embedded programming and quickly dives into architecture, development techniques, and useful design patterns for embedded systems. Each chapter ends with a "Further Reading" list as well as an example interview question related to that chapter's material.
Overall, I was very impressed with White’s introduction to embedded systems programming and I recommend it to anyone looking to learn more about firmware.
Unit Testing with cmocka
Unit testing is the practice of writing tests to ensure that your functional interfaces work correctly. Most embedded projects I've worked on lack any sort of automated testing framework, relying instead on developers and QA teams to catch bugs. I'm interested in catching more bugs earlier in the development process, leaving human testers increased bandwidth to focus on system-level or operational flaws.
In my research I discovered that
cmocka is a great C unit testing framework. The basic
cmocka interfaces are simple and allowed me to start writing tests within minutes of including it in my project.
cmocka also has support for “mock objects,” which allow you to replace underlying function calls to create specific test conditions. This mock object support makes
cmocka an interesting candidate for enabling host-side simulation of hardware peripheral drivers, an area I will be exploring in the future.
- Wiki: Unit Testing - a good start if you're unfamiliar with the concept of unit testing
- Unit Testing Embedded Code with
cmocka: Unit testing with mock objects in C - explanation of mock objects
Particle Development Kits
One of my clients uses the Particle platform to connect their devices to the internet. Particle provides a one-stop shop for the Internet of Things (IoT) crowd. Particle's framework involves a cloud service, cellular- and wifi-enabled hardware, and SIM cards for your cellular devices.
Particle has set up their programming environment to mimic an Arduino project. They aim to eliminate much of the tricky low-level work by providing a stable platform with built-in support for wifi/cellular comms and features like OTA updates. Developers simply need to implement the application layer. This design choice makes Particle much more accessible to beginners and non-firmware folks, though it can be limiting for more complex projects.
I purchased my own Particle Electron to play around with cellular connections on personal projects. I think it's a great platform to experiment with IoT services.
- What is the Internet of Things? WIRED Explains - Start here if you're unfamiliar with the Internet of Things
- Photon - Wifi-based connectivity
- Electron - Cellular (3G) connectivity
- Getting Started: Developing for Particle Electron on Your Host
- Serial Debugging On the Particle Electron
It seems as if every company I've worked with in the past 6 months is using the Nordic nRF5x. The nRF51 is an "ultra-low power" SoC consisting of a Cortex-M0 MCU with an integrated 2.4GHz transceiver. Nordic also supplies software stacks supporting various BLE configurations as well as other useful features like DFU & OTA updates. The nRF52 line provides a Cortex-M4F, higher TX power, and the ability to use more flash and RAM in your system.
The Nordic chips are directly usable as the primary SoC in low-powered BLE devices. However, I also note a trend of using nRF5x SoCs as a secondary processor in complex systems. Since Nordic provides a fully functional BLE stack, a paired Nordic SoC can be used to handle BLE comms, freeing up the main system processor for other tasks. Other systems take advantage of the low power and use it as an always-on processor that monitors various inputs and wakes the primary system when required.
Due to their ubiquity, I recommend familiarizing yourself with this platform.
Marvell's MW300 SoC is similar to the nRF5x line and is aimed at the IoT crowd. The MW300 uses a Cortex-M4F core (same as nRF52) with an integrated 802.11 b/g/n wifi module. Marvell's SDK utilizes Amazon's AWS IoT framework for handling communications up to the AWS cloud services. The AWS IoT framework is a bit more involved than the Particle framework mentioned above, but it also provides more flexibility and extensibility. Marvell sells an AWS IoT starter kit that you can use for prototyping and for playing around with the AWS IoT service.
Shenzhen is an extremely important part of the electronics ecosystem: many products are designed, sourced, and assembled in Shenzhen. Over the past thirty years, the city has grown from a small town of 30,000 people to a bustling metropolis of 12,000,000.
If you haven't watched Wired's special on Shenzhen, I highly recommend starting there. The Wired special explores the maker movement, provides a brief overview of Shenzhen's history, and gives you some insight into manufacturing in China. For those of us who have spent significant time in Shenzhen, it will likely make you feel nostalgic.
What I actually want to share are these albums I ran across. The photographer shows Shenzhen during the 1980s when it was just a dusty little town:
Here are some articles I enjoyed reading:
- AliveCor Kardia - Stick it to the back of your phone to get medical-grade EKG readings. AliveCor uses neural nets to analyze your heartbeat and note any irregularities. Tech with social or health benefits really gets me excited.
- Scaling Engineering Teams - Interesting post about engineering team goals, makeup, growth patterns, and potential pitfalls at different company stages.
- The Rise of the New Language MC++ - The author argues that C++ has changed so much in the past few years that you should consider adjusting your searches to use "Modern C++" instead of "C++" to get relevant documentation. This post also provides a good summary of useful features to utilize from MC++ and shows examples from a Facebook project.
Interested in Side Projects?
Please reach out to me if you’re an embedded programmer looking to take on additional projects. We are always on the lookout for talented developers.
Thanks for Reading!
Please feel free to send me any feedback, suggestions, interesting articles, or other thoughts you might have.
While you wait on the next edition, check out our website!