Platform Examples#

This Document serves as a base for the SiliconLabs platform peripheral examples.

A number of examples are provided with Simplicity Studio and the Simplicity SDK. Each example has an associated README that explains the purpose of the example. Because new examples are always being added, the GSDK may contain other examples not documented here, Please refer this page for more examples.

Many of these examples are intended only to test specific aspects of the platform drivers. They are not intended as a starting point for your own application, although they may contain code for some features you want to use. Platform - Empty C Example is a recommended starting point.

Platform - Empty C Example: This example project shows an empty configuration that can be used as a starting point to add components and functionality.

Platform - Blink Bare-metal: This sample application demonstrates LED blink in a bare metal environment. The LED instance and toggle period can be configured in blink.c file. This application can be used to execute basic LED functionalities such as on, off, toggle, or retrieve the on/off status on Silicon Labs devices. There are different sample applications which demonstrates the same functionality in Kernel FreeRTOS and Micrium OS environment.

Platform - Blink PWM Bare-metal: This sample application demonstrates LED blink using PWM in bare metal environment. The PWM driver uses a TIMER to gradually adjust the intensity of an LED. PWM inputs and PWM LED instance can be configured in the blink_pwm_app.c file.

Platform - CLI Bare-metal: This example project demonstrates use of the command line interface component in a bare metal environment. The command line interface over the VCOM serial port. The example provides commands echo-str, echo-int which echoes the input arguments and LED which allows the user to turn on, turn off, or toggle the LEDs on the board.

Platform - Coulomb Counter Bare-metal: This example application demonstrates how to read coulomb counter total charge and store it in NVM3. See AN1188: EFP01 Coulomb Counting for more details about coulomb counter.

Platform - CPC Secondary VCOM Micrium OS: This sample application demonstrates how to open CPC user endpoints, and perform read and write operations. The application receives data on user endpoints and echos it back. A python script, cpc_interactive_client.py can be used to simulate a host application. Once the CPC secondary application is built and installed on the secondary, the CPC daemon and library can be installed on the host device from the Github repository. Once the applications are installed, the secondary can be connected via the VCOM port to the host, using a USB cable.

Platform - DMADRV Bare-metal: This example project demonstrates use of the direct memory access driver in a bare metal environment. The user is prompted to enter data over the VCOM serial port. Once the configured amount of data has been transferred, the data is echoed back to the user.

Platform - Emode Bare-metal: This example project demonstrates the power consumption using Energy Profiler for different combinations of emodes, clocks running, with/without DCDC, operation performed. This project uses EMU for entering EM1-4 modes and CMU for handling clocks.

Platform - I2C Simple Polled Master Bare-metal: This example project demonstrates how to use the I2C Simple Polled Master driver using the Si7021 Relative Humidity and Temperature Sensor in a bare-metal configuration. The initial temperature is read, and upper and lower limits are calculated. When the current temperature reaches the upper limit, LED0 is turned on and LED1 is turned off. When the current temperature reaches the lower limit, LED1 is turned on and LED0 is turned off. This driver supports master mode, single bus-master only. It blocks while waiting for the transfer is complete, polling for completion in EM0.

Platform - I/O Stream USART Bare-metal: The UART driver supports the UART capabilities of the USART, UART, and LEUART peripherals. This example project uses the I/O Stream service running in a bare-metal configuration to demonstrate the use of UART communication over the virtual COM port (VCOM). The application will echo back any characters it receives over the serial connection. The VCOM serial port can be used either over USB or by connecting to port 4902 if the kit is connected via Ethernet.

Platform - Joystick Bare-metal: This sample app demonstrates the use of the Joystick Driver in a bare metal environment. It prints the joystick position after every finite interval over the virtual COM serial port (VCOM). VCOM can be used either over USB or by connecting to port 4902 if the kit is connected via Internet. The Wireless Pro Kit (BRD4002A) must be used as the mainboard to mount and connect the compatible radio board.

Platform - mbedTLS ECDH: This example project demonstrates the use of hardware accelerators to perform ECDH key derivation with mbedTLS. The example uses the CTR-DRBG, a pseudo random number generator (PRNG) included in mbedTLS to generate random private keys for both peers (client and server) that will share the ECDH secret.

