Design News is part of the Informa Markets Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.

Simplified Software Development Using MCU Configurators

Adobe Stock AdobeStock_58474537_1540-800.jpeg
MCU configurators find growing acceptance in software development. But why?

When I first started writing embedded software, nearly every project started the same. For the first 3 – 6 months, every single day was spent pouring through microcontroller datasheets and writing a driver for each peripheral that was going to be used on a project. It was a lot of fun. Every microcontroller worked slightly differently than every other and a lot could be learned by observing the differences between how one company implemented a USART versus how another one did. While these activities were eye-opening for a young engineer, by the time a developer has written their third or fourth USART driver, the activity starts to become not only less interesting but a hindrance to getting started on the application code. This is where modern-day microcontroller configurators have really started to shine.

A microcontroller configurator is a toolchain component that allows a developer to setup microcontroller peripherals through a nice graphical user interface which in turn generates all the peripheral control code that would have otherwise been written by hand. A microcontroller configurator can dramatically reduce that 3 – 6 months driver development schedule down to a few weeks or less without the need to dig through a thousand pages of technical reference manuals to understand every register bit. Modern configurators don’t just set register values but also provide driver hooks that completely abstract out the low-level hardware.

Microcontroller configurators are by no means a new invention. They’ve been around for at least a decade or more. I recall working with early versions of Freescale Processor Expert on S12X microcontrollers. Back then, configurators were great for understanding the microcontroller and how its peripherals worked. The code they generated though was difficult to read and maintain which was why we would use it for rapid prototyping and then leverage it to handwrite our drivers.

Today’s configuration tools though have become quite sophisticated and, in many instances, will meet coding standards such as MISRA-C. In fact, some configurators generate code that reaches quality levels beyond what I see developers hand-coding. In any event, there is a trend in the microcontroller space to minimize the developers need to understand the low-level hardware and instead, help them to get up and running with their application code sooner rather than later. This makes a lot of sense given that many modern microcontrollers have grown to levels of sophistication that could require upwards of a year to understand and write code for. Why would a company want to support all that effort, especially if they can get quality code generated from a configuration tool?

There are quite a few configurator tools out there but so far, the ones I’ve encountered have all been produced by the microcontroller manufacturer. For example, Microchip has the Microchip Harmony Configurator, ST Microelectronics has STM32CubeMx, and so on and so forth. These tools usually integrate into the manufacturer's IDE in some way in order to provide developers with a seamless experience switching between writing their application code and configuring their microcontrollers peripherals and driver interfaces. Every tool looks a little bit different, but since I’ve recently been playing with Microchips Harmony Configurator (MHC), I’ll use it as an example.

A big advantage of these configurator tools is their ability to provide a visual mechanism for configuring the microcontroller. For example, the view below demonstrates how the MHC provides a visual project graph. Developers can easily see which components they have included in their project in addition to connecting dependencies between modules. 

Each of these components in turn can then be selected and configured using a simple check box or dropdown system. For example, the configuration menu for FreeRTOS can be seen in the image below:

FreeRTOS, Jacob BeningoFreeRTOS-Config-Menu.png

Configuration menu for FreeRTOS.

This interface is far easier to use and configure than having to go into a header file and bounce back and forth between the documentation to figure out which definitions need to be added in order to get the feature set that is desired. Once the settings are configured, the code is generated by simply clicking a “generate code” button which generates the code into the project’s directory.

Leveraging a microcontroller configurator can dramatically accelerate software development by decreasing the time spent on setting up drivers and configuring the microcontroller. Developers do need to spend some time getting over the learning curve for the toolchain though. I’ve found that a lot of these tools can be learned within a few days once the proper resources are found. The learning curve usually starts steep, but once the core concept is learned, there is an aha moment that dramatically increases the configuration speed. While each tool is different, they are all designed to help developers get started on their application code sooner rather than later.  

Jacob Beningo is an embedded software consultant who currently works with clients in more than a dozen countries to dramatically transform their businesses by improving product quality, cost, and time to market. He has published more than 200 articles on embedded software development techniques, is a sought-after speaker and technical trainer, and holds three degrees which include a Master of Engineering from the University of Michigan. Feel free to contact him at jacob@beningo.com, at his website www.beningo.com, and sign-up for his monthly Embedded Bytes Newsletter.

Hide comments
account-default-image

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish