Getting Started with the BGM220 Explorer Kit#

The BGM220 Explorer Kit (part number: BGM220-EK4314A) is focused on rapid prototyping and IoT concept creation around Silicon Labs BGM220P module.

Kit Overview#

The kit features USB interface, on-board J-Link debugger, one user LED/button and support for hardware add-on boards via a mikroBus socket, and a qwiic connector.

Explorer Kit

The hardware add-on support allows developers to create and prototype applications using a virtually endless combination of off-the-shelf boards from mikroE, sparkfun, AdaFruit, and Seeed Studios. The boards from Seeed Studios feature a connector, which is pin compatible with the qwiic connector but mechanically incompatible and it requires an adaption cable or board.

Testing the Bluetooth Demos#

The Bluetooth SDK comes with pre-built demos that can be directly flashed into this kit and tested using a smartphone running the EFR Connect mobile app (Android, iOS):

  • SoC iBeacon

  • NCP Empty

The iBeacon can be tested with EFR Connect as documented in Getting Started with the WSTK. NCP Empty can be tested with NCP Commander, which can be launched via the Tools dialog in Simplicity Studio 5.

NCP Commander

GitHub Examples#

Silicon Labs applications_examples GitHub repository contains additional examples that can run on the BGM220 Explorer Kit. Some of them leverage 3rd party add-on boards and they are typically found in the bluetooth_applications repository.

Porting Code from mikroSDK and Arduino#

If using a mikroE click board, ready made examples are on your specific mikroE click board Web page that typically reside in mikroE's libstock and/or GitHub. Those examples are using the mikroSDK, which provides abstraction to the supported hardware kits provided by mikroE.

If using a board from sparkfun, Adafruit, or Seeed Studios, they typically have examples for the Arduino IDE, which run on some of their own controller boards that are supported by the Arduino platform.

Those examples will not run out of the box on the BGM220 Explorer Kit, but with a small amount of effort they can be easily ported by using the guide below, which maps mikroSDK and Arduino APIs for UART/SPI/I2C/GPIO functionality into the Silicon Labs platform equivalents.

Whether porting from mikroSDK or Arduino, EMLIB and Platform Drivers/Services contain the most useful Silicon Labs APIs. For corresponding documentation, see below:

  • EMLIB - a low level peripheral driver library for all Silicon labs EFM32 and EFR32 device families

  • Platform Drivers - a higher level driver layer built on top of EMLIB. EMDRV abstracts some aspects of peripheral initialization and use but is more limited in peripheral coverage than EMLIB.

Additionally, Silicon Labs' Peripheral Examples on GitHub are a good resource for simple demonstration of peripheral control using EMLIB.

mikroSDK Porting Guide#

The mikroE ecosystem of click boards from MikroElektronika are typically supported by a collection of driver modules and example code built upon the mikroSDK. These click boards feature a mikroBUS connector for connection to a host board and can include connections for power (3.3 V, 5 V, GND), communications (UART, SPI, and/or I2C), and assorted other functions (GPIO, PWM, INT).

The mikroSDK is a framework that provides abstraction for the communication and GPIO functions of the mikroE click boards by wrapping vendor-specific functions in a common API framework to accomplish these tasks that is portable across a wide range of host devices. The microSDK is therefore ported to a new device via the assignment of function pointers and other device-specific configuration options. At this time, there is no official mikroSDK port for Silicon Labs devices.

Note: The goal of this configuration guide is not to instruct the user on how to port the mikroSDK to the BGM220 or other Silicon Labs devices, but instead to introduce the user to the spectrum of Silicon Labs' native APIs and how to use these APIs instead of the mikroSDK.

There is currently a wide selection of mikroE click accessory boards to facilitate product development with devices such as sensors, display/LEDs, storage, interface, and HMI. Some of these boards are shown below.

mikroE click boards

Using the mikroBUS-compatible socket included on the Explorer Kit BGM220, these boards can be used with the BGM220 as the host controller via the pin functions connecting the mikroBUS socket to the BGM220.

When porting mikroE click examples to the Silicon Labs platform, it is important to understand that interaction between the host controller and the click board is accomplished using a subset of UART, I2C, SPI, GPIO, analog, PWM, or interrupt. Pins for each function are allocated between the BGM220 and the mikroBUS connector, as shown below.

mikroBUS Socket

MikroE Socket Signal

MikroE Socket Pin

BGM220 Pin or Board Connection

MIKROE_ANALOG

J201.1

PB00

MIKROE_RST

J201.2

PC06

MIKROE_SPI_CS

J201.3

PC03

MIKROE_SPI_SCK

J201.4

PC02

MIKROE_SPI_MISO

J201.5

PC01

MIKROE_SPI_MOSI

J201.6

PC00

3V3

J201.7

VMCU - BGM220P voltage domain

GND

J201.8

GND

MIKROE_PWM

J202.1

PB04

MIKROE_INT

J202.2

PB03

MIKROE_UART_RX

J202.3

PB02

MIKROE_UART_TX

J202.4

PB01

MIKROE_I2C_SCL

J202.5

PD02

MIKROE_I2C_SDA

J202.6

PD03

+5 V

J202.7

+5 V - Board USB voltage

GND

J202.8

GND

Note: Knowledge of the pin mapping shown above combined with use of Silicon Labs' native APIs, as shown below, enable a user to port existing click examples to the Explorer Kit BGM220 by substituting Silicon Labs API calls for mikroSDK and click driver API calls.

The following sections cover four main categories of API-enabled interactions between a host device (BGM220P in this case) and a click board: GPIO, SPI, I2C, and UART. Note that the functions and structures presented here correspond to elements of the core mikroHAL and mikroBUS APIs of the mikroSDK and their closest Silicon Labs counterparts. Many click boards have additional libraries and driver files that integrate with these layers to create the mikroE project framework. However, these core elements should help guide users porting to the Silicon Labs platform.

