EFM32™ Zero Gecko Starter Kit w/ Sensor Card - Review

Table of contents

RoadTest: EFM32™ Zero Gecko Starter Kit w/ Sensor Card

Author: amgalbu

Creation date:

Evaluation Type: Evaluation Boards

Did you receive all parts the manufacturer stated would be included in the package?: True

What other parts do you consider comparable to this product?:

What were the biggest problems encountered?:

Detailed Review:

EFM32 Gecko development kit

Overview

The purpose of this post is to implement an aquarium monitoring system using the energy-efficient EFM32 MCU. Thanks to its low-power design, this MCU can run on batteries. Also, the development kit provides a set of sensors that are suitable for this particular application, namely:

  • the temperature sensor, that can monitor water temperature
  • the light sensor, that can "see" if the water needs to be changed
  • the motion sensor, that can detect whether the fishes are healthy (they swim around quickly) or not
  • an LCD display to provide feedback

 

Introducing the EFM32 Zero Gecko

When I received the EFM32 Zero Gecko development kit, I was very impressed: it's not very usual to see such a rich development kit!

From an hardware point of view, you have two boards

The first board has the actual MCU (an EFM32ZG222F32 microcontroller) with some very interesting features like

  • the Advanced Energy Monitoring to see energy and power measures in realtime
  • the SEGGER JLink debugger
  • A 128x128 ultra low power graphic black-and-white display
  • A CR2032 battery to test energy efficiency
  • 2 user buttons (microswitches)
  • 2 capacitive touch pads

 

image

The second board (SENSOR-EXP-EVB) can be connected to the main board by means of a 20-pins connector and features a variety of sensor such as

  • Relative humidity
  • Temperature
  • UV Index, Ambient light, proximity and 3D gestures

image

 

 

Development tools

The IDE for developing on the EFM32 board is very easy to install. Just connect to the URL

 

http://www.energymicro.com/simplicity

 

download the setup package, run it and just follow the instructions on screen. In my case, everything went smooth and I was able to start playing with  the development kit 10 minutes after opening the box.

The IDE has a pretty user interface

image

 

Connect the development board to the PC and click "Detect connected device.." to make the Studio detect your board.

Probably before clicking, you will spent some time staring at the clearness of the tiny display...

Testing power modes

The first thing I was interested in was to test the power consumption of the MCU in the different power modes. This was also a great opportunity to see Energy Profiles at work...

Select "Software examples" in the Simplicity Studio start page. This will open a form that needs to be filled with the details about the connected board

image

 

Click "Next" to proceed. In the next form, select the example named "STK3200_powertest" and click "Next". Leave the default settings in the "Project configuration" form and click "Finish". The example project is now ready to be downloaded to the board and run and/or debugged.

In the main menu, "Project" and then "Build Project". The program should compile without any error. Now select "Run" and then "Debug as.." and "Silicon Labs ARM Program". The application should now be downloaded to the board and put in pause, ready to be debugged. Run the application

Go back to the Simplicity Studio start page and click "Energy Profiler"

The Energy Profiler will open

image

 

Click "Run" and then "Profile running program". The graph will show the energy consumption. Try to press the PB0 button on the button to cycle in the several power modes and see how energy consumption changes

Note that Advanced Energy Monitor features also the "Code Correlation". This is the functionality that allows you to profile and view energy consumption in an application by its functions as it executes in real time.  Code Correlation also allows you to select a sample point in the Energy Profiler's graph view and view the source code line that was executed at that time by the processor. This will allow a software developer to gain insight into which parts of the code executed spends the most energy. This insight will enable a software developer to both find bugs in the code that spends excessive energy and also to optimize the code for energy consumption.

The energy consumption I measured for the "STK3200_powertest" demo application are shown in picture below

 

image

 

The demo application test all the power modes implemented by the EFM32 MCU, namely

Energy Mode 0

(Active/Run mode)

High performance CPU and peripherals designed for ultra-low power operation

