TOP Contributors

  1. MIKROE (2656 codes)
  2. Alcides Ramos (353 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (112 codes)
  5. Chisanga Mumba (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 (136817 times)
  2. FAT32 Library (69983 times)
  3. Network Ethernet Library (55953 times)
  4. USB Device Library (46274 times)
  5. Network WiFi Library (41892 times)
  6. FT800 Library (41203 times)
  7. GSM click (28990 times)
  8. PID Library (26420 times)
  9. mikroSDK (26376 times)
  10. microSD click (25383 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

ZigBee click

Rating:

0

Author: MIKROE

Last Updated: 2024-04-03

Package Version: 2.1.0.10

mikroSDK Library: 2.0.0.0

Category: ZigBee

Downloaded: 76 times

Not followed.

License: MIT license  

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.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "ZigBee click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "ZigBee click" changes.

Do you want to report abuse regarding "ZigBee click".

  • mikroSDK Library 1.0.0.0
  • Comments (0)

mikroSDK Library Blog


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.

zigbee_click.png

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.

    void zigbee_cfg_setup ( zigbee_cfg_t *cfg );
  • zigbee_init Initialization function.

    err_t zigbee_init ( zigbee_t *ctx, zigbee_cfg_t *cfg );
  • 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.

    void zigbee_send_at ( zigbee_t *ctx, uint8_t *at_buf, uint8_t *suffix_buf );
  • zigbee_resp Function checking driver buffer string.

    uint8_t zigbee_resp ( zigbee_t *ctx, char *data_in );
  • zigbee_set_pin_rst Function setting RST pin status.

    void zigbee_set_pin_rst ( zigbee_t *ctx, uint8_t 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.


void application_init ( void ) 
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    zigbee_cfg_t zigbee_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 " );
    app_mode = ZIGBEE_APP_INIT;
    dev_mode = ZIGBEE_DEV_USER;

    // Click initialization.
    zigbee_cfg_setup( &zigbee_cfg );
    ZIGBEE_MAP_MIKROBUS( zigbee_cfg, MIKROBUS_1 );
    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" );
    zigbee_restart( &zigbee );

    log_printf( &logger, "------------------------------\r\n", app_buf );
    log_printf( &logger, " Sending command : AT \r\n", app_buf );
    zigbee_send_cmd( &zigbee, ZIGBEE_CMD_AT );
    resp_wait( &zigbee );

    log_printf( &logger, "------------------------------\r\n", app_buf );
    log_printf( &logger, " Sending command : AT + DASSL \r\n", app_buf );
    zigbee_send_cmd( &zigbee, ZIGBEE_CMD_AT_DASSL );
    resp_wait( &zigbee );

    log_printf( &logger, "------------------------------\r\n", app_buf );
    log_printf( &logger, " Sending command : ATZ \r\n", app_buf );
    zigbee_send_cmd( &zigbee, ZIGBEE_CMD_ATZ );
    resp_wait( &zigbee );

    log_printf( &logger, "------------------------------\r\n", app_buf );
    log_printf( &logger, " Sending command : ATI \r\n", app_buf );
    zigbee_send_cmd( &zigbee, ZIGBEE_CMD_ATI );
    resp_wait( &zigbee );

    log_printf( &logger, "------------------------------\r\n", app_buf );
    log_printf( &logger, " Sending command : AT + N \r\n", app_buf );
    zigbee_send_cmd( &zigbee, ZIGBEE_CMD_AT_N );
    resp_wait( &zigbee );

    if ( ZIGBEE_DEV_HOST == dev_mode )
    {
        // Setting the device into host mode and creating a network for other devices to connect.
        log_printf( &logger, "-----------------------------------\r\n", app_buf );
        log_printf( &logger, " Sending command : AT + HOST CFG 1 \r\n", app_buf );
        zigbee_send_at( &zigbee, ZIGBEE_CMD_ATS, &AT_HOST_CFG1[ 0 ] );
        resp_wait( &zigbee );
        log_printf( &logger, "-----------------------------------\r\n", app_buf );
        log_printf( &logger, " Sending command : AT + HOST CFG 2 \r\n", app_buf );
        zigbee_send_at( &zigbee, ZIGBEE_CMD_ATS, &AT_HOST_CFG2[ 0 ] );
        resp_wait( &zigbee );
        log_printf( &logger, "-----------------------------------\r\n", app_buf );
        log_printf( &logger, " Sending command : AT + HOST CFG 3 \r\n", app_buf );
        zigbee_send_at( &zigbee, ZIGBEE_CMD_ATS, &AT_HOST_CFG3[ 0 ] );
        resp_wait( &zigbee );
        log_printf( &logger, "-----------------------------------\r\n", app_buf );
        log_printf( &logger, " Sending command : AT + EN \r\n", app_buf );
        zigbee_send_cmd( &zigbee, ZIGBEE_CMD_AT_EN );
        resp_wait( &zigbee );
    }
    else if ( ZIGBEE_DEV_USER == dev_mode )
    {
        // Setting the device into user mode and joining the existing network.
        log_printf( &logger, "-----------------------------------\r\n", app_buf );
        log_printf( &logger, " Sending command : AT + JN \r\n", app_buf );
        zigbee_send_cmd( &zigbee, ZIGBEE_CMD_AT_JN );
        resp_wait( &zigbee );
    }

    log_printf( &logger, "-----------------------------------\r\n", app_buf );
    log_printf( &logger, " Sending command : AT + IDREQ \r\n", app_buf );
    zigbee_send_cmd( &zigbee, ZIGBEE_CMD_AT_IDREQ );
    resp_wait( &zigbee );

    log_printf( &logger, "-----------------------------------\r\n", app_buf );
    log_printf( &logger, " Sending command : AT + N \r\n", app_buf );
    zigbee_send_cmd( &zigbee, ZIGBEE_CMD_AT_N );
    resp_wait( &zigbee );

    Delay_ms ( 1000 );
    app_mode = ZIGBEE_APP_TASK;

    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.


void application_task ( void ) 
{
    if ( ZIGBEE_DEV_HOST == dev_mode )
    {
        log_printf( &logger, "-----------------------------------\r\n", app_buf );
        zigbee_send_at( &zigbee, ZIGBEE_CMD_AT_BCAST, &AT_BCAST_MSG[ 0 ] );
        resp_wait( &zigbee );
        Delay_ms ( 1000 );
        Delay_ms ( 1000 );
        Delay_ms ( 1000 );
    }
    else if ( ZIGBEE_DEV_USER == dev_mode )
    {
        resp_wait( &zigbee );
        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.


ALSO FROM THIS AUTHOR

Charger 27 click

0

Charger 27 Click is a compact add-on board that provides a single-cell charging solution. This board features the MP2639B, a Li-Ion or Li-Polymer switching charger from MPS. It is a highly integrated, flexible switch-mode battery charging management device for a single-cell battery for various portable applications. It uses a 4.5V up to 16V external input voltage to provide up to 2A of programmable charging current.

[Learn More]

ADC 11 click

0

ADC 11 Click is a compact add-on board that contains a high-performance data converter. This board features the LTC1864, a 16-bit 250ksps analog-to-digital converter from Analog Devices. With a typical supply current of only 850µA at the maximum sampling frequency, the LTC1864 is among the lowest power consumption ADCs available. After conversion, the LTC1864 goes into a low-power Sleep mode, further reducing the supply current. That’s why it can run at proper micro-power levels in applications that do not require the maximum sampling rate of the LTC1864. This Click board™ is suitable for high-speed data acquisition, low power battery-operated instrumentation, isolated and remote data acquisition, and many other applications.

[Learn More]

ATA6570 click

0

ATA6570 click is an automotive diagnostic tool that allows CAN bus interfacing, in a series of click boards aimed towards automotive diagnostics.

[Learn More]