Intermediate
20 min

Control and monitor equipment via Bluetooth 5.4 using BL653 and MSP432P401R

Long-range Bluetooth Low Energy connectivity solution

BL653 Click with UNI-DS v8

Published Jan 27, 2025

Click board™

BL653 Click

Dev. board

UNI-DS v8

Compiler

NECTO Studio

MCU

MSP432P401R

Bluetooth LE connectivity with advanced features like direction finding and NFC

A

A

Hardware Overview

How does it work?

BL653 Click is based on the BL653, a longer-range Bluetooth LE  module for next-generation industrial IoT from Ezurio. This module, powered by Nordic’s nRF52833 silicon, integrates a powerful Cortex-M4F microcontroller, offering 512kB of flash memory and 128kB of RAM for hostless operation and efficient application processing. With its multi-wireless capabilities (Bluetooth v5.4 and NFC) and modular certifications for FCC, ISED, EU, RCM, MIC, KC, AS/NZS, and Bluetooth SIG, the BL653 Click ensures quick and hassle-free deployment in global markets. It represents the future of wireless Industrial Internet of Things (IIoT) connectivity to implement reliable wireless communication in even the harshest operating environments. This Click board™ provides a wide range of configurable interfaces, including UART, I2C, SPI, USB, and NFC, allowing easy integration into diverse industrial systems. It supports peripheral and central Bluetooth LE roles, enabling data collection, device control, and proximity-sensing applications. Its support for Bluetooth 5.4 features like direction finding (AoA and AoD) and multiple data rates, including 2Mbps, 1Mbps, and 125kbps coded PHY, ensures high-performance communication over long distances. It can be easily programmed using a simple AT command set, Zephyr RTOS, or the

Nordic SDK, allowing developers to create event-driven, automated applications or implement custom solutions. This Click board™ establishes communication between the BL653 module and the host MCU through a UART interface, using standard UART RX and TX pins and hardware flow control via CTS and RTS pins. The default communication speed is set at 115200bps, ensuring efficient data exchange. The host MCU configures communication and other features using high-level AT commands, making it easy to manage without requiring in-depth knowledge of Bluetooth protocol. Additionally, the board includes an SPI interface with a maximum clock speed of 8MHz and an I2C interface with a maximum clock speed of 400kHz. In addition to the interface pins, the board features a reset (RST) pin for hard resetting the module when necessary and an ARN pin as AutoRUN signal of the BL653 module that selects between the two BL653 operating modes at power-up: self-contained run mode or interactive/development mode. This board also includes a USB Type-C connector for USB 2.0 Full Speed 12Mbps hardware capability, allowing both power supply and configuration via a PC. This functionality is enabled by the CP2102N, a highly integrated USB-to-UART bridge, along with the

NCP1117 LDO regulator, which converts the USB supply to the necessary 3.3V for the module. BL653 Click also includes dedicated pins for NFC support, fully compliant with the NFC Forum specification. This feature operates at 13.56MHz with a data rate of 106kbps, supporting NFC Type 2 and Type 4 tag emulation. It offers multiple modes of operation, including disable, sense, and activated, providing flexibility for integrating advanced NFC functionalities into your applications. Additionally, the board features two user-configurable buttons (BTN1 and BTN2) and two user-configurable LED indicators (a blue LED1 and an orange LED2) for customizable user interaction and status indication. For development and debugging purposes, the Click board™ is equipped with unsoldered pins for an SWD interface, enabling easy access to programming and debugging functionalities. This Click board™ can be operated only with a 3.3V logic voltage level. The board must perform appropriate logic voltage level conversion before using MCUs with different logic levels. It also comes equipped with a library containing functions and example code that can be used as a reference for further development.

BL653 Click hardware overview image

Features overview

Development board