In Energy Mode 0 (EM0) the ARM Cortex-M CPU fetches and executes instructions from flash or RAM, and all low energy peripherals can be enabled. Due to its high processing power, the EFM32 can quickly enter one of the low energy modes from EM0 effectively halting the CPU and flash memory. After a wake up, all low energy modes return to EM0 within 2 µs, making it easy to enter the low energy mode and return to the high 32-bit performance when needed.

Power consumption in EM0: 180 µA/MHz

Energy Mode 1

(Sleep mode)

Stay in low energy modes while performing advanced tasks

In Energy Mode 1 (EM1) the clock to the CPU is disabled, effectively reducing the energy needed for operation while maintaining all low energy peripheral (including flash and RAM) functionality. By using the peripheral reflex system (PRS) and DMA, the system can collect and output peripheral data without CPU intervention. This autonomous behavior enables the system to remain in EM1 for long periods of time, thereby increasing battery life. Additionally, the low-leakage RAM ensures full data retention.

Power consumption in EM1: 45 µA/MHz

Energy Mode 2

(Deep sleep mode)

Advanced low power and autonomous operation without CPU intervention

In Energy Mode 2 (EM2), the EFM32 microcontrollers offer a high degree of autonomous operation while keeping energy consumption low. The high frequency oscillator is turned off in EM2; however, a 32 kHz oscillator and the real time clock are available for the low energy peripherals. Since the ARM Cortex-M CPU is not running in EM2, the MCU performs advanced operations in sleep mode. The peripherals run autonomously due to intelligent interconnection of the modules and memory, the wake-up time to EM0 is only 2 μs and low-leakage RAM ensures full data retention in EM2.

Power consumption in EM2: 0.9 µA

Energy Mode 3

(Stop mode)

Operation, full RAM retention and short 2 µs wake-up from interrupts

Energy Mode 3 (EM3) tailors the energy consumption of the EFM32 to maintain a very short wake-up time and respond to external interrupts. In EM3 the low-frequency oscillator is disabled, but the low-leakage RAM ensures full data retention and the low power analog comparator or asynchronous external interrupts can wake-up the device.

Power consumption in EM3: 0.6 µA

Energy Mode 4
(Shutoff mode)

For applications that don't need RTC or RAM retention

In Energy Mode 4 (EM4) – the deepest energy mode available – the EFM32 MCU is completely shut down and the only way to wake up is with a reset. This energy mode enables further energy savings for applications that do not require a RTC or RAM retention. Energy Mode 4 is available in select low energy peripherals, including:

  • Power-on reset
  • External interrupts

Power consumption in EM4: 20 nA

 

The change of power modes are clearly visible in the plot. In this case we see

  • EM0, HF External oscillator
  • EM0, HF RC oscillator
  • EM1
  • EM2 (here you see a big drop in consumption)

 

 

Using the LCD display

The first step in building my project is to master the display, so that I can

  • display different icons depending on the various aquarium conditions (high or low temperature, dirt water, etc)
  • show textual information

