EmbeddedRelated.com

Jacob Beningo (@beningjw)

Jacob is an embedded software consultant with over 15 years of experience developing real-time embedded systems. He helps his clients all over the world accelerate innovation and solve the embedded product challenges such as decreasing costs, faster time to market, lower energy use and securing systems.

Creating a GPIO HAL and Driver in C

Jacob Beningo February 28, 2024

Creating a GPIO Hardware Abstraction Layer (HAL) in C allows for flexible microcontroller interfacing, overcoming the challenge of variability across silicon vendors. This method involves reviewing datasheets, identifying features, designing interfaces, and iterative development, as detailed in the "Reusable Firmware" process. A simplified approach prioritizes essential functions like initialization and read/write operations, showcased through a minimal interface example. The post also highlights the use of AI to expedite HAL generation. A detailed GPIO HAL version is provided, featuring extended capabilities and facilitating driver connection through direct assignments or wrappers. The significance of a configuration table for adaptable peripheral setup is emphasized. Ultimately, the blog illustrates the ease and scalability of developing a GPIO HAL and driver in C, promoting hardware-independent and extensible code for various interfaces, such as SPI, I2C, PWM, and timers, underscoring the abstraction benefits.


A Sneak Peek at the 2024 Embedded Online Conference

Jacob Beningo January 19, 2024

The embedded systems industry is evolving at a rapid pace. Just a few years ago, most embedded products were disconnected systems that used bare-metal scheduling techniques. Today, the drive to connect devices and add intelligence at the edge is revolutionizing how we build embedded products. The only way to stay current and not get left behind is to learn and network with colleagues and industry experts continuously.

This year, the 2024 Embedded Online Conference is...


Creating a Hardware Abstraction Layer (HAL) in C

Jacob Beningo October 23, 20233 comments

In my last post, C to C++: Using Abstract Interfaces to Create Hardware Abstraction Layers (HAL), I discussed how vital hardware abstraction layers are and how to use a C++ abstract interface to create them. You may be thinking, that’s great for C++, but I work in C! How do I create a HAL that can easily swap in and out different drivers? In today’s post, I will walk through exactly how to do that while using the I2C bus as an example.


C to C++: Using Abstract Interfaces to Create Hardware Abstraction Layers (HAL)

Jacob Beningo September 21, 20236 comments

In C to C++, we've been exploring how to transition from a C developer to a C++ developer when working in embedded system. In this post, we will explore how to leverage classes to create hardware abstraction layers (HAL). You'll learn about the various inheritance mechanisms, what an virtual function is, and how to create an abstract class.


C to C++: 5 Tips for Refactoring C Code into C++

Jacob Beningo July 23, 20235 comments

The article titled "Simple Tips to Refactor C Code into C++: Improve Embedded Development" provides essential guidance for embedded developers transitioning from C to C++. The series covers fundamental details necessary for a seamless transition and emphasizes utilizing C++ as a better C rather than diving into complex language features. The article introduces five practical tips for refactoring C code into C++. Replace #define with constexpr and const: Discouraging the use of #define macros, the article advocates for safer alternatives like constexpr and const to improve type safety, debugging, namespaces, and compile-time computation. Use Namespaces: Demonstrating the benefits of organizing code into separate logical groupings through namespaces, the article explains how namespaces help avoid naming conflicts and improve code readability. Replace C-style Pointers with Smart Pointers and References: Emphasizing the significance of avoiding raw pointers, the article suggests replacing them with C++ smart pointers (unique_ptr, shared_ptr, weak_ptr) and using references


An Iterative Approach to USART HAL Design using ChatGPT

Jacob Beningo June 19, 202311 comments

Discover how to leverage ChatGPT and an iterative process to design and generate a USART Hardware Abstraction Layer (HAL) for embedded systems, enhancing code reusability and scalability. Learn the step-by-step journey, improvements made, and the potential for generating HALs for other peripherals.


C to C++: Bridging the Gap from C Structures to Classes

Jacob Beningo May 23, 20238 comments

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 concepts that a C...


Visual Studio Code Extensions for Embedded Software Development

Jacob Beningo March 22, 20238 comments

Visual Studio Code has become one of the most popular IDEs in the world. To date, software developers have downloaded it more than 40 million times! I suspect you’ve at least heard of it, if not already attempting to use it. Visual Studio Code allows developers to easily customize their development environment which can help them accelerate development, minimize bugs, and make developing software overall much better.

One challenge with Visual Studio Code is that embedded software...


C to C++: 3 Proven Techniques for Embedded Systems Transformation

Jacob Beningo February 7, 20234 comments

For 50 years, the C programming language has dominated the embedded software industry. Even today, more than 80% of embedded projects are using C; however, over the last few years, many teams have begun transitioning from C to C++. C++ offers embedded developers a robust, modern set of tools that can be used to write flexible, scalable, and reusable applications. As embedded applications become more complex and connected, teams need a more modern language to help them deal with the software...


C to C++: 3 Reasons to Migrate

Jacob Beningo October 31, 202222 comments

I’ve recently written several blogs that have set the stage with a simple premise: The C programming language no longer provides embedded software developers the tools they need to develop embedded software throughout the full software stack. Now, don’t get me wrong, C is a powerhouse, with over 80% of developers still using it; however, as embedded systems have reached unprecedented levels of complexity, C might not be the right tool for the job.

In this post, I’m kicking off a series...


Five ‘80s Movies that Inspired Me to Become an Engineer

Jacob Beningo July 20, 20227 comments

Five ‘80s Movies that Inspired Me to Become an Engineer

Movies and pop culture can incredibly impact society, particularly children. However, we never really know what conversation, demonstration, or movie could inspire someone to become an engineer. Recently in the Beningo house, we ran out of the film to watch for movie night. In desperation, I decided to find great movies from my childhood in the 80s. To my surprise, I realized how influential several of these films inspired me to...


3 Overlooked Embedded Software Elements

Jacob Beningo July 9, 20224 comments

Have you ever wondered, while you and your team are busy writing software if the foundation of how embedded software systems are built has changed and left you in the dust? What if while you were busily focusing on getting your product out the door, fighting bugs, and dealing with supply issues, there were techniques and processes that you completely overlooked that could save the day? I’ve found three elements embedded software teams often underutilize that could dramatically improve...


The 2021 IoT Online Conference

Jacob Beningo November 9, 2021

The IoT Online Conference is back, and this time the core focus is on IoT embedded systems and edge computing. This post will explore what will be happening at this year’s conference and how teams and developers can benefit.

The IoT Online Conference Overview

The IoT Online Conference will be taking place December 8 – 10, 2021. This is the conferences’ fourth year, although it started as a fall embedded systems conference which was a single day of webinars. The...


Introduction to Deep Insight Analysis for RTOS Based Applications

Jacob Beningo September 20, 20171 comment

Over the past several years, embedded systems have become extremely complex. As systems become more complex, they become harder and more time consuming to debug. It isn’t uncommon for development teams to spend more than 40% development cycle time just debugging their systems. This is where deep insight analysis has the potential to dramatically decrease costs and time to market.

Defining Deep Insight Analysis

Deep insight analysis is a set of tools and techniques that can be...


From bare-metal to RTOS: 5 Reasons to use an RTOS

Jacob Beningo October 18, 20167 comments

Developers can come up with amazing and convoluted reasons to not use an RTOS. I have heard excuses ranging from they are too expensive (despite open source solutions) all the way to they aren’t efficient and use too much memory. In some circumstances some excuses are justified but there are many reasons why a developer should look to an RTOS to help with their real-time scheduling needs.

From bare-metal to RTOS Quick Links
  • Part 1: 

From Baremetal to RTOS: A review of scheduling techniques

Jacob Beningo June 8, 201617 comments

Transitioning from bare-metal embedded software development to a real-time operating system (RTOS) can be a difficult endeavor. Many developers struggle with the question of whether they should use an RTOS or simply use a bare-metal scheduler. One of the goals of this series is to walk developers through the transition and decision making process of abandoning bare-metal thinking and getting up to speed quickly with RTOSes. Before diving into the details of RTOSes, the appropriate first step...


First, if you statically allocate memory and don't use dynamic memory allocation, you should be able to figure out your RAM usage during compile time.This can be...

Re: Help stop the Arduino compiler outwitting me

Reply posted 8 months ago (07/31/2023)
My first thought as well. Just to fill in some details Max, when you declare a variable volatile, you're telling the compiler that the variable value could change...
The only times I’ve used multiprocessing and mutex in C++ has been when developing desktop applications. I suspect that the arm compiler doesn’t support it unless...
I'm currently using the open source version that can be downloaded using: apt-get install -y --no-install-recommends gcc-arm-none-eabi . It looks like it's version: ...
These are all great questions. I think that you'll find diving into C++ for embedded systems is extremely rewarding and will elevate the solutions you can come up...

Re: Recommendation on Choice of RTOS

Reply posted 9 months ago (06/06/2023)
I've not worked with the RT595 so I can't offer much specific advice. When considering the change, you have to look at what your return on investment will be to...

Re: Project feasibility - Police Speed Gun

Reply posted 10 months ago (06/02/2023)
Great question, but I'm going to turn it around on you. Does it matter if it is feasible or not? Outside of school, we are always building systems that we aren't...
Hello Dr_Mark,    I've not worked with the specific MPS430F249, but I've worked with several other MSP430's over the years.    You can't assign any of the...

Re: Visual Studio vs Visual Studio Code?

Reply posted 10 months ago (05/18/2023)
The difference can definitely be confusing. I would view Visual Studio Code as a text editor that can achieve IDE like features through its extension system. An...

Re: Modeling and Code Generation now called "Low-Code"

