ZigBee click
ZigBee Click is a compact add-on board that contains a fully integrated Zigbee transceiver with a 32-bit ARMĀ® Cortex M3TM microprocessor, Flash and RAM memory, and peripherals. This board features the ETRX357, 2.4 GHz Zigbee Radio module from Silicon Labs, which has been designed to be easily integrated and to provide a fast, simple, and low-cost wireless mesh networking interface.
click Product page
Click library
- Author : Stefan Ilic
- Date : Oct 2021.
- Type : UART type
Software Support
We provide a library for the ZigBee 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 ZigBee Click driver.
Standard key functions :
zigbee_cfg_setup
Config Object Initialization function.
zigbee_init
Initialization function.
zigbee_default_cfg
Click Default Configuration function. err_t zigbee_default_cfg (
zigbee_t *ctx );
Example key functions :
zigbee_send_at
Function merges two string and sends it to device.
zigbee_resp
Function checking driver buffer string.
zigbee_set_pin_rst
Function setting RST pin status.
Example Description
This is an example that demonstrates the use of the ZigBee Click board.
The demo application is composed of two sections :
Application Init
Initialization of driver, UART ISR and then configures device. Depending on previous selected device mode it creates new PAN network or joins to one.
{
log_cfg_t log_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
if ( UART_ERROR ==
zigbee_init( &zigbee, &zigbee_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
log_printf( &logger, "------------------------------\r\n", app_buf );
log_printf( &logger, " Restarting Device \r\n" );
log_printf( &logger, "------------------------------\r\n", app_buf );
log_printf( &logger, " Sending command : AT \r\n", app_buf );
log_printf( &logger, "------------------------------\r\n", app_buf );
log_printf( &logger, " Sending command : AT + DASSL \r\n", app_buf );
log_printf( &logger, "------------------------------\r\n", app_buf );
log_printf( &logger, " Sending command : ATZ \r\n", app_buf );
log_printf( &logger, "------------------------------\r\n", app_buf );
log_printf( &logger, " Sending command : ATI \r\n", app_buf );
log_printf( &logger, "------------------------------\r\n", app_buf );
log_printf( &logger, " Sending command : AT + N \r\n", app_buf );
{
log_printf( &logger, "-----------------------------------\r\n", app_buf );
log_printf( &logger, " Sending command : AT + HOST CFG 1 \r\n", app_buf );
log_printf( &logger, "-----------------------------------\r\n", app_buf );
log_printf( &logger, " Sending command : AT + HOST CFG 2 \r\n", app_buf );
log_printf( &logger, "-----------------------------------\r\n", app_buf );
log_printf( &logger, " Sending command : AT + HOST CFG 3 \r\n", app_buf );
log_printf( &logger, "-----------------------------------\r\n", app_buf );
log_printf( &logger, " Sending command : AT + EN \r\n", app_buf );
}
{
log_printf( &logger, "-----------------------------------\r\n", app_buf );
log_printf( &logger, " Sending command : AT + JN \r\n", app_buf );
}
log_printf( &logger, "-----------------------------------\r\n", app_buf );
log_printf( &logger, " Sending command : AT + IDREQ \r\n", app_buf );
log_printf( &logger, "-----------------------------------\r\n", app_buf );
log_printf( &logger, " Sending command : AT + N \r\n", app_buf );
Delay_ms ( 1000 );
log_info( &logger, " Application Task " );
log_printf( &logger, "-----------------------------------\r\n", app_buf );
}
Application Task
Host mode: Broadcasts message 'MikroE' every 3 seconds. User mode: Cheks if something is received.
{
{
log_printf( &logger, "-----------------------------------\r\n", app_buf );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
}
{
log_printf( &logger, "-----------------------------------\r\n", app_buf );
}
}
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.ZigBee
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.