UNI-DS v8 is a development board specially designed for the needs of rapid development of embedded applications. It supports a wide range of microcontrollers, such as different STM32, Kinetis, TIVA, CEC, MSP, PIC, dsPIC, PIC32, and AVR MCUs regardless of their number of pins, and a broad set of unique functions, such as the first-ever embedded debugger/programmer over WiFi. The development board is well organized and designed so that the end-user has all the necessary elements, such as switches, buttons, indicators, connectors, and others, in one place. Thanks to innovative manufacturing technology, UNI-DS v8 provides a fluid and immersive working experience, allowing access anywhere and under any

circumstances at any time. Each part of the UNI-DS v8 development board contains the components necessary for the most efficient operation of the same board. An advanced integrated CODEGRIP programmer/debugger module offers many valuable programming/debugging options, including support for JTAG, SWD, and SWO Trace (Single Wire Output)), and seamless integration with the Mikroe software environment. Besides, it also includes a clean and regulated power supply module for the development board. It can use a wide range of external power sources, including a battery, an external 12V power supply, and a power source via the USB Type-C (USB-C) connector. Communication options such as USB-UART, USB

HOST/DEVICE, CAN (on the MCU card, if supported), and Ethernet is also included. In addition, it also has the well-established mikroBUS™ standard, a standardized socket for the MCU card (SiBRAIN standard), and two display options for the TFT board line of products and character-based LCD. UNI-DS v8 is an integral part of the Mikroe ecosystem for rapid development. Natively supported by Mikroe software tools, it covers many aspects of prototyping and development thanks to a considerable number of different Click boards™ (over a thousand boards), the number of which is growing every day.

UNI-DS v8 horizontal image

Microcontroller Overview

MCU Card / MCU

default

Type

8th Generation

Architecture

ARM Cortex-M4

MCU Memory (KB)

256

Silicon Vendor

Texas Instruments

Pin count

100

RAM (Bytes)

65536

Used MCU Pins

mikroBUS™ mapper

AutoRUN Control
P6.0
AN
Reset
P8.0
RST
SPI Select / ID COMM
P1.4
CS
SPI Clock
P1.5
SCK
SPI Data OUT
P1.7
MISO
SPI Data IN
P1.6
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
UART CTS
P2.5
PWM
UART RTS
P2.0
INT
UART TX
P1.3
TX
UART RX
P1.2
RX
I2C Clock
P3.7
SCL
I2C Data
P3.6
SDA
NC
NC
5V
Ground
GND
GND
1

Take a closer look

Click board™ Schematic

BL653 Click Schematic schematic

Step by step

Project assembly

Fusion for PIC v8 front image hardware assembly

Start by selecting your development board and Click board™. Begin with the UNI-DS v8 as your development board.

Fusion for PIC v8 front image hardware assembly
GNSS2 Click front image hardware assembly
SiBRAIN for PIC32MZ1024EFK144 front image hardware assembly
GNSS2 Click complete accessories setup image hardware assembly
Board mapper by product7 hardware assembly
Necto image step 2 hardware assembly
Necto image step 3 hardware assembly
Necto image step 4 hardware assembly
NECTO Compiler Selection Step Image hardware assembly
NECTO Output Selection Step Image hardware assembly
Necto image step 6 hardware assembly
Necto image step 7 hardware assembly
Necto image step 8 hardware assembly
Necto image step 9 hardware assembly
Necto image step 10 hardware assembly
Necto PreFlash Image hardware assembly

Track your results in real time

Application Output

1. Application Output - In Debug mode, the 'Application Output' window enables real-time data monitoring, offering direct insight into execution results. Ensure proper data display by configuring the environment correctly using the provided tutorial.

2. UART Terminal - Use the UART Terminal to monitor data transmission via a USB to UART converter, allowing direct communication between the Click board™ and your development system. Configure the baud rate and other serial settings according to your project's requirements to ensure proper functionality. For step-by-step setup instructions, refer to the provided tutorial.

