Memfault recently joined ModusToolbox™ & Friends and collaborated with Infineon’s team to build a tight integration between the ModusToolbox™ SDK and the Memfault platform. We wanted to write a piece to explain a bit more about what Memfault is, some use cases, and add some detail to our getting started guide for ModusToolbox™ & PSoC™ 6 chipsets.
Memfault is the first IoT reliability platform that gives developers a more scalable and sustainable process to transform how they develop, maintain, and improve IoT devices. We give engineers full visibility to know if devices are working, why devices are not working and the results of device updates. Memfault’s performance metrics, issue detection capabilities, and remote coredump viewer help you launch products faster and fix problems before they impact the complete device fleet.
How Memfault Works
The Memfault C SDK and web application enable remote debugging, performance monitoring, and device operations capabilities including OTA management. The SDK gets integrated into your device firmware and handles collecting critical information from common crashes such as hard faults, memory overflows, asserts, and custom device events. Metrics APIs enable easy, efficient capture of performance measurements you may like to track over time. The data is stored in a compact format and our API allows you to export it in defined chunks that fit the MTU size of your data transport to the cloud, which can be any type of connectivity, even through gateways or other cloud platforms. The data reaches the HTTP endpoint of the Memfault Cloud, a fully managed cloud application. There, the data is processed to surface insights, and fix and update devices.
Once integrated and devices begin self-reporting issues and their performance metrics, the benefits are achieved quickly. Memfault detects and groups issues by inspecting the data, and deduplicating, and merging the issues. As a result, you can quickly see how many devices are impacted by each issue:
Memfault eliminates the need to recreate these issues at your desk by giving you a debugging view of the device at the time of the issue. All issues are displayed in Memfault’s coredump viewer to highlight the exact problem that needs to be fixed. It works as if you had a hardwired debugger connected to the device at the time of the crash, eliminating weeks of reproducing the problem in the lab to find a root cause. The device may continue operation uninterrupted during this process. We not only capture the stack trace but exceptions, registers, locals, globals, statics, and even a raw memory map if you wish.
Memfault also provides performance monitoring with APIs to efficiently collect timeseries metrics that are often useful for understanding issues such as battery life, CPU and memory utilization, or to understand more about a device’s usage leading up to a crash:
You can track improvements by viewing metrics and issue charts at a device and fleet level and comparing across software and hardware versions.
At only ~4.5KB of code space and requiring 1.5KB of RAM, we make it so you can use this SDK in both test and production firmware. Not only is it small and light on the device, but it also works in low bandwidth connectivity over almost any type of connection and supports all firmware and hardware combinations. These design specifications ensure the Memfault platform will work within the constraints of most IoT devices, throughout the entire life of the devices.
As an example of our product being used in these ways, with Infineon products, check out our customer Latch and what challenges they solve with Memfault in this case study.
Memfault and ModusToolbox™ Setup
We’ve taken the Memfault C SDK and made it compatible as a middleware component for the ModusToolbox™ software suite and SDK. There are two options for users to get started with Memfault and ModusToolbox™: our example application or integrating with an existing ModusToolbox™ application. Here we’ll focus on experimenting with the example application in ModusToolbox™.
To get started with the example application using the Eclipse based IDE in ModusToolbox™:
Now that the example application is ready, let’s take a deeper look at what’s inside and what can be modified for your usage.
Memfault Initialization
The Memfault SDK requires a single function to be implemented for initialization, memfault_platform_boot. An implementation is automatically provided with our integration and called from the example application in main. The implementation of memfault_platform_boot does a few things:
The middleware integration contains built-in metrics to measure Wi-Fi connectivity and memory allocation. These can be configured with the following defines:
By default, the integration enables both.
The Wi-Fi built-in metrics include:
The memory allocation built-in metrics include:
These metrics are collected every heartbeat interval as defined by MEMFAULT_METRICS_HEARTBEAT_INTERVAL_SECS. We recommend the default period of 1 hour, but this can be reduced for debugging/testing purposes.
Below is a screenshot of my device’s metrics over the course of several hours. You can see that I had connectivity issues at several points while my device was running (I unplugged my local router to simulate).
Coredumps can be easily triggered and tested with the example ModusToolbox™ application. Included in the application is a group of CLI commands to simulate different failures for testing and learning about Memfault. Using the console exposed by your device, use one of the following commands to trigger a fault:
test_assert: Trigger memfault assert
test_busfault: Trigger a busfault
test_hardfault: Trigger a hardfault
test_memmanage: Trigger a memory management fault
test_usagefault: Trigger a usage fault
Once this data has been uploaded to Memfault, you should see a new issue created from this fault for the device:
The coredump contains information collected by the SDK, including information about the other threads running on the device, register and local variable values, and global and static data values. For more information on coredumps and other features, see Memfault’s documentation.
Memfault provides other features that are outside the scope of the example application. The next step after experimenting with our example application would be to add Memfault to an existing one.
You can get started immediately through our self-serve, publicly available code and documentation. We provide 100 free devices to Infineon customers with no time limit on the platform.
For other Infineon devices, the integration is similar. Follow Memfault’s general documentation for these integrations or reach out to support@memfault.com for more help.
To learn more about Memfault on our website, here are some recommendations:
Looking forward to helping you improve the reliability of your devices; let us know how we can help!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
We use cookies and similar technologies (also from third parties) to collect your device and browser information for a better understanding on how you use our online offerings. This enables us to optimize and personalize your experience with Infineon and to provide you with additional services and information based on your individual profile. Details are available in our privacy policy where you can also change your preferences on cookies at any time.
By technically required cookies we mean cookies without those the technical provision of the online service cannot be ensured. These include e.g. cookies supporting essential services like a smooth reproduction of video or audio footage. So called ‘functional cookies’ are also assigned belonging to this category. Functional cookies store information in order to provide you comfortable use of our online services (e.g. language selection). The legal basis for the processing of personal data by means of cookies of this category is Infineon’s legitimate interest. This includes, among other things, the interest in having a professional external presentation as well as an optimal balancing of the loads on the server due to technical reasons.
By performance and marketing cookies we mean cookies which are technically not required. We use performance and marketing cookies only if you have given us your prior consent. With such cookies, we collect information about how users interact with our website and which pages have been visited. This helps us to understand user activity on our website on an aggregated as well as on a personal level to provide you relevant content and services.