As devices become increasingly connected to the Internet of Things (IoT), developers starting from scratch are realizing that it’s still not as straightforward as they would expect, particularly if schedules are tight and costs are limited. From choosing a trusted, secure, and well-supported development environment to selecting compatible software and hardware, it turns out that designing and building an IoT device still requires a wide range of skillsets.
What developers increasingly need is ready access to secure solutions, cloud connectivity libraries, an RTOS, and a compatible hardware and software development platform that provides readily integrated sensors, all in one scalable package.
This article discusses how IoT designers can rapidly prototype their products using the STMicroelectronics B-L4S5I-IOT01A Discovery Kit IoT Node. It examines the capabilities of the onboard microcontroller, the plethora of sensors and configuration options, and how to connect to Amazon Web Services (AWS) and quickly start building their prototype and end product.
Introduction to the B-L4S5I-IOT01A Discovery Kit IoT Node
The B-L4S5I-IOT01A Discovery board is a one-stop-shop development board that can be used to prototype nearly any embedded IoT device (Figure 1). The board has enough processing power, sensors, and expandability to make any embedded developer daydream about the applications they could build. The B-L4S5I-IOT01A board is based on the STM32L4S5VIT6 low-power Arm® Cortex®-M4 processor running at 120 megahertz (MHz), supported by 2 megabytes (Mbytes) of program flash and 640 kilobytes (Kbytes) of SRAM. The STM32L4S5VIT6 also has features ideally suited for IoT applications such as:
- A floating-point unit (FPU)
- A 14-channel dynamic memory access (DMA) controller
- An AES and HASH encryption hardware accelerator
- Advanced graphics features
- A 233 ULPMark CP energy benchmark score
Figure 1: The B-L4S5I-IOT01A is based on an Arm Cortex-M4 processor running at up to 120 MHz with 2 Mbytes of flash memory, 640 Kbytes of RAM, wireless connectivity, and multiple sensors. (Image source: STMicroelectronics)
Processing power and energy efficiency alone do not make an excellent rapid prototype platform. The discovery board also comes with wireless connectivity in the form of an 802.11b/g/n compliant Wi-Fi module (ISM43362-M3G-L44) from Inventek Systems and a Bluetooth 4.1 module from STMicroelectronics, as well as a range of sensors. These include two MP34DT01 digital omnidirectional microphones, one HTS221 capacitive digital sensor for relative humidity and temperature, and one LIS3MDL high-performance three-axis magnetometer.
The list above is by no means comprehensive: a more detailed description can be found here. Next, it’s important to examine the software tools and stacks available to accelerate development.
The STM32 ecosystem
The ecosystem surrounding any development board determines whether a team can create a rapid prototype or not. For example, to prototype an IoT device with the B-L4S5I-IOT01A, developers need access to a compiler, an integrated development environment (IDE), driver libraries, configuration tools, and software for firmware updates. The B-L4S5I-IOT01A Discovery board supports all these needs.
Many developers use Eclipse and the GNU C compiler for their development environment. STMicroelectronics provides a free tool, STM32CubeIDE (Figure 2), allowing developers to write and build their software projects. STM32CubeIDE enables access through various perspectives to a software development environment, a microcontroller configuration tool, and a debugging environment.
Figure 2: STM32CubeIDE provides developers with an IDE to create, configure and manage their IoT device’s embedded software. (Image source: Beningo Embedded Group)
STM32CubeIDE not only provides a way to create, build and manage software projects, it also has an interface to STM32CubeMx. STM32CubeMx is a microcontroller configuration tool that enables developers to configure clock trees, peripherals, sensors, and middleware. Developers configure their settings, and then the toolchain generates the drivers and configuration files, dramatically decreasing development time and helping the developer focus on their application code and not standard infrastructure code.
Beyond configuring and deploying a codebase, the STM32 ecosystem comes with several useful tools for developers working at the cutting edge. For example, developers looking to leverage machine learning in their applications can utilize STM32Cube.AI extension X-CUBE-AI, which provides teams with a streamlined framework for converting, validating, and running inferences on the STM32. For example, developers can train a model using TensorFlow Lite and then convert the model in just a few minutes to C code that runs on the microcontroller. In addition, there are extension packs with ready to run software that includes:
- FP-AI-FACEREC for facial recognition applications
- FP-AI-NANOEDG1 for condition monitoring applications
- FP-AI-VISION1 for image classification applications
- FP-AI-SENSING1 for audio and scene classification applications
Every IoT device should consider security, even during the rapid prototyping phase. Today’s web is teeming with non-stop attacks, security breaches, and exploitation of business and customer data. Therefore, any fast prototyping platform should have the capability to scale into a production system efficiently. The discovery board can leverage STMicroelectronics’ Secure Boot Secure Firmware Update (SBSFU) software stacks to provide developers with this capability. SBSFU is available in the X-CUBE-SBSFU function pack, which provides:
- Root-of-trust (RoT) services
- Secure key management services
- Cryptographic schemes
- Secure firmware update services
The ecosystem surrounding the B-L4S5I-IOT01A Discovery board is rich, with many available function packs and tools to help the developer get started quickly. Many IoT developers are interested in the X-CUBE-AWS package that provides everything necessary to connect to the cloud when using AWS. Let’s examine how a developer would go about doing it.
Connecting to the cloud
To get started with the cloud, a developer needs to download X-CUBE-AWS. The software package comes as a zip file with several projects designed to run on the B-L4S5I-IOT01A, such as:
These projects are located under:
With the AWS cloud project being found under:
The cloud project is available for STM32Cube IDE, Keil, and IAR. Of course, a developer could port these to other IDE’s, but these three are commonly used in the industry.
A developer doesn’t have to figure out how to get the project up and running independently. There are several valuable documents that can help them get started quickly. First, within the main project directory, there is a Release_Notes.html file. This file contains general information about the project along with limitations and valuable references.
Next, there is a getting started guide that describes how to connect to AWS using the project. This document describes how to connect to AWS along with stack and software information (Figure 3). The document also describes the software stacks in detail, which can help a developer understand how it is organized and the changes that will be necessary to connect the device to the cloud.
Figure 3: X-CUBE-AWS provides the firmware and application examples necessary to connect to AWS and develop an IoT Thing capable of connecting to AWS. (Image source: STMicroelectronics)
The easiest way to connect to the cloud is to run through the Getting Started document and follow the tutorial. In addition to the tutorial, there are several additional reference sources developers can use to get up to speed with the software package, including:
- FreeRTOS Next Steps
- OTA Update Users Guide
- Setting Up IoT Core Account and Credentials
Between these documents, developers can quickly get up and running with a cloud application that can be used as the foundation for their own IoT device application.
Tips and tricks for using the B-L4S5I-IOT01A Discovery Board
The B-L4S5I-IOT01A Discovery Board has many features and capabilities developers can leverage to prototype their embedded product rapidly. Below are several “tips and tricks” developers should keep in mind that can simplify and speed up their development, such as:
- Take full advantage of the X-CUBE-AWS to connect to AWS easily. The software package comes with FreeRTOS already ported to the development board; developers only need to provision the device to connect to the cloud.
- Carefully read through the getting started documentation. The documentation contains the steps necessary to perform a firmware update and connect to AWS.
- Experiment with the example over-the-air (OTA) update capabilities. The need to patch and update IoT devices in the field is a critical one. Developers should be aware of the capabilities and any limitations of secure firmware updates.
- Avoid starting from scratch by leveraging STMicroelectronic’s function packs, which help developers get a jump start on capabilities and device functionality. These function packs can dramatically accelerate development.
- Take the time to read through the STSAFE documentation and understand how secure elements can improve device security. Security must be built into a device from the start, so doing it during the rapid prototyping phase is a must.
Developers that follow these “tips and tricks” will find that they save quite a bit of time and grief when prototyping their application.
Developing an IoT connected device from scratch still has many obstacles and pitfalls that can delay schedules and lead to cost overruns. To avoid these issues, developers can leverage the B-L4S5I-IOT01A Discovery Board to prototype their connected applications rapidly. STMicroelectronics’ software stacks, expansion packs, and ecosystem provide developers with a one-stop-shop to easily integrate software and accelerate implementation. The B-L4S5I-IOT01A is also fully capable of modern device needs such as cloud connectivity, secure firmware booting with OTA, and even running basic machine learning applications.