Understanding Microchip 8-bit PIC Configuration
The second post of a five part series picks up getting started developing with Microchip 8-bit PIC Microcontroller by examining the how and why of processor configuration. Topics discussed include selecting the oscillator to use during processor startup and refining the configuration once the application starts. A walk through of the code generated by the Microchip IDE provides a concrete example of the specific Configuration Word and SFR values needed to configure the project specific clock configuration.
C to C++: Templates and Generics – Supercharging Type Flexibility
"C to C++: Templates and Generics – Supercharging Type Flexibility" illuminates the rigidity of C when managing multiple types and the confusion of code replication or macro complexity. In contrast, C++ offers templates, acting as type-agnostic blueprints for classes and functions, which allows for the creation of versatile and reusable code without redundancy. By using templates, developers can define operations like add once and apply them to any data type, simplifying codebases significantly. Generics further this concept, enabling a single code structure to handle diverse data types efficiently—a boon for embedded systems where operations must be performed on varying data, yet code efficiency is critical due to resource limitations. The blog walks through practical applications, showcasing how templates streamline processes and ensure type safety with static_assert, all while weighing the pros and cons of their use in embedded software, advocating for careful practice to harness their full potential.
Using (Apache) NuttX Buttons Subsystem
Previously in this EmbeddedRelated article, we saw how to use LEDs Subsystem on NuttX testing on RaspberryPi Pico. In the same way we avoided using GPIO Subsystem to control LEDs we can avoid using GPIO Subsystem to read Buttons inputs. That is right, NuttX has an Input Device Subsystem like Linux and today we will learn how to use it.
Buttons are one of the simplest user input interface and after the famous "hello world LED" example they are probably the second...
Finite State Machines (FSM) in Embedded Systems (Part 2) - Simple C++ State Machine Engine
When implementing state machines in your project it is an advantage to rely on a tried and tested state machine engine. This component is reused for every kind of application and helps the developer focus on the domain part of the software. In this article, the design process that turns a custom C++ code into a finite-state machine engine is fully described with motivations and tradeoffs for each iteration.
Getting Started With CUDA C on an Nvidia Jetson: Hello CUDA World!
In this blog post, I introduce CUDA, which is a framework designed to allow developers to take advantage of Nvidia's GPU hardware acceleration to efficiently implement certain type of applications. I demonstrate an implementation to perform vector addition using CUDA C and compare it against the traditional implementation in "regular" C.
Modeling Gate Drive Diodes
This is a short article about how to analyze the diode in some gate drive circuits when figuring out turn-off characteristics --- specifically, determining the relationship between gate drive current and gate voltage during turn-off of a power transistor.
Getting Started with the Microchip PIC® Microcontroller
This first post of a five part series looks at the available hardware options for getting started with Microchip 8-bit PIC® Microcontroller, explores the MPLAB® X Integrated Development Environment and walks through setting up a project to expose the configured clock to an external pin and implement a single output GPIO to light an LED.
Make Your Own MCU Boards (2023 Teardown Conference)
Ditch the development boards! Products like the Nucleo development boards serve a wonderful purpose, but they’re ill-suited for projects that need to be small and cheap, such as hobby projects or products just beginning a production run. In this talk (a recording from the 2023 Teardown Conference), you’ll learn how to put a microcontroller or other custom circuit on a PCB a little larger than a stick of gum for less than $3 a board.
BusyBox; The Swiss Army Knife of Embedded Linux
In this article we cover the BusyBox, how it's designed to be optimized for embedded targets, and how to configure and build it in different ways, we also covered the license and limitation, which led to the development of ToyBox, I hope you enjoyed the article, please leave a comment for any correction or suggestions.
Creating a GPIO HAL and Driver in C
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.
How to Estimate Encoder Velocity Without Making Stupid Mistakes: Part I
Here's a common problem: you have a quadrature encoder to measure the angular position of a motor, and you want to know both the position and the velocity. How do you do it? Some people do it poorly -- this article is how not to be one of them.
Well, first we need to get position. Quadrature encoders are incremental encoders, meaning they can only measure relative changes in position. They produce a pair of pulse trains, commonly called A and B, that look like...
C to C++: Using Abstract Interfaces to Create Hardware Abstraction Layers (HAL)
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.
How FPGAs work, and why you'll buy one
Today, pretty much everyone has a CPU, a DSP and a GPU, buried somewhere in their PC, phone, car, etc. Most don't know or care that they bought any of these, but they did.
Will everyone, at some future point, also buy an FPGA? The market size of FPGAs today is about 1% of the annual global semiconductor sales (~$3B vs ~$300B). Will FPGA eventually...
Getting Started with (Apache) NuttX RTOS - Part 1
NuttX RTOS is used in many products from companies like Sony, Xiaomi, Samsung, Google/Fitbit, WildernessLabs and many other companis. So, probably you are already using NuttX even without knowing it, like the you was using Linux on your TV, WiFi router more than 10 years ago and didn't know too! Today you will have the chance to discover a little bit of this fantastic Linux-like RTOS! Are you ready? So, let's get started!
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...
Linear Feedback Shift Registers for the Uninitiated, Part I: Ex-Pralite Monks and Finite Fields
Later there will be, I hope, some people who will find it to their advantage to decipher all this mess.
— Évariste Galois, May 29, 1832
I was going to call this short series of articles “LFSRs for Dummies”, but thought better of it. What is a linear feedback shift register? If you want the short answer, the Wikipedia article is a decent introduction. But these articles are aimed at those of you who want a little bit deeper mathematical...
How Embedded Linux is used in Spacecrafts !
This article dives into the application of Linux in spacecraft, examining the challenges it poses and proposing potential solutions. Real-life examples will be discussed, while also addressing the drawbacks of employing Linux in safety-critical missions.
VHDL tutorial - A practical example - part 2 - VHDL coding
In part 1 of this series we focused on the hardware design, including some of the VHDL definitions of the I/O characteristics of the CPLD part. In part 2, we will describe the VHDL logic of the CPLD for this design.
With any design, the first step to gather the requirements for the job at hand. From part 1 of this article, I have copied two sections that address some of the requirements for the CPLD design.
The data acquisition engine has the...
VHDL tutorial - A practical example - part 3 - VHDL testbench
In part 1 of this series we focused on the hardware design, including some of the VHDL definitions of the I/O characteristics of the CPLD part. In part 2, we described the VHDL logic of the CPLD for this design. In part 3, we will show the entire VHDL design and the associated tests used to prove that we have, in fact, designed what we started out to design.
First, let's pull all of the pieces of the prior design together into a...
MSP430 Launchpad Tutorial - Part 2 - Interrupts and timers
What is an "interrupt"? It is a signal that informs our MCU that a certain event has happened, causing the interruption of the normal flow of the main program and the execution of an "interrupt routine", that handles the event and takes a specified action.
Interrupts are essential to avoid wasting the processor's valuable time in polling loops, waiting for external events (in fact they are used in Real-Time Operating Systems,
Supply Chain Games: What Have We Learned From the Great Semiconductor Shortage of 2021? (Part 2)
Welcome back! Today we’re going to zoom around again in some odd directions, and give a roundabout introduction to the semiconductor industry, touching on some of the following questions:
- How do semiconductors get designed and manufactured?
- What is the business of semiconductor manufacturing like?
- What are the different types of semiconductors, and how does that affect the business model of these manufacturers?
- How has the semiconductor industry evolved over...
Byte and Switch (Part 1)
Imagine for a minute you have an electromagnet, and a microcontroller, and you want to use the microcontroller to turn the electromagnet on and off. Sounds pretty typical, right?We ask this question on our interviews of entry-level electrical engineers: what do you put between the microcontroller and the electromagnet?We used to think this kind of question was too easy, but there are a surprising number of subtleties here (and maybe a surprising number of job candidates that were missing...
Introduction to Microcontrollers - Further Beginnings
Embedded Programming BasicsThis tutorial entry will discuss some further embedded programming basics that you will need to understand before proceeding on to the LED blinky and other example programs. We will do this by looking at the general organization and types of instructions found in most microcontrollers, and how that organization and those instructions are reflected (or, in some cases, ignored) by the C programming language.
Basic CPU...How to Build a Fixed-Point PI Controller That Just Works: Part I
This two-part article explains five tips to make a fixed-point PI controller work well. I am not going to talk about loop tuning -- there are hundreds of articles and books about that; any control-systems course will go over loop tuning enough to help you understand the fundamentals. There will always be some differences for each system you have to control, but the goals are the same: drive the average error to zero, keep the system stable, and maximize performance (keep overshoot and delay...
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 (
Back from Embedded World 2019 - Funny Stories and Live-Streaming Woes
When the idea of live-streaming parts of Embedded World came to me, I got so excited that I knew I had to make it happen. I perceived the opportunity as a win-win-win-win.
- win #1 - Engineers who could not make it to Embedded World would be able to sample the huge event,
- win #2 - The organisation behind EW would benefit from the extra exposure
- win #3 - Lecturers and vendors who would be live-streamed would reach a (much) larger audience
- win #4 - I would get...
Data Hiding in C
Strictly speaking, C is not an object-oriented language. Although it provides some features that fit into the object-oriented paradigm it has never had the full object-oriented focus that its successor C++ offers. C++ introduced some very useful concepts and abilities that I miss when I’m developing in ANSI C. One such concept is protected member variables and functions.
When you declare a class in C++ you can also declare member variables and functions as part of that class. Often, these...
Already 3000+ Attendees Registered for the Upcoming Embedded Online Conference
Chances are you already know, through the newsletter or banners on the Related sites, about the upcoming Embedded Online Conference.
Chances are you also already know that you have until the end of the month of February to register for free.
And chances are that you are one of the more than 3000 pro-active engineers who have already registered.
But If you are like me and have a tendency to do tomorrow what can be done today, maybe you haven't registered yet. You may...
Ten Little Algorithms, Part 3: Welford's Method (and Friends)
Other articles in this series:
- Part 1: Russian Peasant Multiplication
- Part 2: The Single-Pole Low-Pass Filter
- Part 4: Topological Sort
- Part 5: Quadratic Extremum Interpolation and Chandrupatla's Method
- Part 6: Green’s Theorem and Swept-Area Detection
Last time we talked about a low-pass filter, and we saw that a one-line...
Arduino robotics #1 - motor control
Arduino RoboticsBeginner robotics is a series of article chronicling my first autonomous robot build, Clusterbot. This build is meant to be affordable, relatively easy and instructive. The total cost of the build is around $50.
1. Arduino robotics - motor control2. Arduino robotics - chassis, locomotion and power3. Arduino robotics - wiring, coding and a test run4.The New Forum is LIVE!
After months of hard word, I am very excited to introduce to you the new forum interface.
Here are the key features:
1- Easily add images to a post by drag & dropping the images in the editor
2- Easily attach files to a post by drag & dropping the files in the editor
3- Add latex equations to a post and they will be rendered with Mathjax (tutorial)
4- Add a code snippet and surround the code with
Helping New Bloggers to Break the Ice: A New Ipad Pro for the Author with the Best Article!
Breaking the ice can be tough. Over the years, many individuals have asked to be given access to the blogging interface only to never post an article.
Welcoming MANY New Bloggers!
The response to the latest call for bloggers has been amazing and I am very grateful.
In this post I present to you the individuals who, so far (I am still receiving applications at an impressive rate and will update this page as more bloggers are added), have been given access to the blogging interface. I am very pleased with the positive response and I think the near future will see the publication of many great articles, given the quality of the...
Recruiting New Bloggers!
Previous calls for bloggers have been very successful in recruiting some great communicators - Rick Lyons, Jason Sachs, Victor Yurkovsky, Mike Silva, Markus Nentwig, Gene Breniman, Stephen Friederichs,
DSPRelated and EmbeddedRelated now on Facebook & I will be at EE Live!
I have two news to share with you today.
The first one is that I finally created Facebook pages for DSPRelated.com and EmbeddedRelated (DSPRelated page - EmbeddedRelated page). For a long time I didn't feel that this was something that was needed, but it seems that these days more and more people are using their Facebook account to stay updated with their favorite websites. In any event, if you have a Facebook account, I would greatly appreciate if you could use the next 5 seconds to "like"...
Free Embedded Systems Books
Following the success of the Collaborative Writing Experiment: What are your favorite Embedded Systems Online Resources? blog post, let's try a second collaborative writing experiment. This time, let's work on a file that will list the best embedded systems books that are available online for free. I am not talking about books that are illegally made available for download by pirates, but books that are made available online by authors and/or publishers.
Do you know of...
Collaborative Writing Experiment: What are your favorite Embedded Systems Online Resources?
Edit 22/05 - Wow, this went better than expected. I will try submitting this blog post to Reddit/ece and see if we can get a few more interesting links before I close the document. Thanks to everyone who contributed!
_______
Edit 28/05 - The document is now closed to editing. If there is a link that you would like to see added, please use the comment system at the end of this blog. Thanks to all who participated!
Up next, Free...
Success Story
A blog post has just broken the all-time record for the number of pageviews in 24 hours on the related sites. The blog post in question is titled Data Hiding in C and was written by Stephen Friederichs. It has been viewed by more than 7000 individuals since its publication a few days ago.
One reason that explains the success of this blog post is the wide appeal of the subject of the article (c programming) which allowed me to
Code Snippets Winners Announced
Wow, thanks a lot for all the code snippets - I am pleasantly surprised by the quality of the code that has been shared and I am very grateful.
Now, as you know, to give momentum to the section I had announced a special reward program for code snippets submitted by the end of March.
The partner members and I had a very hard time selecting the 5 "most useful" snippets out of the more than 50 who have been submitted.
Here's our selection:
Now on Twitter + More Code Snippets Incentives
Now on Twitter!
Better late than never, the three related sites (DSPRelated, FPGARelated and EmbeddedRelated) now have their Twitter accounts. If you are already on Twitter, please consider following. I'll make sure to keep the tweets interesting and informative. Plus, once in a while, I will tweet a link where the first x persons to visit will receive a gift (book, gift certificate, etc).