Tuesday, January 13, 2026

0

AIROC Bluetooth LE evaluation Kit: Getting started with Blinky demo

 

Introduction and Motivation:

I want to start this series of Bluetooth development on AIROC Bluetooth LE SoC. They feature Arm Cortex-M4 & M33 MCUs with rich set of peripherals and support of latest Bluetooth core specs. My goal from the series is to get familiar with embedded systems architecutre, firmware development and Bluetooth low energy profiles. I will make use of code examples published by Infenion to demonstrate the process of building Bluetooth applications using BTSTACK (Infineon Host Bluetooth® stack) API

AIROC CYW20835 Bluetooth LE Evaluation Board: 

 

For the purpose of development, prototyping and testing I got myself Infineon CYW920835M2EVB evaluation board which hosts the CYW20835 Bluetooth 5.4 LE SoC. The block diagram below shows the internal archiecture of the chip with the MCU subsystem ruuing of an ARM Cortex-M4 CPU.
 
modalImg
CYW20835 Block Diagram

The above chip is connected to the board in the form of M.2 radio card as shown in the images below. The system can be powered from 5V USB or Coin battery cell based on a jumper selection. The evalboard is equipped with a thermistor, an ambient ligh sensor, 2 User LEDs and 1 User push button. 4 Arduino and 2 Bluetooth I/O headers are available to access the CYW20835 GPIOs. For debugging, Serial Wire Debug (SWD) header is also available.

CYW20835 Evalboard Top View

CYW20835 Evalboard Bottom View


Blinky Example:

One of the simplest examples to get started with embedded systems is a Blinky project. The goal is to program the CYW20835 to drive one of the onboard LEDs on/off. This will also demonstrate the usage of Infenion ModusToolbox frimware development eco system for their micro-controllers.

Installing ModusToolbox:

I will not go through the development environement setup process since it is a straightforward. Ideally you would download the ModusToolbox setup tool from here and launch it to install the essential components (i.e, ARM compiler, SDK, examples, programming and debugging tools) as listed in the image below:
 

Creating Template Project:

I use ModusToolbox project creator to create a template project selecting VScode as the development IDE. The tool provide a set of source templates based on suported list of boards. By typing the product name of the evaluation kit we can select it from the BSP menu as shown below:
 

 Afterwads we get a list of application templates. I selected the Empty BTSDK app as it is the simplest one for getting started
 
 

Cleaning Up The Template:

After hitting create, the the template project files are generated. Now I move to VSCode to start developing the Blinky example, build it and flash it to the evaluation board. Please be aware that you need to install VSCode "C/C++" and "Cortex-Debug" extensions for syntax highlighting and debugging. Looking at the gnerated file strucutre of the project, you notice that it looks quite complex with many directories and various types of files. For this simple demonstration, I only had to worry about the "C" source/header files to write the application logic and the "makefile" to enable debugging flag.
 
Generated template project files
 
After cleaning up the project files, I end up with the structure below. Note that I have renamed "empty_wiced_bt.c" to "main.c" since this file will contain the entry point function for the application. In addition, I have renamed "app_bt_cfg.h" to "blinky.h". The generated "COMPONENT_btstack" folders were removed since I am not going to use any Bluetooth functions in this simple example.
 
Project files after cleanup

 

Coding The Blinky Firmware:

To write this demo code, I have spent sometime to understand the required functions and imports required to control the GPIO states for turning the LED on/off with a defined timer. The BTSDK online documentation along with the SDK examples were quite useful in this regard. Below I share the source code I came up with to accomplish the project goal. In addition to LED controls, the application can print debug messages to UART which can be observed from a serial terminal window (e.g Putty) listening to the respective COM port as you will see later. 
 
The "blinky.h" header file defines the LED2 mapped GPIO number based on our selected chipset platform. 
 