Platform - MEMLCD Bare-metal: This example project demonstrates use of the Memory Liquid Crystal Display (LCD) module in a bare metal application, using Silicon Labs Graphics Library (glib). The memory LCD interface is built to use SPI communication either with USART or EUSART. After flashing the application, button 0 is used to clear the LCD and button 1 is used to print 'Hello World!' on the LCD. There are different sample applications which demonstrates the same functionality in Kernel FreeRTOS and Micrium OS environment.

Platform - NVM3 Bare-metal: This example application demonstrates the use of Third Generation Non-Volatile Memory (NVM3) data storage. The application uses command line interface to execute operations Write, Read and Delete on NVM3 which are given by user. This application can save 10 files. Additionally, the number of writes and deletes are saved in the counter objects in the nvm3_app.c file.

Platform - Power Manager Bare-metal: This example project demonstrates use of the Power Manager module in a bare metal application. Power manager is a platform level software module that manages the system's energy modes. Its main purpose is to transition the system to a low energy mode when the processor has nothing to execute. The application starts in awake mode (EM0). To cycle through desired energy modes, click Button 1 and to confirm the selection, click Button 0.

Platform - PSA Crypto ECDH: This example uses the PSA Crypto API to perform ECDH key agreement on the supported device. The Elliptic Curve Diffie-Hellman (ECDH) is an anonymous key agreement protocol that allows two parties, each having an elliptic-curve private-public key pair, to establish a shared secret over an insecure channel. In this example, two peers (client and server) each generate their Elliptic Curve Cryptography (ECC) key pair. They exchange public keys and compute a shared secret using their private ECC keys. These secrets are compared with each other to make sure they are equal.

Platform - Simple Button Bare-metal: This example application demonstrates the use of simple button driver in a bare metal environment. The application toggles LED on each button press. The LED and the button instance can be changed in the simple_button_baremetal.c file.

Platform - Sleeptimer Bare-metal: This example project demonstrates periodic and one-shot timers using the low-frequency real-time clock peripheral in a bare metal environment. The application uses low frequency RTC (Real Time Clock) peripheral to create periodic and one-shot timers. The on-board button is used to control the timers stop and start operation. The status will be shown on the virtual COM serial port console. See AN0005: Real Time Counters and AN0014: EFM32 Timers for more details about timers.

Platform - Sleeptimer Wallclock: This example application demonstrates the use of sleeptimer wall clock interface in a bare metal environment. The application uses low frequency RTC (Real Time Clock) peripheral to set and get the date and time. This operation can be controlled over a virtual COM serial port using cli commands.

Platform - SPIDRV Master Bare-metal: This example project demonstrates the use of the Serial Peripheral Interface in primary mode in a bare metal configuration. Once the primary application is installed on a starter kit, the kit can be connected via the 20-pint expansion header to a second kit which has the secondary application installed. The user can then connect to the device via the VCOM serial connection. The primary and secondary devices will periodically exchange data, logging the exchanges over VCOM.

Platform - TEMPDRV on Micrium OS kernel: This example project demonstrates use of the temperature sensor driver in a Micrium OS task. TEMPDRV Temperature Driver provides an interface and various functionalities to the EMU internal temperature sensor. TEMPDRV supports application-specific callbacks at given temperature thresholds. EMU internal temperature sensor runs in energy modes EM0-EM4 and can wake up the core whenever temperature changes. Also, EMU temperature sensor runs continuously and measurements are taken every 250 ms.

Platform - UARTDRV LEUART Bare-metal: This example project demonstrates use of the UARTDRV driver with LEUART in a bare metal application. The application will echo back any characters it receives over the serial connection.

Requirements#

  • Desired Silicon Labs Starter Kit

  • Simplicity Studio 5 or IAR Workbench IDE

  • Simplicity SDK Suite 5.0, available via Simplicity Studio

For more information on installing Simplicity Studio, refer to the Simplicity Studio User Guide.

For more information on installing IAR workbench IDE, refer to the IAR workbench User Guide.