3. Plot Output - The Plot feature offers a powerful way to visualize real-time sensor data, enabling trend analysis, debugging, and comparison of multiple data points. To set it up correctly, follow the provided tutorial, which includes a step-by-step example of using the Plot feature to display Click board™ readings. To use the Plot feature in your code, use the function: plot(*insert_graph_name*, variable_name);. This is a general format, and it is up to the user to replace 'insert_graph_name' with the actual graph name and 'variable_name' with the parameter to be displayed.

Software Support

Library Description

BL653 Click demo application is developed using the NECTO Studio, ensuring compatibility with mikroSDK's open-source libraries and tools. Designed for plug-and-play implementation and testing, the demo is fully compatible with all development, starter, and mikromedia boards featuring a mikroBUS™ socket.

Example Description
This example demonstrates the use of BL653 Click board by processing data from a connected BT device.

Key functions:

  • bl653_cfg_setup - Config Object Initialization function.

  • bl653_init - Initialization function.

  • bl653_cmd_run - This function sends a specified command with or without parameters to the Click module.

  • bl653_cmd_set - This function sets a value to a specified command parameter of the Click module.

  • bl653_cmd_get - This function is used to get the value of a given command parameter from the Click module.

Application Init
Initializes the driver and logger.

Application Task
Application task is split in few stages:

  • BL653_POWER_UP: Powers up the device and reads the system information.

  • BT653_CONFIG_EXAMPLE: Sets the BT device name.

  • BT653_EXAMPLE: Performs a BT terminal example by processing all data from a connected BT device and sending back an adequate response messages.

Open Source

Code example

The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.

/*!
 * @file main.c
 * @brief BL653 Click Example.
 *
 * # Description
 * This example demonstrates the use of BL653 Click board by processing data
 * from a connected BT device.
 *
 * The demo application is composed of two sections :
 *
 * ## Application Init
 * Initializes the driver and logger.
 *
 * ## Application Task
 * Application task is split in few stages:
 *  - BL653_POWER_UP:
 * Powers up the device and reads the system information.
 *  - BL653_CONFIG_EXAMPLE:
 * Sets the BT device name.
 *  - BL653_EXAMPLE:
 * Performs a BT terminal example by processing all data from a connected BT device 
 * and sending back an adequate response messages.
 *
 * ## Additional Function
 * - static void bl653_clear_app_buf ( void )
 * - static void bl653_log_app_buf ( void )
 * - static err_t bl653_process ( bl653_t *ctx )
 * - static err_t bl653_read_response ( bl653_t *ctx, uint8_t *rsp )
 * - static err_t bl653_power_up ( bl653_t *ctx )
 * - static err_t bl653_config_example ( bl653_t *ctx )
 * - static err_t bl653_example ( bl653_t *ctx )
 *
 * @note
 * We have used the Serial Bluetooth Terminal smartphone application for the test. 
 *
 * @author Stefan Filipovic
 *
 */

#include "board.h"
#include "log.h"
#include "bl653.h"

// Message content
#define MESSAGE_CONTENT     "BL653 Click board - demo example."

// Local device name.
#define DEVICE_NAME         "BL653 Click"

static bl653_t bl653;
static log_t logger;

// Application buffer size
#define APP_BUFFER_SIZE     600
#define PROCESS_BUFFER_SIZE 200

static uint8_t app_buf[ APP_BUFFER_SIZE ] = { 0 };
static int32_t app_buf_len = 0;

/**
 * @brief Example states.
 * @details Predefined enum values for application example state.
 */
typedef enum
{
    BL653_POWER_UP = 1,
    BL653_CONFIG_EXAMPLE,
    BL653_EXAMPLE

} bl653_app_state_t;

static bl653_app_state_t app_state = BL653_POWER_UP;

/**
 * @brief BL653 clearing application buffer.
 * @details This function clears memory of application buffer and reset its length.
 * @note None.
 */
static void bl653_clear_app_buf ( void );

/**
 * @brief BL653 log application buffer.
 * @details This function logs data from application buffer to USB UART.
 * @note None.
 */
static void bl653_log_app_buf ( void );

