Working with Strings in Embedded C++
This article discusses the use of strings in embedded systems. It explains how the need for and use of strings in embedded systems has changed with the advent of cheaper, full graphic displays and the growth of the ‘Internet of Things’ (IoT). The article also covers character literals, C-Strings and string literals, and the difference in memory models between them. It also highlights the safety and security issues that arise from using strings in embedded systems. Finally, it explains how C++11 introduced a Raw string literal type that is useful for storing file paths or regular expressions.
Get Involved: Contribute Quiz Questions for the Embedded Systems Community for a Chance to Win a LAP-C Pro!
Submit a Quiz Question for a chance to win a Zeroplus Lac-C Pro!
Return of the Delta-Sigma Modulators, Part 1: Modulation
About a decade ago, I wrote two articles:
- Modulation Alternatives for the Software Engineer (November 2011)
- Isolated Sigma-Delta Modulators, Rah Rah Rah! (April 2013)
Each of these are about delta-sigma modulation, but they’re short and sweet, and not very in-depth. And the 2013 article was really more about analog-to-digital converters. So we’re going to revisit the subject, this time with a lot more technical depth — in fact, I’ve had to split this...
C to C++: Bridging the Gap from C Structures to Classes
In our last post, C to C++: Proven Techniques for Embedded Systems Transformation, we started to discuss the different ways that C++ can be used to write embedded software. You saw that there is no reason to be overwhelmed by trying to adopt complex topics like metaprogramming out of the gate. An important concept to understand is that you can make the transition gradually into C++ while still receiving the many benefits that C++ has to offer.
One of the first...
The Missing Agile Conversation
In this article, we learn about Agile practices and how they use stories as units of development. Stories consist of a brief description, one to a few sentences. They don’t contain details sufficient to allow a developer to implement them. The Agile practice is to defer details as long as possible because conditions may change. When a developer takes on a story to implement, that’s the time for them to perform the work that has been deferred. They do this by having a conversation, a series of specific discussions working closely with the various SME’s (Subject Matter Experts) who have information relevant to the story.
STM32 B-CAMS-OMV Walkthrough
The STM32 B-CAMS-OMV camera module offers an accessible way to get started with embedded vision. Coupled with the STM32H747I-DISCO discovery kit and the FP-AI-VISION1 function pack, it's possible to be up and running in minutes.
This video describes the camera connection interface to the discovery kit and the key software functions required to control the camera and process its data. We review the ISP (Image Signal Processor) interface with examples of image processing...
Free Sessions @ the 2023 Embedded Online Conference
Although the 2023 Embedded Online Conference will officially start only on Monday 04/24, today we are pre-releasing all Theatre Talks and Demos in order to give attendees a headstart over the weekend on a very busy program.
The good news is, you don't need a paid registration to access theatre talks and demos. All you have to do is create an account on the EOC website and skip the payment part.
Here are the 37 sessions that you can watch for...
STM32 VS Code Extension Under The Hood
VS Code is becoming the "go to" environment for many developers. Increasingly, toolchain providers are publishing VS Code extensions and ST has recently followed suit. Additionally, CMake is significantly growing in popularity, with many projects adopting it for its ease of use and flexibility. This video shows how the STM32 VS Code extension works under the hood and how to get more out of it.
Specifically, we'll review the CMake files generated by the VS Code extension and how to modify...
Getting Started With Zephyr: West Manifest Customization
IntroductionThe Zephyr Project RTOS (https://zephyrproject.org/), or simply “Zephyr” as it is known colloquially, is an increasingly popular real-time operating system due to its native support for over 450 boards and countless peripherals. When starting with any embedded software project, the first task is to start from a known baseline. This can include cloning a repository from source control, which can be the case with embedded Linux, or downloading a zip file representing a...
Back from Embedded World 2023
It was great to be back in Nuremberg for Embedded World after three long years. The trade show is probably the most significant event in the embedded systems industry, and it was a relief to see that it has survived the pandemic with more than 900 vendors exhibiting.
I recorded this video on the very first day when the doors opened. What you see in the video is probably 10% or less of the full show floor. I am always impressed by the size of...
Introduction to Microcontrollers - Hello World
Embedded Hello WorldA standard first program on an embedded platform is the blinking LED. Getting an LED to blink demonstrates that you have your toolchain set up correctly, that you are able to download your program code into the μC, and that the μC and associated circuitry (e.g. the power supply) is all working. It can even give you good evidence as to the clock rate that your microcontroller is running (something that trips up a great many people,...
nRF5 to nRF Connect SDK migration via DFU over BLE
This writeup contains some notes on how I was able to migrate one of my clients projects based on the nRF5 SDK, to nRF Connect SDK (NCS) based firmware, via a DFU to devices in the field over BLE.
Using the Beaglebone PRU to achieve realtime at low cost
IntroductionI work as an engineer in a synchrotron facility. A few weeks ago, I helped the people in charge of the power supply developments to integrate a realtime control algorithm on a prototype platform: a BeagleBone Black (BBB) running Linux. I had already worked with this board in the past, and I found it very interesting given its excellent resources versus price ratio (around 40 euros). This time, I was impressed by its realtime capabilities. I thought it would be a good idea to...
Introduction to Microcontrollers - 7-segment displays & Multiplexing
Doing the 7 Segment ShuffleThe 7 segment display is ubiquitous in the modern world. Just about every digital clock, calculator and movie bomb has one. The treadmills at my gym have 6 or 7, each one displaying 3 or 4 digits. What makes the 7-seg interesting is that it presents an opportunity to make a trade off between GPIO (output pins) for time. Every 7-seg display requires 8 outputs (the 7 segments and usually either a decimal point or a...
Introduction to Microcontrollers - Timers
Timers - Because "When" MattersComputer programs are odd things, for one reason because they have no concept of time. They may have the concept of sequential execution, but the time between instructions can be essentially any number and the program won't notice or care (unless assumptions about time have been built into the program by the programmer). But the real world is not like this. In the real world, especially the real embedded world,...
Mastering Modern FPGA Skills for Engineers
In the rapidly evolving tech industry, engineers must acquire proficiency in modern FPGA skills. These skills empower engineers to optimize designs, minimize resource usage, and efficiently address FPGA design challenges while ensuring functionality, security, and compliance.
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 (
How to Analyze a Differential Amplifier
There are a handful of things that you just have to know if you do any decent amount of electronic circuit design work. One of them is a voltage divider. Another is the behavior of an RC filter. I'm not going to explain these two things or even link to a good reference on them — either you already know how they work, or you're smart enough to look it up yourself.
The handful of things also includes some others that are a little more interesting to discuss. One of them is this...
Patterns of Thinking: Metaphors in Programming
Several years ago, I once attended an “Object-Oriented Analysis and Design” training. As most such courses go, the instructor began with brushing up on the fundamental OO concepts. When explaining inheritance, the instructor spontaneously compared inheriting from a class to passing traits from parents to the offspring in a family. At first, this “family tree” metaphor seemed to make a lot of sense and most attendees nodded approvingly. However, when the instructor discussed...
My Love-Hate Relationship with Stack Overflow: Arthur S., Arthur T., and the Soup Nazi
Warning: In the interest of maintaining a coherent stream of consciousness, I’m lowering the setting on my profanity filter for this post. Just wanted to let you know ahead of time.
I’ve been a user of Stack Overflow since December of 2008. And I say “user” both in the software sense, and in the drug-addict sense. I’m Jason S, user #44330, and I’m a programming addict. (Hi, Jason S.) The Gravatar, in case you were wondering, is a screen...
StrangeCPU #2. Sliding Window Token Machines
Summary:An in-depth exploration of Sliding Window Token Machines; ARM notes.
Table of Contents:- Part 1: A new CPU - technology review, re-examination of the premises; StrangeCPU concepts; x86 notes.
- Part 2: Sliding-Window Token Machines, an in-depth exploration of this curious technology; ARM notes.
- Part 3. Instruction Slides - The Strangest CPU Yet! Decoding instructions with a Sliding Window...
Modern C++ in Embedded Development: (Don't Fear) The ++
While C is still the language of choice for embedded development, the adoption of C++ has grown steadily. Yet, reservations about dynamic memory allocation and fears of unnecessary code bloat have kept many in the C camp. This discourse aims to explore the intricacies of employing C++ in embedded systems, negotiating the issues of dynamic memory allocation, and exploiting the benefits of C++ offerings like std::array and constexpr. Moreover, it ventures into the details of the zero-overhead principle and the nuanced distinctions between C and C++. The takeaway? Armed with the right knowledge and a careful approach, C++ can indeed serve as a powerful, safer, and more efficient tool for embedded development.
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:
Embedded Systems Roadmaps
What skills should every embedded systems engineer have? What should you study next to improve yourself as an embedded systems engineer? In this article I'll share with you a few lists from well-respected sources that seek to answer these questions, with the hope of helping provide you a path to mastery. Whether you've only just finished your first Arduino project or you've been building embedded systems for decades, I believe there's something in here for everyone to help improve themselves as embedded systems engineers.
Important Programming Concepts (Even on Embedded Systems) Part III: Volatility
1vol·a·tile adjective \ˈvä-lə-təl, especially British -ˌtī(-ə)l\ : likely to change in a very sudden or extreme way : having or showing extreme or sudden changes of emotion : likely to become dangerous or out of control
— Merriam-Webster Online Dictionary
Other articles in this series:
10 More (Obscure) Circuit Components You Should Know
The interest in my previous article on obscure but useful electronics parts, "10 Circuit Components You Should Know" was encouraging enough that I thought I would write a followup. So here are another 10:
1. "Ideal Diode" controllers
Load-sharing circuits use diodes tied together at their cathode terminal to take the most positive voltage among the sources and connect it to a load. Works great: you have a DC/DC power supply, a battery, and a solar cell, and it will use whichever output is...
Energia - program a TI MSP430 using Arduino sketches
TI MSP430 LaunchpadI started tinkering with microcontroller a couple of years ago with an Arduino Uno. I had a little experience with C, so programming in the Arduino environment has been relatively easy and straightforward for me. My code is not necessarily elegant or efficient, but I can usually figure out how to make an Arduino do what I want it to do eventually. A lot of credit to the Arduino userbase, as it is very easy to figure most things out with a quick Google...
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...
Someday We’ll Find It, The Kelvin Connection
You’d think it wouldn’t be too hard to measure electrical resistance accurately. And it’s really not, at least according to wikiHow.com: you just follow these easy steps:
- Choose the item whose resistance you wish to measure.
- Plug the probes into the correct test sockets.
- Turn on the multimeter.
- Select the best testing range.
- Touch the multimeter probes to the item you wish to measure.
- Set the multimeter to a high voltage range after finishing the...
Discrete-Time PLLs, Part 1: Basics
In this series of tutorials on discrete-time PLLs we will be focusing on Phase-Locked Loops that can be implemented in discrete-time signal proessors such as FPGAs, DSPs and of course, MATLAB.