EmbeddedRelated.com

Reverse engineering wireless wall outlets

Fabien Le Mentec July 19, 2014
Introduction

I am improving the domotics framework that I described in a previous article://www.embeddedrelated.com/showarticle/605.php

I want to support wireless wall outlets, allowing me to switch devices power from a remote location over HTTP.

To do so, I could design my own wireless wall outlets and use a hardware similar to the previous one, based on the NRF905 chipset. The problem is that such a product would not be certified, and that would be an issue regarding the home insurance,...


Short Circuit Execution vs. Unit Testing

Stephen Friederichs July 7, 20141 comment

The key to effective communication is to say what you mean and avoid ambiguity.  Words and phrases with multiple meanings can confuse your audience and hinder communication. That’s why so many programmers prefer writing code to writing specifications: written human language introduces ambiguity and subsequently, confusion. Code only has one interpretation, period. This doesn’t, however, ensure that the right message is getting through. Code can, indeed, only do one thing,...


A wireless door monitor based on the BANO framework

Fabien Le Mentec June 10, 20145 comments
Introduction

I have been thinking for a while about a system to monitor the states of my flat and my garage doors from a remote place. Functionnaly, I wanted to monitor the state of my doors from a remote place. A typical situation is when I leave for holidays, but it can also be useful from the work office. To do so, I would centralize the information on a server connected on the Internet that I could query using a web browser. The server itself would be located in the appartement, where...


Using the C language to program the am335x PRU

Fabien Le Mentec June 7, 201481 comments
Introduction

Some weeks ago, I published an article on how we used the PRU to implement a power supply control loop having hard realtime constraints:

//www.embeddedrelated.com/showarticle/586.php

Writing this kind of logic in assembly language is not easy. First the assembly language itself may be difficult to learn depending on your background. Then, fixed and floating point arithmetics require lot of code. While macros help to handle the complexity, they still are error prone as you...


How to make a heap profiler

Yossi Kreinin May 23, 20141 comment

We'll see how to make a heap profiler. Example code for this post makes up heapprof, a working 250-line heap profiler for programs using malloc/free.

It works out of the box on Linux (tested on "real" programs like gdb and python). The main point though is being easy to port and modify to suit your needs. The code, build and test scripts are at github.

Why roll your own heap profiler?

  • It's easy! And fun, if you're that sort of person. What, not reasons enough? OK, how...

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


Unit Tests for Embedded Code

Stephen Friederichs March 5, 201411 comments

I originate from an electrical engineering background and my first industry experience was in a large, staid defense contractor. Both of these experiences contributed to a significant lack of knowledge with regards to software development best practices. Electrical engineers often have a backwards view of software in general; large defense contractors have similar views of software and couple it with a general disdain for any sort of automation or ‘immature’ practices.  While there...


Bad Hash Functions and Other Stories: Trapped in a Cage of Irresponsibility and Garden Rakes

Jason Sachs January 28, 20141 comment

I was recently using the publish() function in MATLAB to develop some documentation, and I ran into a problem caused by a bad hash function.

In a resource-limited embedded system, you aren't likely to run into hash functions. They have three major applications: cryptography, data integrity, and data structures. In all these cases, hash functions are used to take some type of data, and deterministically boil it down to a fixed-size "fingerprint" or "hash" of the original data, such that...


Implementing State Machines

Stephen Friederichs January 18, 20145 comments

State machines are a great way to design software but they can be difficult to implement well.To illustrate this I’ll develop a simple state machine then increase the complexity to demonstrate some of the difficulties

We’ve all washed dishes before - it’s easy isn’t it? Scrub, rinse, dry, scrub, rinse dry. Scrub the dish until all of the gunk is off of it, rinse until the soap is off, put it in the drying rack. If you want to design software to implement this you have options. You...


Understanding and Preventing Overflow (I Had Too Much to Add Last Night)

Jason Sachs December 4, 2013

Happy Thanksgiving! Maybe the memory of eating too much turkey is fresh in your mind. If so, this would be a good time to talk about overflow.