Reply posted 2 years ago (05/14/2022)
Interesting. It's the first time I've heard the term "low-code" for modeling and code generation. It could be just an attempt to rebrand something that already exists...

Re: Advice on Re-schooling?

Reply posted 2 years ago (03/03/2022)
A great resource that I've found for staying up with the current trends and maintaining/gaining new skills is the O'Reilly book subscription. It was a little pricy,...

Re: Recommendation on Choice of RTOS

Reply posted 2 years ago (02/06/2022)
From what you have described, most likely either EmbOS or AzureRTOS will meet your requirements. Both are high-quality RTOSes that were well thought out in their...

Re: Variable Array Sizes when Instantiating?

Reply posted 3 years ago (06/28/2021)
Lots of different ways to do this. My suggestion would be to use an EEPROM to store the configuration settings for the device. Use a serial interface to set the...
There are several things you can start to do to identify what is happening:1) Add some serial printf statements or blink an LED in your main code to verify the processor...
The purpose of a FMEA is to identify potential failures modes and to then develop a strategy to properly address those failures. Many teams teams overlook potential...
TouchGFX or something like CrankSoftware would work for your solution. It sounds like your system may be Real-time and has enough time management activities to...

Re: STM MCU for GPS Tracker

Reply posted 4 years ago (04/20/2020)
I would probably use an STM32L series. You could do it with an STM8 but my preference is to stick to 32-bit Arm processors.

Re: Block diagram software

Reply posted 4 years ago (04/08/2020)
You can use tools like:- draw.io- Edraw- Visual Paradigm- Enterpise Architect
Your JTAG tool is great for debugging and developing an embedded application. If you are physically present to your device, you would want to use JTAG (or SWD). A...

Re: Industrial RS485 converters

Reply posted 4 years ago (10/05/2019)
I'm not sure why you would have the microcontroller separated by that large a distance from it's sensor. You would be better off converting the sensor data to ethernet...

Re: Can I control AC Power with Relays ?

Reply posted 4 years ago (09/23/2019)
Yes. There are several ways to do that Depending on how the remote is setup. For example:1) If the remote is IR, you can figure out what the protocol is by either...

Re: Can I control AC Power with Relays ?

Reply posted 4 years ago (09/23/2019)
I think I would just go to the store and purchase a programmable thermostat and set the on and off times and call it a day. As interesting of a project as this could...

Re: RTOS vs Bare-Metal

Reply posted 6 years ago (05/03/2018)
You can mimic preemption using ISR's but if you really want preemption, where a task interrupts another task, you need an RTOS. Best practices for ISR dictate they...

Re: RTOS vs Bare-Metal

Reply posted 6 years ago (05/02/2018)
There's been a lot of interesting posts so far so I'll just add a few personal insights and beliefs. First, what is meant by "bare-metal" programming? To me, bare...

Re: RTOS vs Bare-Metal

Reply posted 6 years ago (05/02/2018)
mikrceac, these are good points but I would argue that you are generalizing in your statement that "Nowadays there is no bare metal programming, there are barely...
I love the analogy! It definitely puts the whole thing into perspective.
I'll agree that reinventing is important for understanding and education but in most development cycles where time and money is short, reinventing can be the life...
There are several good habits that I believe programmers need to follow:1) Design their code before they write it2) Use a revision control system and commit often3)...

Re: Embedded Engineers Most Important and Useful Skills

Reply posted 6 years ago (10/26/2017)
The single most important skill that I believe embedded engineers need to master is debugging. Debugging is one of the greatest challenges that face every development...
Anyone that is looking for a new microcontroller shouldn't start with the hardware but instead, they should start by examining their software requirements. Microcontrollers...

Re: RTOS Debugging Techniques

Reply posted 7 years ago (05/03/2017)
Thanks everyone for your feedback. I've put together the abstract based on your feedback and am planning to run the webinar on Thursday May 11th. If you are interested...

Re: RTOS Debugging Techniques

Reply posted 7 years ago (04/26/2017)
Thanks for sharing that link and providing your input. A core piece of the webinar is going to be discussing the ARM Cortex tracing capabilities. It might be a good...

Re: RTOS Debugging Techniques

Reply posted 7 years ago (04/26/2017)
Thanks! Those are all great ideas and critical points. I will make sure that I cover these topics. Thanks for the feedback!

RTOS Debugging Techniques

New thread started 7 years ago
Hello! I am putting together a webinar on "Mastering #RTOS Debugging Techniques" and I would greatly appreciate your insights as to what you think should be added...
It's difficult to say with out seeing the source. Definitely the other comments should be followed. It sounds like bit array accesses are not truely being accessed...
There are multiple external IRQ signals that can be used to signal the CPU that an external event has occurred. Examples are IRQ's for Touch, Ethernet, LCD, etc....

Re: Free and Open Source Software for Embedded Systems

Reply posted 8 years ago (05/04/2016)
Compiler Toolchain: Atollic TrueSTUDIO Lite (Free)

Use this form to contact beningjw

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

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