An Introduction to Embedded Development
This blog is a series to provide an introduction to embedded development for the aspiring embedded developer. No prior embedded development experience will be assumed, but you should have a reasonable understanding of the C language and knowledge of basic electronics. It will focus on the TI MSP430, but present topics in a generic way that can be easily translated to other processors. Welcome!Hello, and welcome to my blog! This blog will be somewhat different from most...
MSP430 Launchpad Tutorial - Part 1 - Basics
TI's LaunchPad is a complete MSP430 development environment: all you have to do is download and install CCS IDE (login required), connect your G2231-ready LaunchPad to your computer with the included mini-usb cable, and you are ready to code!
Texas Instrument MSP430 LaunchPadSo, let's see how to start a new project in Code Composer Studio. This IDE is derived from Eclipse, so if you used it before you shouldn't have much problems.
We'll write a simple program that will...
Endianness and Serial Communication
Endianness is a consideration that is easily overlooked in the design of embedded systems. I myself am amply guilty of this oversight. It’s something you don’t ever have to worry about if you’re only working with a single processor or two processors that have the same endianness. You can even avoid it if you have two processors that have different endianness but never transmit data between themselves that consists of more than one byte. It’s easy to lull...
C Programming Techniques: Function Call Inlining
IntroductionAbstraction is a key to manage software systems as they increase in size and complexity. As shown in a previous post, abstraction requires a developper to clearly define a software interface for both data and functions, and eventually hide the underlying implementation.When using the C language, the interface is often exposed in a header '.h' file, while the implementation is put in one or more corresponding '.c' files.
First, separating an interface from its...
Debugging with Heartbeat LEDs
In this article I’ll discuss one of the most basic debugging tools in an embedded system: the heartbeat LED. Picture this: you’re developing your first program for a new microcontroller. You’ve written the code, configured the programmer, downloaded the HEX file and now... what Your program is running - isn’t it?
Truth is that it’s hard to tell with most embedded software. Compared to desktop or even server applications embedded software tend not to have very many...
Layout recomendations and tips for best performance against EMC
When making the layout of the circuit diagram, it is interesting to perform a preliminary analysis of several issues in order to minimize problems arising from electromagnetic compatibility.The analysis consists in:
Identify / Analyze components: This section will analyze the integrated components, as well as any recommendations it may have the manufacturer. We must also analyze the encapsulation possibilities which have the component.
LCD Control with an MCU
Controlling a liquid crystal display (LCD) to indicate a few ASCII characters should not be a big challenge as a project. That’s exactly what I thought when I decided to include a 2 line by 16 character display in my current project. My initial thought was. “How difficult could it be with all the resources on the internet and my embedded development expertise primarily in telecoms?” Let me tell you it is not as straightforward as I thought it would be and therefore I...
How to Build a Fixed-Point PI Controller That Just Works: Part II
In Part I we talked about some of the issues around discrete-time proportional-integral (PI) controllers:
- various forms and whether to use the canonical form for z-transforms (don't do it!)
- order of operation in the integral term: whether to scale and then integrate (my recommendation), or integrate and then scale.
- saturation and anti-windup
In this part we'll talk about the issues surrounding fixed-point implementations of PI controllers. First let's recap the conceptual structure...
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...
Embedded Software Creation II - European Normative & Legislation
In this post I will explain the European Normative. I will answer the main questions and I will be open to answer all the doubts any of you could have. Please leave a comment and I will answer if i could.
Why I need to look and accomplish some standards?The main reason is if you want to comercialize the product in the European Union, if exists any European Directive that cover the product, the product must be marked with the CE mark. For USA it work in the same way by the...
Arduino robotics #4 - HC-SR04 ultrasonic sensor
Arduino RoboticsArduino 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.Bellegram, a wireless DIY doorbell that sends you a Telegram message
A wireless button that uses the M5 STAMP PICO and Mongoose to send a Telegram message when pressed. The code is written in C
C Programming Techniques: Function Call Inlining
IntroductionAbstraction is a key to manage software systems as they increase in size and complexity. As shown in a previous post, abstraction requires a developper to clearly define a software interface for both data and functions, and eventually hide the underlying implementation.When using the C language, the interface is often exposed in a header '.h' file, while the implementation is put in one or more corresponding '.c' files.
First, separating an interface from its...
Introduction to Microcontrollers - Adding Some Real-World Hardware
When 2 LEDs Just Don't Cut It AnymoreSo far, we've done everything in this series using two LEDs and one button. I'm guessing that the thrill of blinking an LED has worn off by now, hard as that is to imagine. What's more, we've just about reached the limits of what we can learn with such limited I/O. We have come to the point where we need to add some hardware to our setup to continue with additional concepts and microcontroller...
How to make a heap profiler
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...
Favorite Tools: C++11 std::array
Many embedded software and firmware projects must be developed to high standards of reliability. To meet these reliability requirements, firmware project teams will consider many design tradeoffs. For example, an engineering team may avoid or outright ban the use of dynamic memory allocation, a feature typically accessed via the C library call "malloc" or the C++ allocator "new". When authoring software under such...
When a Mongoose met a MicroPython, part II
In the first part of this blog, we introduced this little framework to integrate MicroPython and Cesanta's Mongoose; where Mongoose runs when called by MicroPython and is able to run Python functions as callbacks for the events you decide in your event handler. Now we add MQTT to the equation, so we can subscribe to topics and publish messages right from MicroPython.
Coding - Step 0: Setting Up a Development Environment
Articles in this series:
- Coding Step 0 - Development Environments
- Coding Step 1 - Hello World and Makefiles
- Coding Step 2 - Source Control
- Coding Step 3 - High-Level Requirements
- Coding Step 4 - Design
You can easily find a million articles out there discussing compiler nuances, weighing the pros and cons of various data structures or discussing the optimization of databases. Those sorts of articles are fascinating reads for advanced programmers but...
C++ on microcontrollers 4 – input pins, and decoding a rotary switch
This blog series is about the use of C++ for modern microcontrollers. My plan is to show the gradual development of a basic I/O library. I will introduce the object-oriented C++ features that are used step by step, to provide a gentle yet practical introduction into C++ for C programmers. Reader input is very much appreciated, you might even steer me in the direction you find most interesting.
So far I...
NXP LPC17xx/40xx: Decoding the Part ID
This is the first blog of a number dealing with the NXP LPC17xx/40xx processor families and how to program them despite the lack of documentation. The next blog will deal with implementing the LPC17xx/40xx UART with interrupts properly, and a subsequent blog will show how to use the UART in RS485 Normal Multidrop Mode (NMM) with Auto Address Detection (AAD).
My company has decided on using the NXP LPC17xx/40xx processor line for all our embedded projects. Since...
Good old multiplexed keypad in an embedded system
Good old multiplexed keypad in embedded systems
(My www.embeddedrelated.com Blog No.1)
Touch-screens, rotary encoder switches and other navigational aids rule the user interface these days. Navigation through menus and sub-menus is child’s play as icons and thumbnails rule the screen.
Jumping from one screen to another, switching between programs and event notification pop-ups are made possible due to high...
Designing Embedded System with FPGA - 1
With the introduction of soft processors and related tools (like EDK from Xilinx), implementation of basic embedded system in FPGA is made easy. This requires very little or almost no knowledge of VHDL programming. Actually that’s how I started. If user is interested in taking full advantage of FPGA and its parallel processing power, then yes, detail understanding of soft processor, its peripheral bus and VHDL programming is required.
I will start with...
Finite State Machines (FSM) in Embedded Systems (Part 1) - There's a State in This Machine!
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.
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...
Lost Secrets of the H-Bridge, Part V: Gate Drives for Dummies
Learn the most important issues in power MOSFET and IGBT gate drives: - Transistor behavior during switching - Calculating turn-on and turn-off times - Passive components used between gate drive IC and transistor - Reverse recovery - Capacitively-coupled spurious turn-on - Factors that influence a good choice of turn-on and turn-off times - Gate drive supply voltage management - Bootstrap gate drives - Design issues impacting reliability
Coding Step 4 - Design
Articles in this series:
- Coding Step 0 - Development Environments
- Coding Step 1 - Hello World and Makefiles
- Coding Step 2 - Source Control
- Coding Step 3 - High-Level Requirements
- Coding Step 4 - Design
The last article in this series discussed how to write functional high-level requirements: specifications for what your software is supposed to do. Software design is the other side of the coin....
Getting Started With Zephyr: Devicetrees
This blog post provides an introduction to the "Devicetree", another unique concept in The Zephyr Project. We learn about the basic syntax of a device tree and how its structure and hierarchy mirror hardware, from the SoC to the final board. We also see how hardware described in a devicetree can be referenced and controlled in the source code of a Zephyr-based application.
Deeply embedded design example - Logic replacement
I have always believed that some of the low-cost, low-pin count, low-resource microprocessors would make an excellent choice for the replacement of discrete logic components. In these cases the deeply embedded microprocessor would become less of a general purpose computer and more of a logic replacement, providing a prescribed function with no connection to the outside world. In a world of bigger, faster and more expensive, it is a pleasant change of pace...
C++ on microcontrollers 3 – a first shot at an hc595 class with 8 output pins
This blog series is about the use of C++ for modern microcontrollers. My plan is to show the gradual development of a basic I/O library. I will introduce the object-oriented C++ features that are used step by step, to provide a gentle yet practical introduction into C++ for C programmers. Reader input is very much appreciated, you might even steer me in the direction you find most interesting.
In the first part of...
Designing Embedded Systems with FPGA-2
In last part, we created hardware design of basic system. The next step is to generate (compile) hardware design. Compiled hardware design is known as bit-stream andstored in *.bit file. To compile hardware, use hardware->generate hardware tab. The complete hardware design generation takes several seconds to several minutes depending on computer speed and design complexity. In back ground, the whole design process involves many different steps including synthesis, placement, routing and...