In the world of floating-point arithmetic, overflow is possible but not particularly common. You can get it when numbers become too large; IEEE double-precision floating-point numbers support a range of just under 21024, and if you go beyond that you have problems:

for k in [10, 100, 1000, 1020, 1023, 1023.9, 1023.9999, 1024]: try: ...

Tenderfoot: Introduction to Magic (Numbers that is...)

Matthew Eshleman May 10, 20173 comments

Once upon a time, while participating in a source code review, I stumbled across the following C code in a header file:

struct Foo { //various structure fields char string_buffer[45+3]; //buffer requires about 45 bytes };

My right eyebrow raised, I took a note, and continued with the code review, only to later stumble into this line of code in the body of a C function:

char * temp_string_buffer = (char*) malloc(45+3);

Again, I took a note on this function, and continued...


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.


Embedded Toolbox: Source Code Whitespace Cleanup

Miro Samek August 5, 2017

In this installment of my "Embedded Toolbox" series, I would like to share with you the free source code cleanup utility called QClean for cleaning whitespace in your source files, header files, makefiles, linker scripts, etc.

You probably wonder why you might need such a utility? In fact, the common thinking is that compilers (C, C++, etc.) ignore whitespace anyway, so why bother? But, as a professional software developer you should not ignore whitespace, because it can cause all sorts...


Is it a Bug or an Error?

Michael Barr January 31, 20184 comments

Probably you’ve heard the story of how Adm. Grace Hopper attached a moth that was dislodged from a relay in the Harvard Mark II mainframe to an engineering notebook and labeled it the “First actual case of bug being found.”

Designers of electronics, including Thomas Edison, had been using the term bug for decades. But it was mostly after this amusing 1947 event hat the use of words like “bugs” and “debugging” took off in the emerging software realm.

So why is it that if a...


The three laws of safe embedded systems

Michael J. Pont November 12, 20151 comment

This short article is part of an ongoing series in which I aim to explore some techniques that may be useful for developers and organisations that are beginning their first safety-related embedded project.


Kind of Buggy! The state machine fantastic//

Richard Dorfner August 31, 20112 comments

Over the years, I have had the opportunity to experience a lot of different kinds of coding mistakes. There were many that most programmers are familiar with, counting errors, indexing errors (the infamous 'off by one' bug), memory space sharing errors (A threading issue) as well as numerous others.  I ran into one recently that I wound up using an old trick to help find.

My current project is a Pan/Tilt camera that was, upon occasion, not homing properly in one axis. The camera is a...


Favorite Tools: C++11 User-defined literals

Matthew Eshleman November 14, 20161 comment

In many software domains units of measurement are frequently critical to the software's data processing requirements. Those same units, or rather the use of the wrong units, are often the source of bugs and disastrous mistakes. Although useful for other purposes, user-defined literals are an excellent addition to the C++11 standard and handy when working with units of measurement.

Suppose a device measures velocity. To help prevent errors, the software specification requires...


Introducing The VolksEEG Project

Steve Branam October 31, 2021
Introduction

The VolksEEG project is an open-source project with the goal of creating an electroenchephalogram (EEG) machine, fully cleared by the FDA for standard clinical use. All designs will be freely available for others to manufacture.

The project was founded by Alan Cohen, a medical device systems engineer with an electrical engineering/software (EE/SW) background in Boston, USA, and Dr. Bryan Glezerson


In Memoriam: Frederick P. Brooks, Jr. and The Mythical Man-Month

Jason Sachs November 20, 2022

It is with some sadness that I have read that Fred Brooks has passed away. Brooks (1931 - 2022) worked at IBM and managed a large team developing the IBM System/360 computers in the early 1960s. Brooks was thirty years old at the start of this project. He founded the Computer Science Department at UNC Chapel Hill in 1964, at the age of thirty-three, acting as its department chair for twenty years. He remained at IBM until 1965, however. During this one-year...


The Missing Agile Conversation

Steve Branam May 15, 2023

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.