The "main.c" start by importing required headers. I have defined two constants to control the LED On / Off duration to create a blinking effect. In the variables section, I have made use of the SDK time managment service to define an accurate timer that once it times out the LED2 GPIO gets toggled via a callback function. The "APPLICATION_START" function is the entry point of our program (like main in a conventional C/C++ program). The function name is a convention used by the underlying SDK so I had to stick to it. In the main function, I set the UART debug interface to observe printed messages from the application while it is running. Then I print a debug message via UART to indicate that application has started. Finally, I initialize and start the LED timer with the respecitve "led_timeout_func" callback. The  callback function will trigger once the defined ON/OFF duration is elapsed and pull the LED2 GPIO high/low and start the timer again to repeat the process infinitely.
 
blinky.h 
/** blinky.h
 *
 * Header File
 *
 */

#ifndef BLINKY_H_
#define BLINKY_H_

#include "wiced_bt_cfg.h"

/******************************************************************************
 *                                Constants
 ******************************************************************************/
#define LED_2_GPIO (uint32_t)*platform_led[WICED_PLATFORM_LED_2].gpio

#endif /* BLINKY_H_ */
 
 
 main.c  
/** @file
*
* Blinky Example
*
*/
#include "wiced_platform.h"
#include "wiced_timer.h"
#include "wiced_hal_gpio.h"
#include "sparcommon.h"
#include "blinky.h"
#ifdef  WICED_BT_TRACE_ENABLE
#include "wiced_bt_trace.h"
#endif

/******************************************************************************
 *                                Constants
 ******************************************************************************/
#define LED_OFF_MS 1000
#define LED_ON_MS 1000
/******************************************************************************
 *                                Variables Definitions
 ******************************************************************************/
wiced_timer_t led_timer;
extern wiced_platform_led_config_t platform_led[];
wiced_bt_gpio_numbers_t led_pin;
static void led_timeout_func( TIMER_PARAM_TYPE count);
/******************************************************************************
 *                          Function Definitions
 ******************************************************************************/
/*
 *  Entry point to the application
 */
APPLICATION_START()
{
    // Set to PUART to see traces on peripheral uart(puart)
    wiced_set_debug_uart(WICED_ROUTE_DEBUG_TO_PUART);
    // Assign target GPIO to LED 2 on the board (The RED LED)
    led_pin = LED_2_GPIO;
    // Print debug message to UART
    WICED_BT_TRACE( "AK-Experiments - Blinky Example");
    // initialize a timer wiht a callback function to turn LED on/off
    wiced_init_timer(&led_timer, led_timeout_func, 0, WICED_MILLI_SECONDS_TIMER);
    // Start the timer
    wiced_start_timer(&led_timer, LED_ON_MS);
}


/*
 * The function invoked on timeout of led timer.
 */
void led_timeout_func( TIMER_PARAM_TYPE count )
{
    static wiced_bool_t led_on = WICED_FALSE;
    if (led_on)
    {
        wiced_hal_gpio_set_pin_output(led_pin, GPIO_PIN_OUTPUT_HIGH);
        led_on = WICED_FALSE;
        wiced_start_timer(&led_timer, LED_OFF_MS);
       
    }
    else
    {
        led_on = WICED_TRUE;
        wiced_hal_gpio_set_pin_output(led_pin, GPIO_PIN_OUTPUT_LOW);
        wiced_start_timer(&led_timer, LED_ON_MS);
    }
}


 

Flashing Blinky Firmware:

Finally we should be ready to build our application and program our board to see if the written code above actually works. The template project will have prepared tasks to build and download the program to the board. So I simply triggered the "Program: build and download app [Release]" after connecting my Evalboard to the PC via USB cable. After few seconds, the project builds and gets falshed successfully to the board as indicated by the below message:
 
 
 
Aferwards, I see LED2 on the board blinking red every 1 second. Great I just created my first firmware application :). To check that the debug message is also printed over UART. I open a serial terminal on the respective COM port (you can find exact one via Device Manager on Windows) and then hit the Reset buton on the board to restart the system. I am able to see the below message as expected (really neat).