/**
 * @brief BL653 data reading function.
 * @details This function reads data from device and concatenates data to application buffer. 
 * @param[in] ctx : Click context object.
 * See #bl653_t object definition for detailed explanation.
 * @return @li @c  0 - Read some data.
 *         @li @c -1 - Nothing is read.
 * See #err_t definition for detailed explanation.
 * @note None.
 */
static err_t bl653_process ( bl653_t *ctx );

/**
 * @brief BL653 read response function.
 * @details This function waits for a response message, reads and displays it on the USB UART.
 * @param[in] ctx : Click context object.
 * See #bl653_t object definition for detailed explanation.
 * @param[in] rsp  Expected response.
 * @return @li @c  0 - OK response.
 *         @li @c -2 - Timeout error.
 *         @li @c -3 - Command error.
 * See #err_t definition for detailed explanation.
 * @note None.
 */
static err_t bl653_read_response ( bl653_t *ctx, uint8_t *rsp );

/**
 * @brief BL653 power up function.
 * @details This function powers up the device, and reads the system information.
 * @param[in] ctx : Click context object.
 * See #bl653_t object definition for detailed explanation.
 * @return @li @c    0 - OK.
 *         @li @c != 0 - Read response error.
 * See #err_t definition for detailed explanation.
 * @note None.
 */
static err_t bl653_power_up ( bl653_t *ctx );

/**
 * @brief BL653 config example function.
 * @details This function sets the BT device name.
 * @param[in] ctx : Click context object.
 * See #bl653_t object definition for detailed explanation.
 * @return @li @c    0 - OK.
 *         @li @c != 0 - Read response error.
 * See #err_t definition for detailed explanation.
 * @note None.
 */
static err_t bl653_config_example ( bl653_t *ctx );

/**
 * @brief BL653 example function.
 * @details This function performs a BT terminal example by processing all data from
 * a connected BT device and sending back an adequate response messages.
 * @param[in] ctx : Click context object.
 * See #bl653_t object definition for detailed explanation.
 * @return @li @c    0 - OK.
 *         @li @c != 0 - Read response error.
 * See #err_t definition for detailed explanation.
 * @note None.
 */
static err_t bl653_example ( bl653_t *ctx );

void application_init ( void ) 
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    bl653_cfg_t bl653_cfg;  /**< Click config object. */

    /** 
     * Logger initialization.
     * Default baud rate: 115200
     * Default log level: LOG_LEVEL_DEBUG
     * @note If USB_UART_RX and USB_UART_TX 
     * are defined as HAL_PIN_NC, you will 
     * need to define them manually for log to work. 
     * See @b LOG_MAP_USB_UART macro definition for detailed explanation.
     */
    LOG_MAP_USB_UART( log_cfg );
    log_init( &logger, &log_cfg );
    log_info( &logger, " Application Init " );

    // Click initialization.
    bl653_cfg_setup( &bl653_cfg );
    BL653_MAP_MIKROBUS( bl653_cfg, MIKROBUS_1 );
    if ( UART_ERROR == bl653_init( &bl653, &bl653_cfg ) ) 
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }
    
    log_info( &logger, " Application Task " );

    app_state = BL653_POWER_UP;
    log_printf( &logger, ">>> APP STATE - POWER UP <<<\r\n\n" );
}

void application_task ( void ) 
{
    switch ( app_state )
    {
        case BL653_POWER_UP:
        {
            if ( BL653_OK == bl653_power_up( &bl653 ) )
            {
                app_state = BL653_CONFIG_EXAMPLE;
                log_printf( &logger, ">>> APP STATE - CONFIG EXAMPLE <<<\r\n\n" );
            }
            break;
        }
        case BL653_CONFIG_EXAMPLE:
        {
            if ( BL653_OK == bl653_config_example( &bl653 ) )
            {
                app_state = BL653_EXAMPLE;
                log_printf( &logger, ">>> APP STATE - EXAMPLE <<<\r\n\n" );
            }
            break;
        }
        case BL653_EXAMPLE:
        {
            bl653_example( &bl653 );
            break;
        }
        default:
        {
            log_error( &logger, " APP STATE." );
            break;
        }
    }
}

