Almost all of Silicon Labs Starter/Development Kits include an onboard J-Link debugger, which is great to not only debug and flash your embedded application, but also to run SystemView.
SystemView as you probably know is the tool to record and analyze your Micrium OS Kernel events in real time.
However, the onboard J-Link can be slow depending on the rate of kernel events that your embedded application is creating. Overflow events occur when the SystemView buffer on your embedded target is full.
In this blog I'm gonna discuss the basic steps to prevent overflows and then I will describe the ultimate way to prevent overflows.
1. Increase the buffer size to store the events:
Open the configuration file SEGGER_SYSVIEW_Conf.h and set the buffer size to 4096 as shown below:
#define SEGGER_SYSVIEW_RTT_BUFFER_SIZE 4096
2. In case you are running Simplicity Studio, close Simplicity Studio and let SystemView run by itself.
3. In case you are running Probe, close Probe and let SystemView run by itself.
4. Open the configuration file os_cfg_trace.h and decrease the number of events by disabling the following features:
#define OS_CFG_TRACE_API_ENTER_EN DEF_DISABLED #define OS_CFG_TRACE_API_EXIT_EN DEF_DISABLED
5. If you are still having overflows after making the changes above, then the ultimate way to prevent overflows is to buy a much faster External J-Link from SEGGER: https://www.segger.com/products/debug-probes/j-link/
Most of our Starter Kits have a Debug Connector that you can use to connect the external J-Link.
The following section describes how to connect your external J-Link to a Silicon Labs Starter Kit.
1. First you need to configure your Starter Kit to reroute the debugging circuitry to the external debug connector.
Open Simplicity Studio, select your Starter Kit, locate the section Debug Mode: MCU and then press the link Change as shown in the image below:
2. You may be asked to download an adapter firmware image. If so, press the button Yes.
3. The default Debug Mode is called MCU which means that your debugger is the Onboard J-Link.
4. Select from the drop-down the option IN which means that your debugger is an External J-Link as shown in the image below:
5. Connect your external J-Link to the debug connector on your Silicon Labs Starter Kit.
Depending on your kit, it may be one of the ones shown below.
The J-Link 19-pin 0.05" Cortex-M Debug Connector shown in Figure 3 may require a J-Link 19-pin Cortex-M Adapter available from SEGGER.
On the other hand, the standard 20-pin 0.1" JTAG Debug Connector shown in Figure 4 does not require any adapters and can be connected directly to your external J-Link.
For more information on how to configure your Starter Kit in the appropriate debugging mode, please consult your Starter Kit's User's Guide, the section On-Board Debugger, Debug Modes.
SystemView Installer: https://www.segger.com/downloads/free-utilities/#SystemView
SystemView User's Manual: https://www.segger.com/downloads/free-utilities/#Manuals
J-Link Debug Probes: https://www.segger.com/products/debug-probes/j-link/
J-Link 19-pin Cortex-M Adapter: https://www.segger.com/products/debug-probes/j-link/accessories/adapters/19-pin-cortex-m-adapter/
Whether you are currently running your embedded application on Silicon Labs hardware or other semiconductor, the migration path is the same as illustrated in Figure 1.
You should start from a working Micrium OS example and then move your embedded application over to the example project.
Once you move your embedded application to the Micrium OS baseline example project, you need to change the code that calls the FreeRTOS API.
The purpose of the attached PDF document is to describe the differences between the two kernels, offer plenty of side-by-side examples and mapping tables to help you in the process of migrating your embedded application.
If you’re planning to develop IoT applications for the EFM32 Giant Gecko or Pearl Gecko, you’re probably already thinking about using a real-time operating system.
It’s quite true that many embedded developers can get by with less sophisticated software based on a simple loop. But the latest EFM32 microcontrollers are packed with complex peripherals that require correspondingly complex application software. And designing IoT devices means dealing with both elevated user expectations and challenging design requirements. All this means that it’s become increasingly difficult for your projects to succeed without an operating system.
So how to get started? It can be daunting to make the sudden jump from bare-metal programming to kernel-based application development. So help you overcome that hurdle, we're producing a ten-episode video series to help smooth the way: Getting Started with Micrium OS.
The series is hosted by Matt Gordon, who has spent more than 10 years helping developers learn how to maximize the potential of the Micrium real-time operating system. He helped establish the Micrium training program, and is currently RTOS Product Manager at Silicon Labs.
The first episodes in the series starts with some basic information about what a kernel does and how kernel-based applications are structured. Matt covers initialization, how the kernel performs task scheduling, and how context switches pass control of the CPU from one task to another. Later in the series, Matt will discuss synchronization, resource protection, and inter-task communication. The series will leave you with a cohesive picture of real-time kernels and Micrium OS.
That’s not all: this series is supplemented with some of the best developer documentation ever produced for embedded systems programming. You can visit https://doc.micrium.com to learn much more about kernel-based application development and the networking and communication stacks that make up Micrium OS.
The Micrium OS kernel is available for free download through Simplicity Studio v4. To download and to find out more about Micrium OS, visit: https://www.silabs.com/support/getting-started/micrium-os
To find the series on YouTube, visit: https://goo.gl/JQ4UaV
And be sure to subscribe to the Silicon Labs YouTube channel to receive notifications of new episodes! https://www.youtube.com/user/ViralSilabs
Check out the first video in the series here:
Morrie Altmejd, a senior staff engineer at Silicon Labs, wrote this article that recently appeared in Electronic Products Magazine.
Designing and implementing an optical heart rate monitoring (HRM) system, also known as photoplethysmography (PPG), is a complex, multidisciplinary project. Design factors include human ergonomics, signal processing and filtering, optical and mechanical design, low-noise signal receiving circuits and low-noise current pulse creation.
Wearable manufacturers are increasingly adding HRM capabilities to their health and fitness products. Integration is helping to drive down the cost of sensors used in HRM applications. Many HRM sensors now combine discrete components such as analog front ends (AFE), photodetectors and light-emitting diodes (LEDs) into highly integrated modules. These modules enable a simpler implementation that reduces the cost and complexity of adding HRM to wearable products.
Wearable form factors are steadily changing too. While chest straps have effectively served the health and fitness market for years, HRM is now migrating to wrist-based wearables. Advances in optical sensing technology and high-performance, low-power processors have enabled the wrist-based form factor to be viable for many designs. HRM algorithms also have reached a level of sophistication to be acceptable in wrist form factors. Other new wearable sensing form factors and locations are emerging, such as headbands, sport and fitness clothing, and earbuds. However, the majority of wearable biometric sensing will be done on the wrist.
No two HRM applications are alike. System developers must consider many design tradeoffs: end-user comfort, sensing accuracy, system cost, power consumption, sunlight rejection, how to deal with many skin types, motion rejection, development time and physical size. All of these design considerations impact system integration choices, whether to use highly integrated module-based solutions or architectures incorporating more discrete components.
Figure 1 shows the fundamentals of measuring heart rate signals, which depend on the heart rate pressure wave being optically extracted from tissue. Figure 1 shows the travel path of the light entering the skin. The expansion and contraction of the capillaries, caused by the heart rate pressure wave, modulates the light signal injected into the tissue by the green LEDs. The received signal is greatly attenuated by the travel through the skin and is picked up by a photodiode and sent to the electronic subsystem for processing. The amplitude modulation due to the pulse is detected (filtering out motion noise), analyzed and displayed
Figure 1. Principles of operation for optical heart rate monitoring.
A fundamental approach to HRM system design uses a custom-programmed, off-the-shelf microcontroller (MCU) that controls the pulsing of external LED drivers and simultaneously reads the current output of a discrete photodiode. Note that the current output of the photodiode must be converted to voltage to drive most analog-to-digital (A/D) blocks. The Figure 2 schematic shows the outline of such a system. Note that the I-to-V converter creates a voltage equal to VREF at 0 photodiode current, and the voltage decreases with increasing current.
The current pulses generally used in heart rate systems are between 2 mA and 300 mA depending on the color of the subject’s skin and the intensity of sunlight with which the desired signal needs to compete. The infrared (IR) radiation in sunlight passes through skin tissue with little attenuation, unlike the desired green LED light, and can swamp the desired signal unless the green light is very strong or unless an expensive IR blocking filter is added. Generally speaking, the intensity of the green LED light where it enters the skin is between 0.1x and 3x the intensity of sunlight. Due to heavy attenuation by the tissue, the signal that arrives at the photodiode is quite weak and generates just enough current to allow for a reasonable signal-to-noise ratio (SNR) (70 to 100 dB) due to shot noise even in the presence of perfect, noise-free op amps and A/D converters. The shot noise is due to the finite number of electrons received for every reading that occurs at 25 Hz. The photodiode sizes used in the design are between 0.1 mm2 and 7 mm2. However, above 1 mm there are diminishing returns due to the effect of sunlight.
Figure 2. The basic electronics required to capture optical heart rate.
The difficult and costly function blocks to implement in an optical heart rate system design, as shown in Figure 2, are the fast, high-current V-to-I converters that drive the LED, a current to voltage converter for the photodiode and a reliable algorithm in the MCU that sequences the pulses under host control. A low-noise (75 - 100 dB SNR) 300 mA LED driver that can be set to very low currents down to 2 mA while still creating very narrow light pulses down to 10 µs is an expensive block to achieve with discrete op amps.
The narrow pulses of light down to 10 µs shown in Figure 2 allow the system to tolerate motion and sunlight. Typically two fast light measurements are made for each 25 Hz sample. One measurement is taken with the LEDs turned off and one with the LEDs turned on. The calculated difference removes the effect of ambient light and gives the desired raw optical signal measurement that is, most importantly, insensitive to flickering background light.
The short duration of the optical pulses both allows and requires a relatively strong light pulse. It is essential to stay brighter than the sunlight signal, which may be present and not allow the PPG signal carrier to be dwarfed by the sunlight signal. If the sunlight signal is larger than the PPG carrier, then although it may be removed by subtraction, the signal can be so large that external modulation such as swinging an arm in and out of shadow can create difficult-to-remove artifacts. As a result, systems that use low-current LED drivers and large photodiodes to compensate suffer severely from motion artifacts in bright light situations
Much of the desired HRM sensing functionality is available pre-designed and integrated into a single device. Packing most of this functionality into one piece of silicon results in a relatively small 3 mm x 3 mm package that can even integrate the photodiode (PD) itself.
Figure 3 shows an example of a schematic with an Si118x optical sensor from Silicon Labs. This HRM design is relatively easy to implement. The engineer just needs to focus on the optical portion of the design, which includes optical blocking between the parts on the board and coupling the system to the skin.
Figure 3. An integrated heart rate sensor requiring only external LEDs.
While the approach shown in Figure 3 results in a high-performance HRM solution, it is not as small or power efficient as some designers would like. To achieve an even smaller solution, the LED die and the control silicon must be integrated into a single package that incorporates all essential functions including the optical blocking and the lenses that improve the LED output. Figure 4 illustrates this more integrated approach, based on a Silicon Labs Si117x optical sensor.
No external LEDs are required for this HRM design. The LEDs and photodiode are all internal to the module, which can be installed right below the optical ports at the back of a wearable product such as a smartwatch. This advantageous approach enables a shorter distance between the LEDs and the photodiode than is possible with a discrete design. The reduced distance allows operation at extremely low power due to lower optical losses traversing the skin.
Integrating the LEDs also addresses the issue of light leakage between the LEDs and the photodiode. As a result, the designer does not have to add optical blocking to the printed circuit board (PCB). The alternative to this approach is to handle the blocking with plastic or foam inserts and special copper layers on the PCB.
Figure 4. A highly integrated HRM sensor module incorporating all essential components.
There is one more part of an HRM design that the developer does not necessarily need to create: the HRM algorithm. This software block residing on the host processor is quite complex due to the signal corruption that occurs during exercise and motion in general. End-user motion often creates its own signal that spoofs the actual heart rate signal and is sometimes falsely recognized as the heart rate beat.
If a wearable developer or manufacturer does not have the resources to develop the algorithm, third-party vendors provide this software on a licensed basis. Silicon Labs also offers a heart rate algorithm for its Si117x/8x optical sensors that can be compiled to run on most host processors.
It is up to the designer to decide how much integration is right for the HRM application. The developer can simplify the design process and speed time to market by opting for a highly integrated module-based approach using a licensed algorithm. Developers with in-depth optical sensing expertise, time and resources may opt to use separate components (sensors, photodiodes, lenses, etc.) and do their own system integration, and even create their own HRM algorithm. Ultimately, when it comes to HRM system design, the developer has a choice of doing it all or purchasing it all.
For the upcoming Embedded World tradeshow in Nuremberg, Germany, the Silicon Labs MCU team is showing off some unique ways to ease the challenges of developing cloud-connected applications. The demo consists of the EFM32 Giant Gecko 11 MCU, which is running Micrium OS and connects to Amazon Web Services via the new XBee3 cellular module from Digi International.
This particular demo is quite simple – a closed-loop system with an MCU monitoring a temp sensor and controlling a fan. However, the real-world use cases that these building blocks and tools can scale to serve are much more profound.
For example, many smart city applications including bridge sensors, parking meters, waste management sensors, and others often consist of portable sensor devices that require seamless long-range connectivity to the cloud. They may be battery powered with user demands of 10+ year battery life. They may have lots of sensor inputs and extra features like button inputs and local displays. Finally, they might need to be designed quickly, but with a long field-upgradeable lifetime in mind. These are the types of applications that this demo speaks to, with Micrium OS, Giant Gecko 11, and Digi’s XBee3.
Micrium OS is running on the MCU and helps modularize the application functions. It’s helping the MCU maintain communication with the cellular module, monitor the temp sensor, drive the TFT display, and update control settings when local push buttons are pressed. By using Micrium, these various pieces can easily be divided and coded in parallel without having to worry about any messy integration at the end. In fact, this is exactly what the Embedded World demo team did – three different development teams in three different cities built the demo, and Micrium was the underlying glue that made it seamlessly come together.
Another challenge being addressed here is the connectivity piece. As devices are now adding wireless connectivity, there are lots of hurdles to clear: RF design in some cases, FCC certifications, understanding wireless networking, security, and more. Not only does Silicon Labs offer homegrown, low power SoCs and modules, but now Digi helps add simple cellular connectivity. The Digi XBee3 is a plug-and-play NB-IoT module that has built-in security and is pin-compatible with 3G and LTE-M modules. It’s programmable via MicroPython and comes pre-certified so developers can focus more on the application itself.
This brings us to the developer’s main focus, the application. The Giant Gecko 11 is a new 32-bit energy friendly microcontroller from Silicon Labs, and our the most capable yet. It helps simplify complex, cloud-connected applications with its large on-chip memory (2MB/512kB), lots of flexible sensor interfaces, SW and pin compatibility with other EFM32 MCUs, and unique low power capability to help prolong battery life. For example, not only does Giant Gecko 11 allow for autonomous analog and sensing in “Stop Mode” (1.6 uA), but it also has Octal SPI interface for external data logging, which could be used to reduce cellular transmission duty cycling.
There is one more unique offering in this demo. Considering that cellular connectivity might not be the solution for all IoT applications, the SW compatibility of Giant Gecko 11 and all EFM32s with Silicon Labs Wireless Geckos makes it easy to migrate to another wireless SoC or module, if needed. For example, some use cases and markets may use NB-IoT (such as this demo), while others might need their own proprietary sub-GHz solution (Flex Gecko).
For more information about what we’re doing at Embedded World, click here: https://www.silabs.com/products/wireless/internet-of-things.