TOP Contributors

  1. MIKROE (2750 codes)
  2. Alcides Ramos (372 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (118 codes)
  5. Bugz Bensce (90 codes)
  6. S P (73 codes)
  7. dany (71 codes)
  8. MikroBUS.NET Team (35 codes)
  9. NART SCHINACKOW (34 codes)
  10. Armstrong Subero (27 codes)

Most Downloaded

  1. Timer Calculator (139020 times)
  2. FAT32 Library (71554 times)
  3. Network Ethernet Library (56937 times)
  4. USB Device Library (47294 times)
  5. Network WiFi Library (43003 times)
  6. FT800 Library (42291 times)
  7. GSM click (29727 times)
  8. mikroSDK (27835 times)
  9. PID Library (26846 times)
  10. microSD click (26093 times)
Libstock prefers package manager

Package Manager

We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]

< Back
mikroSDK Library

BLE TINY Click

Rating:

0

Author: MIKROE

Last Updated: 2024-10-31

Package Version: 2.1.0.19

mikroSDK Library: 2.0.0.0

Category: BT/BLE

Downloaded: 381 times

Not followed.

License: MIT license  

BLE TINY Click is a compact add-on board that provides BLE connectivity for any embedded application. This board features the DA14531, SmartBond TINY module based on the world’s smallest and lowest power Bluetooth 5.1 System-on-Chip (SoC) from Dialog Semiconductor.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "BLE TINY Click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "BLE TINY Click" changes.

Do you want to report abuse regarding "BLE TINY Click".

  • Information
  • Comments (0)

mikroSDK Library Blog


BLE TINY Click

BLE TINY Click is a compact add-on board that provides BLE connectivity for any embedded application. This board features the DA14531, SmartBond TINY module based on the world’s smallest and lowest power Bluetooth 5.1 System-on-Chip (SoC) from Dialog Semiconductor.

ble_tiny_click.png

Click Product page


Click library

  • Author : Luka Filipovic
  • Date : Apr 2021.
  • Type : UART type

Software Support

We provide a library for the BLETINY Click as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.

Package can be downloaded/installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on mikroE github account.

Library Description

This library contains API for BLETINY Click driver.

Standard key functions :

  • bletiny_cfg_setup Config Object Initialization function.

    void bletiny_cfg_setup ( bletiny_cfg_t *cfg );
  • bletiny_init Initialization function.

    BLETINY_RETVAL bletiny_init ( bletiny_t *ctx, bletiny_cfg_t *cfg );
  • bletiny_default_cfg Click Default Configuration function.

    void bletiny_default_cfg ( bletiny_t *ctx );

Example key functions :

  • bletiny_send_cmd Send command function.

    void bletiny_send_cmd ( bletiny_t *ctx, char *cmd );
  • bletiny_i2c_config Configure Click board for I2C master communication.

    void bletiny_i2c_config ( bletiny_t *ctx, uint8_t speed, uint8_t reg_len );
  • bletiny_i2c_write Send command to write data to reg address of slave device via I2C communication.

    err_t bletiny_i2c_write ( bletiny_t *ctx, uint8_t slave_address, uint16_t reg, uint8_t reg_data );

Example Description

This example reads and processes data from BLE TINY clicks. Application waits for connection with Click board with phone. Then checks its Coadless FW version and checks connected device. Then waits for command to be stored in it's memory on 0 slot. After that depending on the command stored it executes that type of example.

The demo application is composed of two sections :

Application Init

Initializes driver and resets device and seds Disconnect and Reset IO commands. Then it waits for the connection to device. When connected it sends commands to check Coadless FW, connected device, its BLE address and signal quality of connection. In the end it waits for command from its memory. After valid command is stored in memory on 0 slot it contines to Application Task.