int main ( void ) 
{
    /* Do not remove this line or clock might not be set correctly. */
    #ifdef PREINIT_SUPPORTED
    preinit();
    #endif
    
    application_init( );
    
    for ( ; ; ) 
    {
        application_task( );
    }

    return 0;
}

static void bl653_clear_app_buf ( void ) 
{
    memset( app_buf, 0, app_buf_len );
    app_buf_len = 0;
}

static void bl653_log_app_buf ( void )
{
    for ( int32_t buf_cnt = 0; buf_cnt < app_buf_len; buf_cnt++ )
    {
        log_printf( &logger, "%c", app_buf[ buf_cnt ] );
    }
}

static err_t bl653_process ( bl653_t *ctx ) 
{
    uint8_t rx_buf[ PROCESS_BUFFER_SIZE ] = { 0 };
    int32_t overflow_bytes = 0;
    int32_t rx_cnt = 0;
    int32_t rx_size = bl653_generic_read( ctx, rx_buf, PROCESS_BUFFER_SIZE );
    if ( ( rx_size > 0 ) && ( rx_size <= APP_BUFFER_SIZE ) ) 
    {
        if ( ( app_buf_len + rx_size ) > APP_BUFFER_SIZE ) 
        {
            overflow_bytes = ( app_buf_len + rx_size ) - APP_BUFFER_SIZE;
            app_buf_len = APP_BUFFER_SIZE - rx_size;
            memmove ( app_buf, &app_buf[ overflow_bytes ], app_buf_len );
            memset ( &app_buf[ app_buf_len ], 0, overflow_bytes );
        }
        for ( rx_cnt = 0; rx_cnt < rx_size; rx_cnt++ ) 
        {
            if ( rx_buf[ rx_cnt ] ) 
            {
                app_buf[ app_buf_len++ ] = rx_buf[ rx_cnt ];
            }
        }
        return BL653_OK;
    }
    return BL653_ERROR;
}

static err_t bl653_read_response ( bl653_t *ctx, uint8_t *rsp ) 
{
    #define READ_RESPONSE_TIMEOUT_MS 30000
    uint32_t timeout_cnt = 0;
    bl653_clear_app_buf ( );
    bl653_process( ctx );
    while ( ( 0 == strstr( app_buf, rsp ) ) &&
            ( 0 == strstr( app_buf, BL653_RSP_ERROR ) ) )
    {
        bl653_process( ctx );
        if ( timeout_cnt++ > READ_RESPONSE_TIMEOUT_MS )
        {
            bl653_log_app_buf( );
            bl653_clear_app_buf( );
            log_error( &logger, " Timeout!" );
            return BL653_ERROR_TIMEOUT;
        }
        Delay_ms( 1 );
    }
    Delay_ms ( 200 );
    bl653_process( ctx );
    bl653_log_app_buf( );
    if ( strstr( app_buf, rsp ) )
    {
        log_printf( &logger, "--------------------------------\r\n" );
        return BL653_OK;
    }
    return BL653_ERROR_CMD;
}

