TOP Contributors

  1. MIKROE (2762 codes)
  2. Alcides Ramos (374 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (118 codes)
  5. Bugz Bensce (91 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 (139270 times)
  2. FAT32 Library (71755 times)
  3. Network Ethernet Library (57128 times)
  4. USB Device Library (47432 times)
  5. Network WiFi Library (43093 times)
  6. FT800 Library (42408 times)
  7. GSM click (29835 times)
  8. mikroSDK (28103 times)
  9. PID Library (26886 times)
  10. microSD click (26198 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 12 Click

Rating:

0

Author: MIKROE

Last Updated: 2024-10-31

Package Version: 2.1.0.14

mikroSDK Library: 2.0.0.0

Category: BT/BLE

Downloaded: 218 times

Not followed.

License: MIT license  

BLE 12 Click is a compact add-on board that provides BT/BLE connectivity for any embedded application. This board features the BM832A, a powerful and highly flexible, ultra low power Bluetooth Low Energy (BLE) module from Fanstel. Based on the Nordic nRF52 SoC, the BM832A supports Bluetooth 5.0 Low-Energy (BLE) connectivity while delivering RF range and performance, debugging and enhanced security features, and low power consumption. It also comes with an ARM Cortex™ M4(F) MCU up to 192kB flash and 24kB RAM, embedded 2.4GHz multi-protocol transceiver, and an integrated PCB trace antenna. This Click board™ is suitable for low-cost Bluetooth low energy applications such as building automation and sensor networks, portable medical, connected home, and more.

No Abuse Reported

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

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

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

  • Information
  • Comments (0)

mikroSDK Library Blog


BLE 12 Click

BLE 12 Click is a compact add-on board that provides BT/BLE connectivity for any embedded application. This board features the BM832A, a powerful and highly flexible, ultra low power Bluetooth Low Energy (BLE) module from Fanstel. Based on the Nordic nRF52 SoC, the BM832A supports Bluetooth 5.0 Low-Energy (BLE) connectivity while delivering RF range and performance, debugging and enhanced security features, and low power consumption. It also comes with an ARM Cortex™ M4(F) MCU up to 192kB flash and 24kB RAM, embedded 2.4GHz multi-protocol transceiver, and an integrated PCB trace antenna. This Click board™ is suitable for low-cost Bluetooth low energy applications such as building automation and sensor networks, portable medical, connected home, and more.

ble12_click.png

Click Product page


Click library

  • Author : Nenad Filipovic
  • Date : Sep 2021.
  • Type : UART type

Software Support

We provide a library for the BLE12 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 BLE12 Click driver.

Standard key functions :

  • ble12_cfg_setup Config Object Initialization function.

    void ble12_cfg_setup ( ble12_cfg_t *cfg );
  • ble12_init Initialization function.

    err_t ble12_init ( ble12_t *ctx, ble12_cfg_t *cfg );
  • ble12_default_cfg Click Default Configuration function.

    err_t ble12_default_cfg ( ble12_t *ctx );

Example key functions :

  • ble12_set_device_name BLE 12 set device name function.

    err_t ble12_set_device_name ( ble12_t *ctx, uint8_t *device_name );
  • ble12_set_op_mode BLE 12 set operating mode function.

    err_t ble12_set_op_mode ( ble12_t *ctx, uint8_t op_mode );
  • ble12_send_cmd BLE 12 sends the command function.

    err_t ble12_send_cmd ( ble12_t *ctx, char *cmd );

Example Description

This example reads and processes data from BLE 12 Click board™.

The demo application is composed of two sections :

Application Init

Initializes UART driver and logs UART. After driver initialization, the app performs a wake-up module, enters command mode, sets the device name and advertising time interval, and disconnects all connections. After that, the blinking of the yellow LED Indicates that the BLE 12 Click board™ is ready for connection. After establishing the connection, the yellow LED is turned on.


void application_init ( void ) 
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    ble12_cfg_t ble12_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.
    ble12_cfg_setup( &ble12_cfg );
    BLE12_MAP_MIKROBUS( ble12_cfg, MIKROBUS_1 );
    if ( UART_ERROR == ble12_init( &ble12, &ble12_cfg ) ) 
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }

    if ( BLE12_ERROR == ble12_default_cfg ( &ble12 ) )
    {
        log_error( &logger, " Default configuration." );
        for ( ; ; );
    }

    app_buf_len = 0;
    app_buf_cnt = 0;
    Delay_ms ( 100 );
    log_info( &logger, " Application Task " );

    log_printf( &logger, "-------------------------------\r\n" );
    log_printf( &logger, "\t  BLE 12 Click\r\n" );
    log_printf( &logger, "-------------------------------\r\n" );
    log_printf( &logger, "\t  Command mode\r\n" );
    ble12_set_op_mode( &ble12, BLE12_OP_MODE_CMD );
    Delay_ms ( 100 );

    ble12_event_startup( &ble12 );
    Delay_ms ( 100 );

    ble12_set_led_state( &ble12, BLE12_LED_RED, BLE12_LED_OFF );
    ble12_set_led_state( &ble12, BLE12_LED_YELLOW, BLE12_LED_OFF );
    Delay_ms ( 100 );

    log_printf( &logger, "- - - - - - - - - - - - - - - -\r\n" );
    log_printf( &logger, "> Set device name:" );
    log_printf( &logger, " BLE 12 Click\r\n" );
    ble12_set_device_name( &ble12, "BLE 12 Click" );
    Delay_ms ( 100 );

    log_printf( &logger, "> Set Adv. Interval: 99 ms\r\n" );
    ble12_set_adv_interval( &ble12, "0099" );
    Delay_ms ( 100 );

    log_printf( &logger, "> Disconnect all connections\r\n" );
    ble12_disconnect( &ble12 );
    Delay_ms ( 100 );

    log_printf( &logger, "-------------------------------\r\n" );
    log_printf( &logger, "  Please connect your device\r\n" );

    do
    {
        ble12_process(); 
        ble12_set_led_state( &ble12, BLE12_LED_YELLOW, BLE12_LED_ON );
        Delay_ms ( 50 );
        ble12_set_led_state( &ble12, BLE12_LED_YELLOW, BLE12_LED_OFF );
        Delay_ms ( 50 );
    }
    while ( !strstr( app_buf, BLE12_EVT_CONNECTED ) );
    Delay_ms ( 100 );

    ble12_set_led_state( &ble12, BLE12_LED_RED, BLE12_LED_OFF );
    ble12_set_led_state( &ble12, BLE12_LED_YELLOW, BLE12_LED_ON );
    log_printf( &logger, "- - - - - - - - - - - - - - - -\r\n" );
    log_printf( &logger, "\tDevice connected\r\n" );
    Delay_ms ( 100 );

    ble12_set_op_mode( &ble12, BLE12_OP_MODE_DATA );
    log_printf( &logger, "-------------------------------\r\n" );
    log_printf( &logger, "\t    Data mode\r\n" );
    log_printf( &logger, "- - - - - - - - - - - - - - - -\r\n" );
    Delay_ms ( 100 );

    ble12_process();
    ble12_clear_app_buf( );
    Delay_ms ( 100 );
}

Application Task

This example demonstrates the use of the BLE 12 Click board™. Reads the received data and parses it. Results are being sent to the Usart Terminal, where you can track their changes.


void application_task ( void ) 
{      
    ble12_process();

    if ( app_buf_len > 0 ) 
    { 
        log_printf( &logger, "%s", app_buf );
        ble12_clear_app_buf(  );    
    }
}

Note

We have used the Serial Bluetooth Terminal Android application for the test and you can find it at the link: https://play.google.com/store/apps/details?id=de.kai_morich.serial_bluetooth_terminal

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.BLE12

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

Thermostat 3 click

5

Thermostat 3 Click is a general-purpose thermostat Click board designed to be used with any temperature sensor based on the MAX31855 sensor design.

[Learn More]

Battery Source Click

0

Battery Source Click is a compact add-on board designed to boost power from a battery for portable applications. This board features the TPS81256, a high-efficiency step-up converter from Texas Instruments. The board boosts input voltage (2.5V to 5.5V) to 5V/1A on a USB Type-C connector. It operates at a 4MHz switching frequency, enters Power-Save mode at light loads, and reduces supply current to 43μA during light load operation. The board supports over 3W output power and has an input current of less than 1µA in shutdown mode, maximizing battery life.

[Learn More]

RTK Rover Click

0

RTK Rover Click is a compact add-on board that enhances the precision of position data derived from compatible RTK Base Station. This board features Quectel’s LG69TAMMD, a dual-band multi-constellation GNSS module featuring a high-performance and high-reliability positioning engine. This module facilitates a fast and precise GNSS positioning capability for centimeter-level accuracy, featuring the fifth generation of STMicroelectronics® positioning receiver platform with 80 tracking and four fast acquisition channels. It supports up to 3 concurrent global constellations (GPS/QZSS, Galileo, and BDS) alongside NMEA 0183/RTCM 3.x protocol and commonly used UART interface.

[Learn More]