void application_init ( void ) 
{   
    log_cfg_t log_cfg;  /**< Logger config object. */
    bletiny_cfg_t bletiny_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_printf( &logger, "\r\nApplication Init\r\n" );
    Delay_ms ( 1000 );

    // Click initialization.
    bletiny_cfg_setup( &bletiny_cfg );
    BLETINY_MAP_MIKROBUS( bletiny_cfg, MIKROBUS_1 );
    err_t init_flag  = bletiny_init( &bletiny, &bletiny_cfg );

    if ( init_flag == UART_ERROR ) 
    {
        log_error( &logger, " Application Init Error. " );
        log_info( &logger, " Please, run program again... " );

        for ( ; ; );
    }    
    bletiny_default_cfg ( &bletiny );

    bletiny_send_cmd( &bletiny, BLETINY_CMD_ATR );
    bletiny_send_cmd( &bletiny, BLETINY_CMD_ATZ );
    bletiny_send_cmd( &bletiny, BLETINY_CMD_GAPDISCONNECT );
    bletiny_process( );
    bletiny_clear_app_buf( );

    app_buf_len = 0;
    app_buf_cnt = 0;

    //wait for connection
    log_printf( &logger, " Waiting for phone to connect\r\n" );
    while ( 0 == strstr( app_buf, BLETINY_CONNECTED ) ) 
    {
        bletiny_process( );
    }
    log_printf( &logger, " Connected\r\n" );
    bletiny_clear_app_buf( );
    //send ATI command to check Codless FW
    bletiny_send_cmd( &bletiny, BLETINY_CMD_ATI );
    volatile err_t app_error_flag = bletiny_rsp_check();
    if ( BLETINY_OK == app_error_flag )
    {
        bletiny_log_app_buf();
        log_printf( &logger, "-----------------------------------\r\n" );
    }
    else
    {
        bletiny_error_check( app_error_flag );
    }
    Delay_ms ( 1000 );
    //send command to check ble address
    bletiny_send_cmd( &bletiny, BLETINY_CMD_BDADDR );    
    app_error_flag = bletiny_rsp_check();
    if ( BLETINY_OK == app_error_flag )
    {
        bletiny_log_app_buf();
        log_printf( &logger, "-----------------------------------\r\n" );
    }
    else
    {
        bletiny_error_check( app_error_flag );
    }
    Delay_ms ( 1000 );
    //send ATrI command to check remote connected device
    bletiny_send_cmd( &bletiny, BLETINY_CMD_ATRI );
    app_error_flag = bletiny_rsp_check();
    if ( BLETINY_OK == app_error_flag )
    {
        bletiny_log_app_buf();
        log_printf( &logger, "-----------------------------------\r\n" );
    }
    else
    {
        bletiny_error_check( app_error_flag );
    }
    Delay_ms ( 1000 );
    //send RSSI command to check signal quality
    bletiny_send_cmd( &bletiny, BLETINY_CMD_RSSI );
    app_error_flag = bletiny_rsp_check();
    if ( BLETINY_OK == app_error_flag )
    {
        bletiny_log_app_buf();
        log_printf( &logger, "-----------------------------------\r\n" );
    }
    else
    {
        bletiny_error_check( app_error_flag );
    }
    //select example to execute
    bletiny_example_init( );

    bletiny_clear_app_buf( );
    log_printf( &logger, " Application Task \r\n" );
}

Application Task

Executes one of thre application task selected in Application Init:I2C, SPI, APP. I2C example uses EEPROM Click board to write and read data of its memory. SPI example uses EEPROM 2 Click board to write and read data of its memory. APP example just reads UART data and logs it to UART Terminal.


void application_task ( void ) 
{
    static uint8_t info = 0;
    switch ( example_type )
    {
        case BLETINY_I2C_EXAMPLE:
        {
            if (!info)
            {
                info++;
                log_printf( &logger, " I2C example\r\n" );
                bletiny_process( );
                bletiny_clear_app_buf( );
            }
            bletiny_i2c_example( );
            break;
        }
        case BLETINY_SPI_EXAMPLE:
        {
            if (!info)
            {
                info++;
                log_printf( &logger, " SPI example\r\n" );
                bletiny_process( );
                bletiny_clear_app_buf( );
            }
            bletiny_spi_example( );
            break;
        }
        case BLETINY_APP_CTRL:
        {
            if (!info)
            {
                info++;
                log_printf( &logger, " Application example\r\n" );
                bletiny_process( );
                bletiny_clear_app_buf( );
            }
            bletiny_application_example( );
            break;
        }
        default:
        {
            break;
        }
    }
}

Note

For this application you need to install Dialog's mobile application SmartConsole. This application I2C example is created using EEPROM Click board, and for SPI example EEPROM 2 Click board is used.

The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on mikroE github account.

Other mikroE Libraries used in the example:

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.BLETINY

Additional notes and informations

Depending on the development board you are using, you may need USB UART Click, USB UART 2 Click or RS232 Click to connect to your PC, for development systems with no UART to USB interface available on the board. UART terminal is available in all Mikroelektronika compilers.


ALSO FROM THIS AUTHOR

LDC 1101 Click

0

LDC1101 Click is an inductance-to-digital converter Click Board. It is designed for a range of different applications, based on the inductivity measurements.

[Learn More]

Proximity 7 click

5

Proximity 7 Click is an advanced proximity and ambient light sensing Click board. It features the ADPS9930, a digital sensor IC equipped with two photodiodes (PD) and an IR LED, driven by a proprietary LED driver circuit.

[Learn More]

MICRF TX Click

0

MICRF TX Click is a compact add-on board designed as a powerful RF transmitter for data transmission over the 315MHz frequency band. This board features the MICRF112, a high-performance RF transmitter IC from Microchip, renowned for its efficiency in operation. This Click board™ stands out for its ease of use, requiring only a simple crystal oscillator to set the frequency, and supports both ASK and FSK modulation types with a Phase-Locked Loop (PLL) for stable frequency.

[Learn More]