static err_t bl653_power_up ( bl653_t *ctx )
{
    err_t error_flag = BL653_OK;
    
    log_printf( &logger, ">>> Reset device.\r\n" );
    bl653_reset_device( &bl653 );
    while ( BL653_OK == bl653_process( ctx ) )
    {
        bl653_log_app_buf( );
        bl653_clear_app_buf ( );
    }
    log_printf( &logger, "--------------------------------\r\n" );

    log_printf( &logger, ">>> Factory reset.\r\n" );
    bl653_cmd_run( &bl653, BL653_CMD_FACTORY_RESET, NULL );
    error_flag |= bl653_read_response( &bl653, BL653_RSP_OK );

    log_printf( &logger, ">>> Check communication.\r\n" );
    bl653_cmd_run( &bl653, BL653_CMD_AT, NULL );
    error_flag |= bl653_read_response( &bl653, BL653_RSP_OK );

    log_printf( &logger, ">>> Get device type.\r\n" );
    bl653_cmd_run( ctx, BL653_CMD_GET_INFO, BL653_PARAM_DEVICE_TYPE );
    error_flag |= bl653_read_response( ctx, BL653_RSP_OK );

    log_printf( &logger, ">>> Get firmware version.\r\n" );
    bl653_cmd_run( ctx, BL653_CMD_GET_INFO, BL653_PARAM_FW_VERSION );
    error_flag |= bl653_read_response( ctx, BL653_RSP_OK );

    log_printf( &logger, ">>> Get BT address.\r\n" );
    bl653_cmd_run( ctx, BL653_CMD_GET_INFO, BL653_PARAM_BT_ADDRESS );
    error_flag |= bl653_read_response( ctx, BL653_RSP_OK );

    return error_flag;
}

static err_t bl653_config_example ( bl653_t *ctx )
{
    err_t error_flag = BL653_OK;

    log_printf( &logger, ">>> Set device name to \"%s\".\r\n", ( char * ) DEVICE_NAME );
    bl653_cmd_set( ctx, BL653_CMD_PARAM_ACCESS_STR, BL653_PARAM_ID_DEVICE_NAME, DEVICE_NAME );
    error_flag |= bl653_read_response( ctx, BL653_RSP_OK );
    
    log_printf( &logger, ">>> Save settings.\r\n" );
    bl653_cmd_run( &bl653, BL653_CMD_SAVE_SETTINGS, NULL );
    error_flag |= bl653_read_response( ctx, BL653_RSP_OK );
    
    log_printf( &logger, ">>> Reboot.\r\n" );
    bl653_cmd_run( ctx, BL653_CMD_WARM_RESET, NULL );
    error_flag |= bl653_read_response( ctx, BL653_RSP_OK );
    
    return error_flag;
}

