TOP Contributors

  1. MIKROE (2784 codes)
  2. Alcides Ramos (382 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (118 codes)
  5. Bugz Bensce (97 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 (139749 times)
  2. FAT32 Library (72170 times)
  3. Network Ethernet Library (57359 times)
  4. USB Device Library (47710 times)
  5. Network WiFi Library (43310 times)
  6. FT800 Library (42679 times)
  7. GSM click (29967 times)
  8. mikroSDK (28405 times)
  9. PID Library (26986 times)
  10. microSD click (26388 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

BEE Click

Rating:

0

Author: MIKROE

Last Updated: 2024-10-31

Package Version: 2.1.0.12

mikroSDK Library: 2.0.0.0

Category: ZigBee

Downloaded: 207 times

Not followed.

License: MIT license  

The Click is designed to run on 3.3V power supply only.

No Abuse Reported
  • mikroSDK Library 1.0.0.0
  • Comments (0)

mikroSDK Library Blog


BEE Click

BEE Click features MRF24J40MA 2.4 GHz IEEE 802.15.4 radio transceiver module from Microchip.

bee_click.png

Click Product page


Click library

  • Author : MikroE Team
  • Date : May 2020.
  • Type : SPI type

Software Support

We provide a library for the Bee 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 form compilers IDE(recommended way), or downloaded from our LibStock, or found on mikroE github account.

Library Description

This library contains API for Bee Click driver.

Standard key functions :

  • bee_cfg_setup Config Object Initialization function.

    void bee_cfg_setup ( bee_cfg_t *cfg );
  • bee_cfg_setup Config Object Initialization function.

    err_t bee_init ( bee_t *ctx, bee_cfg_t *cfg );

Example key functions :

  • bee_read_rx_fifo Read RX FIFO function

    void bee_read_rx_fifo ( bee_t *ctx, uint8_t *rx_data );
  • bee_write_tx_normal_fifo Write TX normal FIFO function

    void bee_write_tx_normal_fifo ( bee_t *ctx, uint16_t address_tx_normal_fifo, uint8_t *tx_data );

Examples Description

This example demonstrates the use of an BEE Click board by showing the communication between the two Click boards.

The demo application is composed of two sections :

Application Init

Initializes the driver and configures the Click board.


void application_init ( void )
{
    log_cfg_t log_cfg;
    bee_cfg_t cfg;
    /** 
     * 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.

    bee_cfg_setup( &cfg );
    BEE_MAP_MIKROBUS( cfg, MIKROBUS_1 );
    bee_init( &bee, &cfg );

    for ( uint8_t cnt = 0; cnt < 2; cnt++ )
    {
        short_address1[ cnt ] = 1;
        short_address2[ cnt ] = 2;
        pan_id1[ cnt ] = 3;
        pan_id2[ cnt ] = 3;
    }

    for ( uint8_t cnt = 0; cnt < 8; cnt++ )
    {
        long_address1[ cnt ] = 1;
        long_address2[ cnt ] = 2;
    }

    log_printf( &logger, "    Reset and WakeUp     \r\n"  );
    bee_hw_reset( &bee );
    bee_soft_reset( &bee );
    bee_rf_reset( &bee );
    bee_enable_immediate_wake_up( &bee );

#ifdef DEMO_APP_TRANSMITTER
    // Transmitter mode
    log_printf( &logger, " Application Mode: Transmitter\r\n" );
    tx_data_fifo[0]  = BEE_HEADER_LENGHT;
    tx_data_fifo[1]  = BEE_HEADER_LENGHT + BEE_DATA_LENGHT;
    tx_data_fifo[2]  = 0x01;                        // control frame
    tx_data_fifo[3]  = 0x88;
    tx_data_fifo[4]  = 0x23;                        // sequence number
    tx_data_fifo[5]  = pan_id2[1];                  // destinatoin pan
    tx_data_fifo[6]  = pan_id2[0];
    tx_data_fifo[7]  = short_address2[0];           // destination address
    tx_data_fifo[8]  = short_address2[1];
    tx_data_fifo[9]  = pan_id1[0];                  // source pan
    tx_data_fifo[10] = pan_id1[1];
    tx_data_fifo[11] = short_address1[0];           // source address
    tx_data_fifo[12] = short_address1[1];
    memcpy( &tx_data_fifo[ 13 ], &data_tx1[ 0 ], BEE_DATA_LENGHT );

    log_printf( &logger, "    Set address and PAN ID  \r\n" );
    bee_set_long_address( &bee, &long_address1 );
    bee_set_short_address( &bee, &short_address1 );
    bee_set_pan_id( &bee, &pan_id1 );
#else
    log_printf( &logger, " Application Mode: Receiver\r\n" );
    log_printf( &logger, "    Set address and PAN ID  \r\n" );
    bee_set_long_address( &bee, &long_address2 );
    bee_set_short_address( &bee, &short_address2 );
    bee_set_pan_id( &bee, &pan_id2 );
#endif
    log_printf( &logger, "    Init ZigBee module:    \r\n" );
    log_printf( &logger, " - Set nonbeacon-enabled \r\n" );
    bee_nonbeacon_init( &bee );

    log_printf( &logger, " - Set as PAN coordinator\r\n" );
    bee_nonbeacon_pan_coordinator_device( &bee );

    log_printf( &logger, " - Set max TX power\r\n" );
    bee_set_tx_power( &bee, 31 );

    log_printf( &logger, " - All frames 3, data frame\r\n" );
    bee_set_frame_format_filter( &bee, 1 );

    log_printf( &logger, " - Set normal mode\r\n"  );
    bee_set_reception_mode( &bee, 1 );

    log_printf( &logger, " - Device Wake Up\r\n"  );
    bee_hw_wake_up( &bee );
    bee_read_byte_short( &bee, BEE_INTSTAT ); // clears status register

    Delay_1sec( );
}

Application Task

Depending on the selected application mode, it reads all the received data or sends the desired message every 3 seconds.


void application_task ( void )
{
#ifdef DEMO_APP_TRANSMITTER
    // Transmitter mode
    memcpy( &tx_data_fifo[ 13 ], &data_tx1[ 0 ], BEE_DATA_LENGHT);
    bee_write_tx_normal_fifo( &bee, 0, &tx_data_fifo[ 0 ] );
    log_printf( &logger, " - Sent data :   " );
    log_printf( &logger, "%.6s \r\n", data_tx1 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    memcpy( &tx_data_fifo[ 13 ], &data_tx2[ 0 ], BEE_DATA_LENGHT );
    bee_write_tx_normal_fifo( &bee, 0, &tx_data_fifo[ 0 ] );
    log_printf( &logger, " - Sent data :   " );
    log_printf( &logger, "%.6s \r\n", data_tx2 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
#else
    // Receiver mode
    bee_read_rx_fifo( &bee, &rx_data_fifo[ 0 ] );

    if ( memcmp( &rx_data_fifo_old[ 0 ], &rx_data_fifo[ 0 ], BEE_DATA_LENGHT ) )
    {
        memcpy( &rx_data_fifo_old [ 0 ], &rx_data_fifo[ 0 ], BEE_DATA_LENGHT );
        log_printf( &logger, " - Received data :   " );
        log_printf( &logger, "%.6s \r\n", rx_data_fifo );
        Delay_ms ( 1000 );
        Delay_ms ( 500 );
    }
    Delay_ms ( 500 );
#endif
}  

The full application code, and ready to use projects can be installed directly form compilers IDE(recommneded) or found on LibStock page or mikroE GitHub accaunt.

Other mikroE Libraries used in the example:

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.Bee

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. The terminal available in all Mikroelektronika compilers, or any other terminal application of your choice, can be used to read the message.


ALSO FROM THIS AUTHOR

CO2 Click

0

CO2 Click is a compact add-on board that contains Sensirion miniature CO2 sensor. This board features the STC31, a gas concentration sensor designed for high-volume applications. The STC31 utilizes a revolutionized thermal conductivity measurement principle, which results in superior repeatability and long-term stability. The outstanding performance of these sensors is based on Sensirion’s patented CMOSens® sensor technology, which combines the sensor element, signal processing, and digital calibration on a small CMOS chip. It features a digital I2C interface, which makes it easy to connect directly to MCU. This Click board™ represents an ideal choice for health, environmental, industrial, residential monitoring of high CO2 concentrations and applications where reliability is crucial.

[Learn More]

H-Bridge 8 Click

0

H-Bridge 8 Click is a compact add-on board that contains H-bridge current regulator. This board features the MP6519, a monolithic, step-down, current-source driver for applications that require accurate and fast current-response control from Monolithic Power Systems (MPS). It achieves excellent load and line regulation over a wide input supply range up to 28V. The four integrated MOSFET H-bridge control provide a fast dynamic load response and an ultra-high efficiency solution. Complete protection features include load open, load-short protection, over-current protection (OCP), over-temperature protection (OTP), and input over-voltage protection (OVP). This Click board™ is suitable as a current-regulator brushed DC motor/solenoid driver for various applications

[Learn More]

Compass 3 click

5

Compass 3 Click features MMC5883MA, a complete 3-axis magnetic sensor with on-chip signal processing and integrated I2C bus suitable for use in various applications.

[Learn More]
Close menu