Intro to Embedded Basics
As an engineer there are few things that are as exciting as developing a new embedded system. With each passing year, not only are systems becoming more complex and offering more features but the development timelines are drastically shrinking as well.
The microcontrollers that engineers use day in and day out are evolving at a fantastic rate. The once simple 8051 has been replaced by a plethora of state of the art MCU’s that offer every enhanced peripheral device that can be imagined.
The peripherals within these MCU’s have become very complex themselves with 10’s to 100’s of registers requiring setup in order to make the peripheral behave properly for the intended application. Specialization of a processor has been replaced with powerful generic features that allow each processor to be applied to a nearly infinite number of applications.
The very concepts of how embedded software should be written are evolving at as fast a pace as the hardware. At one time embedded software consisted of a few modules with global variables everywhere! The focus of software development was on getting something that functioned.
Today the spaghetti model of software development has been replaced by the much tastier Lasagna model. Software is written in functional layers such as driver and application layers but it too can get out of hand when layer after layer is stacked upon itself adding complexity to the code and making it difficult to understand.
With so many advances occurring within our industry, it is sometimes very easy to lose sight of the fundamentals of how a processor really works and how software should be written for it. The latest and greatest techniques are often time consuming and complicated to implement; a luxury that the average engineer typically doesn’t have.
Recent trends in abstraction and object oriented programming obscure the engineers view of the registers which often leaves the engineer with an uneasy feeling. After all, isn’t an engineer supposed to care about the bits? To an engineer, it is critical that we don’t lose sight of the bits. If we do, the bridging of hardware and software knowledge that is embodied by the embedded engineer becomes broken and the result is a polarized engineer who once again either only understands the hardware or software but not both!
We absolutely want to use the latest and greatest design patterns, architectures and processors; however, a method should be used that allows the engineer to keep the low level workings of the microcontroller in mind.
One of the primary purposes of this blog is to illuminate the inner workings of microcontrollers and how the latest and greatest software techniques can be used to develop reusable code that decreases development time, cost and increases the visibility of the bit level while maintaining an appropriate level of abstraction.
We’ll take a deep dive into how the peripherals work, what their pit falls are and how to squeeze every bit of performance out of them. We will look at some of the fundamental and often misunderstood concepts within C and how these constructs can be used to develop re-usable and easily understood code.
A number of techniques will be presented to demonstrate how to setup different peripherals and how to move the work load of the system from the CPU to the peripherals. With a little luck, we’ll not only explore the interesting world where hardware meets software but also become experts of both.