In the Simplicity IDE, I created a new project by clicking "File" -> "Silicon Labs MCU Project". I selected "Example" as project type and then I used the STK3200_spaceinvader sample as starting point (mainly because it includes all the features I'm going to use in my project). I named the project "FishMon".

I will leverage the display driver provided by Silicon Labs. To initialize the driver, just a few lines are required

  EMSTATUS status;

 

  /* Initialize the DISPLAY driver. */

  DISPLAY_Init();

 

  /* Retrieve the properties of the DISPLAY. */

  status = DISPLAY_DeviceGet(DISPLAY_DEVICE_NO, &displayDevice);

  if (DISPLAY_EMSTATUS_OK != status)

    return;

 

where displayDevice is defined as

static DISPLAY_Device_t displayDevice;

 

Now we I can try to draw an image on the screen. To render a bitmap, the RENDER_xx functions are available. The RENDER primitives support double buffering. So the screen content is initially prepared in an hidden buffer and then moved to the LCD display.

In my case, I will first prepare the bitmap in the hidden buffer by calling

    RENDER_SetFramebuffer(splash);


The splash argument is an array of unsigned chars that represents, pixel per pixel, the content to be drawn on the display. Variable splash can be found in the file img/splash.xbm . XBM (C header file array structure) files can be created from a PNG Image using a tool like ImageMagick

For example, to convert a PNG to XBM:

  1. convert.exe image.png XBM:image.xbm

to convert from an XBM to PNG:

  1. convert.exe image.xbm PNG:image.png

 

You may have to edit the XBM C-syntax for ImageMagick to recognize it. The array should be "static char" instead of "const unsigned char".

After preparing the hidden buffer, I will display the bitmap by calling

RENDER_UpdateDisplay( true, &displayDevice );

 

The first parameter tells whether a full screen update is required or only the portions of the screen that are changed needs to be redrawn.

Note that the RENDER module also include function for writing text. Here is the function prototype

void RENDER_Write( int posx, int posy, char *str )

 

where posx and posy are the coordinates where the text will be written, being (0,0) the coordinates of the top left corner of the display

 

Using touch buttons

To use touch buttons, first of all a proper GPIO port initialization is required.

Touch buttons are named on the board as PB0 and PB1 and are connect to pin 8 and 9 of the port C. So, we need to configure those pins as input and enable interrupts so that when a button is pressed a proper function is invoked

Here is the code to initialize touch buttons

 

  /* Enable GPIO in CMU */

  CMU_ClockEnable(cmuClock_GPIO, true);

 

  /* Configure PC8 and PC9 as input */

  GPIO_PinModeSet(gpioPortC, 8, gpioModeInput, 0);

  GPIO_PinModeSet(gpioPortC, 9, gpioModeInput, 0);

 

  /* Set falling edge interrupt for both ports */

  GPIO_IntConfig(gpioPortC, 8, false, true, true);

  GPIO_IntConfig(gpioPortC, 9, false, true, true);

 

  /* Enable interrupt in core for even and odd gpio interrupts */

  NVIC_ClearPendingIRQ(GPIO_EVEN_IRQn);

  NVIC_EnableIRQ(GPIO_EVEN_IRQn);

 

  NVIC_ClearPendingIRQ(GPIO_ODD_IRQn);

  NVIC_EnableIRQ(GPIO_ODD_IRQn);

 

There are two interrupt routines involved in this scenario: one is invoked when an even pin of the ports raises an interrupt, another when a odd pin raises an interrupt. Here are the two interrupt routines


void GPIO_EVEN_IRQHandler(void)

{

  /* Acknowledge interrupt */

  GPIO_IntClear(1 << 8);

  pb0Pressed = true;

}

 

void GPIO_ODD_IRQHandler(void)

{

  /* Acknowledge interrupt */

  GPIO_IntClear(1 << 9);

  pb1Pressed = true;

}

 

I simply clear the interrupt flag and store in a boolean variable that the button has been pressed

Note that one can get the pin that has generated the interrupt by invoking the function

  uint32_t flags = GPIO_IntGet();

 

Bits in flags are set to 1 for each pin that has generated the interrupt. For example, to check if pin 9 has generated the interrupt, we can write something like

  if (flags & (1 << 9))

 

Using temperature sensor

The expansion board provided by Silicon Labs has a Si7103 sensor that can measure relative humidity and temperature. The sensor has an I2C interface. Thanks to Silicon Labs, a driver is available and ready for use!

To communicate with the sensor, the I2C interface have to be initialized

 

  /* Initialize I2C driver, using standard rate. */

  I2CDRV_Init(&i2cInit);

 

Then, we can check whether the sensor is properly connected to the I2C bus

  si7013_status = Si7013_Detect(I2C0, SI7013_ADDR);

 

Finally, we can read out measures

  uint32_t rhData;

int32_t tempData;

Si7013_MeasureRHAndTemp(I2C0, SI7013_ADDR, &rhData, &tempData);

 

Using light sensor

The light sensor is integrated in the Si1147 sensor that features the following capabilities

  • Ultra-sensitive photodiodes with up to 3 independent LED drivers enable multiple functions

          a. Heart rate and blood oximetry measurements

          b.      Over 50 cm proximity detection

          c. Advanced 2D and 3D gesture detection

          d. Cheek detection for handsets

  • Ambient light sensor

          a. Enables accurate light level monitoring under mixed lighting

          b. Automatic backlight control for improved end user visual experience and reduced backlight energy

  • Optional digital UV Index sensor

          a. Determine real-time UV sun exposure and cumulative UV sun exposure

  • Low-power sensors, signal processor, and ADC enable long battery life

          a. As little as 1.2 µA average current with once per second UV Index measurements

          b. Innovative single-pulse proximity sensor minimizes on-time of IrLED to 25.6 µs – the primary energy consumer

          c. 9 µA average proximity sensing current (LED pulsed 25.6 µs every 800 ms at 180 mA plus 3 µA Si114x supply)

          d. Dynamic adjustment of LED currents minimizes power consumption and optimizes performance

          e. 1.7 to 3.6 V supply voltage

          f. < 500 nA standby current

  • I2C interface for ease of communication with host MCU
  • to 128 kLux dynamic range enables operation in direct sunlight
  • Minimum reflectance sensitivity of <1uW/cm2

 

As usual, Silicon Labs provides a useful example that can be used as a starting point for the projects.

First of all, the I2C interface have to be initialized

  I2CDRV_Init(&i2cInit);

 

Then, the Si1147 needs to be detected

  si1147_status = Si1147_Detect_Device(I2C0, SI1147_ADDR);

 

Finally, let's configure the sensor to enter low power state

  Si1147_ConfigureDetection(I2C0, SI1147_ADDR, true);

 

Finally, ambient light can be read

  light  = Si114xReadFromRegister(si114x_handle, REG_ALS_VIS_DATA0);

  light |= Si114xReadFromRegister(si114x_handle, REG_ALS_VIS_DATA1) << 8;

 

Note that the sensor can read the amount of ambient light in the IR spectrum

  irLight  = Si114xReadFromRegister(si114x_handle, REG_ALS_IR_DATA0);

  irLight |= Si114xReadFromRegister(si114x_handle, REG_ALS_IR_DATA1) << 8;

 

Using motion sensor

The Si1147 sensor is capable of detecting gestures in both 2D and 3D. Use of the gesture capabilities is greatly simplified by the libraries provided by Silicon Labs. Just invoke

 

  gesture_t gestureInput = Si1147_NewSample(I2C0, SI1147_ADDR, msTicks);

 

where msTicks represents the number of milliseconds elapsed since last call of the Si1147_NewSample function.

The return type (gesture_t) can have one of following self-explaining values

UP,

  DOWN,

  LEFT,

  RIGHT,

  TAP

 

Optimizing power consumption

To make the battery last as long as possible, application needs to run in Energy Mode 2, which ensure full RAM retention, fast wake-up despite the consumption of a mere 0.9 µA. Note that Energy Mode 3 does not apply in this case because timer will not work in this energy mode.

The following events will make the application to wake up and enter Energy Mode 0:

  • a 60 seconds free-running timer to monitor temperature and water cleanness
  • the touch buttons input interrupt
  • the motion detection interrupt

 

Creating the final application

The final application will start with a splash screen that will automatically disappear after 2 seconds.

At this point, the application will periodically (every 60 seconds) check temperature and the amount of debris in water. In case of temperature out of range (too hot or too cold) an alarm icon will be shown. If the water is too dirty, an alarm icon will be shown. The dirt water alarm icon has higher priority than the temperature alarm icon.

The fish motion analysis is always active. Every time the proximity sensor detects a fish passing by, an animation is shown. After 10 minutes, the application determine whether the fish is happy or unhappy. An icon will appear for some seconds

User can always browse application pages by pressing push button 0 and 1.

When the application starts, a welcome screen is shown

image

After two seconds, user is brought to the temperature window. The current water temperature is shown. Note that in this case there is an icon reporting an out-of-range temperature

image

 

By pressing push button 0, the water window is shown. Here a "water cleanness index"  is reported. Index ranges from 0 (water extremely dirty) to 100 (water clear)

image

 

When the application detects enough fish activity, a form is shown

image

 

On the other hand, if the fish is not swimming around, the user is notified

image

 

Consumption analysis

EnergyProfiler was of great value to optimize power consumption. I immediately realized that gesture detection sensor drains a lot of current both due to the LED illuminators and to processing power required by the CPU.

So I decided to keep the gesture detection sensor only for a limited amount of time to increase the battery life.

Here is the consumption of my project after this optimization

image

 

The average consumption of the MCU is about 4 mA over a 2 minutes window. See how power consumption increases when the gesture detection sensor is switched on!

 

Other tools

There are a few other tools that are included in the Simplicity Studio and deserve to be mentioned

EnergyAware Designer

EnergyAware Designer provides a simple and effective way to define and manage the pinout options for your EFM32 MCU design.  With an intuitive user interface, Energy Aware Designer drives you through the configuration of the internal interfaces and produces C source code that can be immediately integrated in your project

image

 

Energy Aware Battery

Energy Aware Battery allows designers to estimate the life time of your application when on battery power.  Energy Aware Battery allows the input of ALL operational states of the EFM32 MCU with full definition of peripherals used and time spent in this mode.  Designers can also add information relating to other energy consumption sources for any given mode and the specification / configuration of batteries they are using.  Energy Aware Battery will then provide an estimate for how long the application will run from the batteries chosen.

I tried to simulate the behavior of the my project. I added the following states

  1. 1. The active state: for 60 seconds, the application runs at full power and switches on the gesture detection sensor (I have accounted for an 5 mA extra-current)
  2. 2. The sleep state: the MCU goes into Energy Mode 2 for 200 seconds
  3. 3. The sampling state: the MCU wakes up and reads temperature and water status

Status 2 and 3 repeats until, after 10 minutes, the application goes back in status 1

image

 

 

In the bottom left corner, designers can select the type of battery that will power  the device will run on.

After defining the states and the battery type, the battery duration can be simulated. Here is the result

image

This tool is very useful because it helps designer to tune, with a minimum extra effort, application phases in order to maximize battery duration

 

 

Conclusions

I have been very impressed by this development kit. It has incredibly well engineered and provides a lot of ready-to-use functionalities to explore both the features of EFM32 Zero Gecko MCUs and the power of the Si1147 and Si7013 sensors.

In particular, the Si1147 sensor (proximity/UV/ambient light gesture) is very interesting because it allows to implement new interaction paradigms for you applications and projects.

The EFM32 Zero Gecko is really good for battery-powered sensors. It has energy modes that allow applications to wake up quickly and provides enough processing power to perform the most common tasks required by an embedded sensor .

However, what makes really the difference in the SiliconLabs products range is, in my opinion, the Simplicity Studio and the libraries included. It is a really good suite: powerful and easy to use and configure. User can select from all the available tools from a very clear start page. Tools like Energy Aware Designer makes MCU peripherals configuration a very easy task. If you are familiar with Eclipse, the IDE makes you feel immediately comfortable with the development. Setting the debugging environment is a matter of few click. Libraries makes it extremely easy to use the MCU's LCD driver, the SiliconLabs sensors and all the integrated peripherals.

To tell you the truth, during my roadtest I experienced some misalignments in the source code while debugging but nothing particularly annoying.

As a final word, what makes really the difference in a MCU, according to my experience,  is  not an extra UART or an extra ADC peripheral but support and development tools.

Anonymous