EmbeddedRelated.com
Memfault Beyond the Launch

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.


The RTOS minefield

Colin Walls February 26, 2024

Choosing an RTOS is challenging both technically and when assessing suppliers.


Using (Apache) NuttX USERLED Subsystem

Alan C Assis February 19, 2024

In the previous article (https://embeddedrelated.com/showarticle/1623.php) we saw how to use GPIOs on NuttX testing on RaspberryPi Pico as example. In that article we used the GPIO output to control an LED, but there is a better way to do that. Of course, NuttX has an LED subsystem similar to Linux LED subsystem: it is called USERLED. Today we will see how to control LEDs using NuttX's USERLED subsystem.

The main advantage of using the USERLED subsystem instead of controlling the LEDs...


3D printing for embedded development

Ido Gendel February 19, 2024

Used mostly for creating little plastic objects, the desktop 3D printer is not an obvious addition to the embedded developer's toolbox. However, if you're looking for more reasons to get one, or already have one that's mostly gathering dust, here are a couple of embedded-related ways to get more value out of it.


Unraveling the Enigma: Object Detection in the World of Pixels

Charu Pande February 8, 2024

Exploring the realm of embedded systems co-design for object recognition, this blog navigates the convergence of hardware and software in revolutionizing industries. Delving into real-time image analysis and environmental sensing, the discussion highlights advanced object detection and image segmentation techniques. With insights into Convolutional Neural Networks (CNNs) decoding pixel data and autonomously extracting features, the blog emphasizes their pivotal role in modern computer vision. Practical examples, including digit classification using TensorFlow and Keras on the MNIST dataset, underscore the power of CNNs. Through industry insights and visualization aids, the blog unveils a tapestry of innovation, charting a course towards seamless interaction between intelligent embedded systems and the world.


There's a State in This Machine!

Massimiliano Pagani February 5, 20243 comments

An introduction to state machines and their implementation. Working from an intuitive definition of the state machine concept, we will start with a straightforward implementation then we evolve it into a more robust and engineered solution.


How Embedded Linux is used in Spacecrafts !

George Emad February 1, 20246 comments

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.


Getting Started With Zephyr: Bluetooth Low Energy

Mohammed Billoo January 29, 2024

In this blog post, I show how to enable BLE support in a Zephyr application. First, I show the necessary configuration options in Kconfig. Then, I show how to use the Zephyr functions and macros to create a custom service and characteristic for a contrived application.


++i and i++ : what’s the difference?

Colin Walls January 25, 20242 comments

Although the ++ and -- operators are well known, there are facets of their operation and implementation that are less familiar to many developers.


Using GPIO in (Apache) NuttX RTOS

Alan C Assis January 21, 20243 comments

In the previous article (https://embeddedrelated.com/showarticle/1610.php) we saw how to compile and run NuttX on three low cost boards (RaspberryPi Pico, ESP32-Devkit and STM32F4Discovery). Today we will see how to use GPIO pins and read and write logic level signals from/to the MCU pins.

Everybody knows that blinking a LED is the "Hello World" program of embedded system engineer. Controlling a GPIO we can do exactly that! Although it is important to know that NuttX also has a LED...


How to Estimate Encoder Velocity Without Making Stupid Mistakes: Part I

Jason Sachs December 27, 201230 comments

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...


Chebyshev Approximation and How It Can Help You Save Money, Win Friends, and Influence People

Jason Sachs September 30, 201220 comments

Well... maybe that's a stretch. I don't think I can recommend anything to help you win friends. Not my forte.

But I am going to try to convince you why you should know about Chebyshev approximation, which is a technique for figuring out how you can come as close as possible to computing the result of a mathematical function, with a minimal amount of design effort and CPU power. Let's explore two use cases:

  • Amy has a low-power 8-bit microcontroller and needs to compute \( \sqrt{x} \)...

My Love-Hate Relationship with Stack Overflow: Arthur S., Arthur T., and the Soup Nazi

Jason Sachs February 15, 201552 comments

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...


Ten Little Algorithms, Part 2: The Single-Pole Low-Pass Filter

Jason Sachs April 27, 201516 comments

Other articles in this series:

I’m writing this article in a room with a bunch of other people talking, and while sometimes I wish they would just SHUT UP, it would be...


Thermistor signal conditioning: Dos and Don'ts, Tips and Tricks

Jason Sachs June 15, 201118 comments

In an earlier blog entry,  I mentioned this circuit for thermistor signal conditioning:

It is worth a little more explanation on thermistor signal conditioning; it's something that's often done poorly, whereas it's among the easiest applications for signal conditioning.

The basic premise here is that there are two resistors in a voltage divider: Rth is the thermistor, and Rref is a reference resistor. Here Rref is either R3 alone, or R3 || R4, depending on the gain...


VHDL tutorial - part 2 - Testbench

Gene Breniman October 30, 20073 comments

In an earlier article I walked through the VHDL coding of a simple design. In this article I will continue the process and create a test bench module to test the earlier design. The Xilinx ISE environment makes it pretty easy to start the testing process. To start the process, select "New Source" from the menu items under "Project". This launches the "New Source Wizard". From within the Wizard select "VHDL Test Bench" and enter the name of the new module (click 'Next' to...


Zebras Hate You For No Reason: Why Amdahl's Law is Misleading in a World of Cats (And Maybe in Ours Too)

Jason Sachs February 27, 20171 comment

I’ve been wasting far too much of my free time lately on this stupid addicting game called the Kittens Game. It starts so innocently. You are a kitten in a catnip forest. Gather catnip.

And you click on Gather catnip and off you go. Soon you’re hunting unicorns and building Huts and studying Mathematics and Theology and so on. AND IT’S JUST A TEXT GAME! HTML and Javascript, that’s it, no pictures. It’s an example of an


Using the Beaglebone PRU to achieve realtime at low cost

Fabien Le Mentec April 25, 20148 comments
Introduction

I 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...


Coroutines in one page of C

Yossi Kreinin August 20, 201316 comments

A coroutine is a function that you can jump back into after returning from it - and it remembers where it was in the code, and all the variables. This is very useful at times.

One use is generating a sequence of values. Here's how you can generate all the x,y pairs in a 2D range in Python:

def iterate(max_x, max_y): for x in range(max_x): for y in range(max_y): yield x,y for x,y in iterate(2,2): print x,y

This prints:

0 0 0 1 1 0 1 1

The yield keyword is like...


StrangeCPU #1. A new CPU

Victor Yurkovsky February 24, 20136 comments

Summary: In this multi-part series I will share with you a design, implementation notes and code for a slightly different kind of a CPU featuring a novel token machine that resolves an 8-bit token to pretty much any address in a 32-bit or even 64-bit address space, using not much more than an adder.

Table of Contents:
  • Part 1: A new CPU - technology review, re-examination of the premises;  StrangeCPU concepts; x86 notes.

Embedded Online Conference 2021 - Watch the Speakers Share their Thoughts on the Value for Attendees

Stephane Boucher May 4, 20212 comments

Over the last few weeks, we've had a chance to chat with some of the speakers at the upcoming Embedded Online Conference.  We asked them to share their thoughts on conferences and the Embedded Online Conference in particular.  Here are their answers edited together in one video:

  

If you are not registered yet for the conference but are considering it, please make sure to use the promo code ER149 to save more than 40% on your registration...


8 Weeks - 8 Giveaways!

Stephane Boucher March 10, 2021

If for some reason, you've been putting off registering for the upcoming 2021 Embedded Online Conference, here are 8 good reasons to register today.

The idea is simple; if you are registered for the conference by the 'raffle date' for any of the following giveaways, you'll automatically be entered into the draw.

So for instance, if you are already registered for the conference or register before March the 22nd, you'll be automatically entered into the 8 draws...


Announcing the 2021 Embedded Online Conference!

Stephane Boucher January 27, 20211 comment

Once again this year, Jacob Beningo and I are putting together the Embedded Online ConferenceLast year's edition was a very rewarding experience, with over 6,000 registrants, fantastic & insightful talks, and lots of positive feedback.  For this year's edition, we are delighted to announce that none other than Jack Ganssle will be giving a Keynote presentation about the 50th anniversary of the Microprocessor.

The 2021 Embedded Online Conference will...


The DSP Online Conference - Right Around the Corner!

Stephane Boucher September 20, 20201 comment

It is Sunday night as I write this blog post with a few days to go before the virtual doors of the very first DSP Online Conference open..

It all started with a post in the DSPRelated forum about three months ago.  We had just had a blast running the 2020 Embedded Online Conference and we thought it could be fun to organize a smaller event dedicated to the DSP community.  So my goal with the post in the forum was to see if...


Already 3000+ Attendees Registered for the Upcoming Embedded Online Conference

Stephane Boucher February 14, 2020

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...


Free Goodies from Embedded World - Full Inventory and Upcoming Draw Live-Streaming Date

Stephane Boucher March 22, 20191 comment

Chances are that you already know that I went to Embedded World a few weeks ago and came back with a bag full of "goodies".  Initially, my vision was to do a single draw for one person to win it all, but I didn't expect to come back with so much stuff and so many development kits.   Based on your feedback, it seems like you guys agree that It wouldn't make sense for one person to win everything as no-one could make good use of all the boards and there would be lots of...


Free Goodies from Embedded World - What to Do Next?

Stephane Boucher March 6, 20194 comments

I told you I would go on a hunt for free stuff at Embedded World in order to build a bundle for someone to win.


Back from Embedded World 2019 - Funny Stories and Live-Streaming Woes

Stephane Boucher March 1, 20191 comment

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...

Spread the Word and Run a Chance to Win a Bundle of Goodies from Embedded World

Stephane Boucher February 21, 2019

Do you have a Twitter and/or Linkedin account?

If you do, please consider paying close attention for the next few days to the EmbeddedRelated Twitter account and to my personal Linkedin account (feel free to connect).  This is where I will be posting lots of updates about how the EmbeddedRelated.tv live streaming experience is going at Embedded World.

The most successful this live broadcasting experience will be, the better the chances that I will be able to do it...


Launch of EmbeddedRelated.tv

Stephane Boucher February 21, 2019

With the upcoming Embedded Word just around the corner, I am very excited to launch the EmbeddedRelated.tv platform.  

This is where you will find the schedule for all the live broadcasts that I will be doing from Embedded World next week.  Please note that the schedule will be evolving constantly, even during the show, so I suggest your refresh the page often.  For instance, I am still unsure if I will be able to do the 'opening of the doors' broadcast as...


Memfault Beyond the Launch