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.
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)
BLE 12 configuration object setup function.
BLE 12 Click configuration object.
Definition ble12.h:201
ble12_init
Initialization function.
err_t ble12_init(ble12_t *ctx, ble12_cfg_t *cfg)
BLE 12 initialization function.
BLE 12 Click context object.
Definition ble12.h:178
ble12_default_cfg
Click Default Configuration function.
err_t ble12_default_cfg(ble12_t *ctx)
BLE 12 default configuration function.
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)
BLE 12 set device name function.
ble12_set_op_mode
BLE 12 set operating mode function.
err_t ble12_set_op_mode(ble12_t *ctx, uint8_t op_mode)
BLE 12 set operating mode function.
ble12_send_cmd
BLE 12 sends the command function.
err_t ble12_send_cmd(ble12_t *ctx, char *cmd)
BLE 12 sends the command function.
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.
{
log_cfg_t log_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
if ( UART_ERROR ==
ble12_init( &ble12, &ble12_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
{
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" );
Delay_ms ( 100 );
Delay_ms ( 100 );
Delay_ms ( 100 );
log_printf( &logger, "- - - - - - - - - - - - - - - -\r\n" );
log_printf( &logger, "> Set device name:" );
log_printf( &logger, " BLE 12 Click\r\n" );
Delay_ms ( 100 );
log_printf( &logger, "> Set Adv. Interval: 99 ms\r\n" );
Delay_ms ( 100 );
log_printf( &logger, "> Disconnect all connections\r\n" );
Delay_ms ( 100 );
log_printf( &logger, "-------------------------------\r\n" );
log_printf( &logger, " Please connect your device\r\n" );
do
{
ble12_process();
Delay_ms ( 50 );
Delay_ms ( 50 );
}
Delay_ms ( 100 );
log_printf( &logger, "- - - - - - - - - - - - - - - -\r\n" );
log_printf( &logger, "\tDevice connected\r\n" );
Delay_ms ( 100 );
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 );
}
@ BLE12_ERROR
Definition ble12.h:228
#define BLE12_LED_RED
Definition ble12.h:129
#define BLE12_EVT_CONNECTED
BLE 12 respond event.
Definition ble12.h:120
#define BLE12_OP_MODE_CMD
Definition ble12.h:132
#define BLE12_LED_ON
Definition ble12.h:130
#define BLE12_LED_OFF
Definition ble12.h:131
#define BLE12_LED_YELLOW
BLE 12 control led.
Definition ble12.h:128
#define BLE12_OP_MODE_DATA
Definition ble12.h:133
#define BLE12_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition ble12.h:162
err_t ble12_set_adv_interval(ble12_t *ctx, uint8_t *adv_interval)
BLE 12 set adv interval function.
err_t ble12_event_startup(ble12_t *ctx)
BLE 12 event start-up function.
err_t ble12_disconnect(ble12_t *ctx)
BLE 12 disconnect function.
err_t ble12_set_led_state(ble12_t *ctx, uint8_t led, uint8_t state)
BLE 12 set LED state function.
void application_init(void)
Definition main.c:71
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.
{
ble12_process();
if ( app_buf_len > 0 )
{
log_printf( &logger, "%s", app_buf );
ble12_clear_app_buf( );
}
}
void application_task(void)
Definition main.c:168
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.