GPIO#

The mikroSDK uses a complex system of function pointers and data structures to initialize a low level GPIO driver layer with initialization, "get," and "set" function pointers for each GPIO pin on the mikroBUS header. This structure is inherited by higher-level driver layers, which use "get" and "set" functions in higher-level wrapper functions.

By contrast, the Silicon Labs APIs for GPIO control, or em_gpio, are straightforward and easy to understand. Generally speaking, firmware should first initialize a pin and set its mode (i.e., input type, output type, and so on) by calling GPIO_PinModeSet(), then use various API calls to control or read the pin state. The following table represents a comparison and possible suggested substitution scheme for using em_gpio in place of the mikroSDK GPIO API.

Note: More em_gpio functions are available in EMLIB. For more information,see the GPIO API Documentation.

API category

mikroBUS/mikroHAL function/API

Description

Corresponding Silicon Labs GSDK/EMLIB Platform API

GPIO

T_gpio_setFp T_gpio_obj::gpioGet[12]

Pointers to Get functions

GPIO_PinOutGet(), GPIO_PinInGet()

T_gpio_setFp T_gpio_obj::gpioSet[12]

Pointers to Set functions

GPIO_PinOutSet(), GPIO_PinOutClear(), GPIO_PinOutToggle()

T_mikrobus_ret mikrobus_gpioInit (T_mikrobus_soc bus, T_mikrobus_pin pin, T_gpio_dir dir)

Function sets GPIO direction. This function also should be used for GPIO availability check.

GPIO_PinModeSet(), GPIO_PinModeGet()

void hal_gpioMap(T_HAL_P gpioObj);

Initialization of the GPIO HAL (internal mapping of function pointers and driver/HAL layer initialization)

N/A

SPI#

As with the mikroSDK GPIO API, the mikroSDK SPI framework relies on vendor-specific function pointers assigned in a configuration layer to provide an interface for SPI communications.

Silicon Labs offers the low-level EMLIB SPI (Synchronous USART) and higher-level EMDRV driver SPIDRV APIs for SPI communication, provided as source code. The suggested substitutions in the following table assume that the host SoC is the SPI central, however EMLIB and SPIDRV offer peripheral SPI functions as well.

When using EMLIB, firmware must separately configure all SPI pins to the proper mode using the EMLIB GPIO functions before using the pins for SPI communications. When using SPIDRV, however, firmware specifies the desired port and pins to use for the SPI bus in the SPIDRV_Init data structure, and configuration of these pins is handled by the SPIDRV_Init() function.

Note: More EMLIB and SPIDRV functions are available than shown here. See em_usart and and SPIDRV API documentation for more information.

API category

mikroBUS/mikroHAL function/API

Description

Corresponding Silicon Labs GSDK/EMLIB Platform API

SPI

T_mikrobus_ret mikrobus_spiInit (T_mikrobus_soc bus, const uint32_t *cfg)

Function will initialize SPI peripheral on provided MIKROBUS depending on configuration provided as second argument.

USART_InitSync() or SPIDRV_Init()/SPIDRV_DeInit()

void hal_spiMap(T_HAL_P spiObj);

Initialization of the SPI HAL (internal mapping of function pointers and driver/HAL layer initialization)

N/A

static void hal_spiWrite(uint8_t *pBuf, uint16_t nBytes);

Function should execute write sequence of n bytes.

USART_SpiTransfer() (ignore return value), SPIDRV_MTransmit(), SPIDRV_MTransmitB()

static void hal_spiRead(uint8_t *pBuf, uint16_t nBytes);

Function should execute read sequence of n bytes.

USART_SpiTransfer() (read return value, pass dummy data parameter), SPIDRV_MReceive(), SPIDRV_MReceiveB()

static void hal_spiTransfer(uint8_t *pIn, uint8_t *pOut, uint16_t nBytes);

Function should execute RW sequence of n bytes

USART_SpiTransfer(), SPIDRV_MTransfer(), SPIDRV_MTransferB(), SPIDRV_MTransferSingleItemB()

I2C#

As with other mikroSDK modules, the mikroSDK I2C framework relies on vendor-specific function pointers assigned in a configuration layer to provide an interface for I2C communications.

Silicon Labs offers the EMLIB I2C driver em_i2c for firmware control of the I2C interface, which differs slightly in approach from the mikroSDK framework. The em_i2c firmware interface relies on the configuration of the I2C peripheral block and desired transfer parameters using the I2C_Init() and I2C_TransferInit() functions. Management of the I2C transfer state machine handled by repeated calls to I2C_Transfer(), which handles the different phases of the I2C transfer and hardware state machine.

When using EMLIB, firmware must separately configure all I2C pins to the proper mode using the EMLIB GPIO functions before using the pins for I2C communications.

Note: The em_i2c driver library provides additional functions and features beyond those described here. See the em_i2c API documentation for more information.

API category

mikroBUS/mikroHAL function/API

Description

Corresponding Silicon Labs GSDK/EMLIB Platform API

I2C

T_i2c_readFp T_i2c_obj::i2cRead

Pointer to I2C Read function

I2C_Transfer()

T_i2c_restartFp T_i2c_obj::i2cRestart

Pointer to I2C Restart function

I2C_Transfer()

T_i2c_startFp T_i2c_obj::i2cStart

Pointer to I2C Start function

I2C_Transfer()

T_i2c_stopFp T_i2c_obj::i2cStop

Pointer to I2C Stop function

I2C_Transfer()