static err_t bl653_example ( bl653_t *ctx )
{
    err_t error_flag = BL653_OK;
    uint32_t timeout_cnt = 0;

    #define BT_TERMINAL_TIMEOUT_MS      60000
    #define BT_TERMINAL_MESSAGE_FREQ_MS 5000
    #define TERMINATION_CMD             "END"
    #define TERMINATION_RESPONSE        "END command received, the connection will be terminated in a few seconds."
    #define TERMINATION_TIMEOUT         "Timeout, closing the connection in a few seconds."
    #define NEW_LINE_STRING             "\r\n"
    #define DISCONNECT_PEER             "0"

    log_printf( &logger, ">>> Waiting for a BT peer to establish connection with the Click board...\r\n" );
    for ( ; ; )
    {
        bl653_clear_app_buf( );
        if ( BL653_OK == bl653_process( ctx ) )
        {
            Delay_ms ( 200 );
            bl653_process( ctx );
            bl653_log_app_buf( );
            if ( strstr( app_buf, BL653_RSP_CONNECT ) )
            {
                log_printf( &logger, "--------------------------------\r\n" );
                log_printf( &logger, ">>> BT peer has connected.\r\n" );
                break;
            }
        }
    }

    log_printf( &logger, ">>> Waiting for data (up to 60 seconds)...\r\n" );
    log_printf( &logger, ">>> Connection will be terminated if the Click receives an \"END\" string.\r\n" );
    for ( ; ; )
    {
        bl653_clear_app_buf( );
        if ( BL653_OK == bl653_process( ctx ) )
        {
            Delay_ms ( 200 );
            timeout_cnt = 0;
            bl653_process( ctx );
            bl653_log_app_buf( );
            if ( strstr( app_buf, TERMINATION_CMD ) )
            {
                log_printf( &logger, ">>> Terminating connection on demand.\r\n" );
                bl653_generic_write ( ctx, TERMINATION_RESPONSE, strlen ( TERMINATION_RESPONSE ) );
                bl653_generic_write ( ctx, NEW_LINE_STRING, strlen ( NEW_LINE_STRING ) );
                Delay_ms ( 100 );

                log_printf( &logger, ">>> Disconnecting BT peer.\r\n" );
                // Sending 4 escape chars with at least 250ms intervening delay
                bl653_generic_write ( ctx, BL653_CMD_VSP_ESCAPE_CHAR, strlen ( BL653_CMD_VSP_ESCAPE_CHAR ) );
                Delay_ms ( 300 );
                bl653_generic_write ( ctx, BL653_CMD_VSP_ESCAPE_CHAR, strlen ( BL653_CMD_VSP_ESCAPE_CHAR ) );
                Delay_ms ( 300 );
                bl653_generic_write ( ctx, BL653_CMD_VSP_ESCAPE_CHAR, strlen ( BL653_CMD_VSP_ESCAPE_CHAR ) );
                Delay_ms ( 300 );
                bl653_generic_write ( ctx, BL653_CMD_VSP_ESCAPE_CHAR, strlen ( BL653_CMD_VSP_ESCAPE_CHAR ) );
                Delay_ms ( 300 );
                error_flag |= bl653_read_response( ctx, BL653_RSP_NO_CARRIER );
                break;
            }
            else if ( strstr( app_buf, BL653_RSP_NO_CARRIER ) )
            {
                log_printf( &logger, ">>> BT peer has disconnected.\r\n" );
                break;
            }
        }
        timeout_cnt++;
        if ( 0 == ( timeout_cnt % BT_TERMINAL_MESSAGE_FREQ_MS ) )
        {
            log_printf( &logger, ">>> Sending \"%s\" message to connected device.\r\n", ( char * ) MESSAGE_CONTENT );
            bl653_generic_write ( ctx, MESSAGE_CONTENT, strlen ( MESSAGE_CONTENT ) );
            bl653_generic_write ( ctx, NEW_LINE_STRING, strlen ( NEW_LINE_STRING ) );
            Delay_ms ( 100 );
        }
        if ( BT_TERMINAL_TIMEOUT_MS < timeout_cnt )
        {
            log_printf( &logger, ">>> Terminating connection due to 60s timeout expiration.\r\n" );
            bl653_generic_write ( ctx, TERMINATION_TIMEOUT, strlen ( TERMINATION_TIMEOUT ) );
            bl653_generic_write ( ctx, NEW_LINE_STRING, strlen ( NEW_LINE_STRING ) );
            Delay_ms ( 100 );

            log_printf( &logger, ">>> Disconnecting BT peer.\r\n" );
            // Sending 4 escape chars with at least 250ms intervening delay
            bl653_generic_write ( ctx, BL653_CMD_VSP_ESCAPE_CHAR, strlen ( BL653_CMD_VSP_ESCAPE_CHAR ) );
            Delay_ms ( 300 );
            bl653_generic_write ( ctx, BL653_CMD_VSP_ESCAPE_CHAR, strlen ( BL653_CMD_VSP_ESCAPE_CHAR ) );
            Delay_ms ( 300 );
            bl653_generic_write ( ctx, BL653_CMD_VSP_ESCAPE_CHAR, strlen ( BL653_CMD_VSP_ESCAPE_CHAR ) );
            Delay_ms ( 300 );
            bl653_generic_write ( ctx, BL653_CMD_VSP_ESCAPE_CHAR, strlen ( BL653_CMD_VSP_ESCAPE_CHAR ) );
            Delay_ms ( 300 );
            error_flag |= bl653_read_response( ctx, BL653_RSP_NO_CARRIER );
            break;
        }
        Delay_ms ( 1 );
    }
    
    return error_flag;
}

// ------------------------------------------------------------------------ END

Additional Support

Resources

Love this project?

'Buy This Kit' button takes you directly to the shopping cart where you can easily add or remove products.