TOP Contributors

  1. MIKROE (2784 codes)
  2. Alcides Ramos (386 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 (139927 times)
  2. FAT32 Library (72271 times)
  3. Network Ethernet Library (57454 times)
  4. USB Device Library (47768 times)
  5. Network WiFi Library (43396 times)
  6. FT800 Library (42721 times)
  7. GSM click (29985 times)
  8. mikroSDK (28505 times)
  9. PID Library (27001 times)
  10. microSD click (26407 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

Wirepas Click

Rating:

0

Author: MIKROE

Last Updated: 2024-10-31

Package Version: 2.1.0.16

mikroSDK Library: 2.0.0.0

Category: 2.4 GHz Transceivers

Downloaded: 353 times

Not followed.

License: MIT license  

Wirepas Click is a compact add-on board that allows you to implement the Wirepas Mesh wireless connectivity stack to your application. This board features the WIRL-PRO2 Thetis-I (2.1.0.1121010), a radio module with Wirepas Mesh Protocol from Würth Elektronik. It supports creating a Wirepas routing mesh protocol and is optimized for ultra-low energy consumption. The large scalability is ideal for extensive IoT networks and can work as a host-controlled device.

No Abuse Reported

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

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

Do you want to report abuse regarding "Wirepas Click".

  • Information
  • Comments (0)

mikroSDK Library Blog


Wirepas Click

Wirepas Click is a compact add-on board that allows you to implement the Wirepas Mesh wireless connectivity stack to your application. This board features the WIRL-PRO2 Thetis-I (2611011021010), a radio module with Wirepas Mesh Protocol from Würth Elektronik. It supports creating a Wirepas routing mesh protocol and is optimized for ultra-low energy consumption. The large scalability is ideal for extensive IoT networks and can work as a host-controlled device.

wirepas_click.png

Click Product page


Click library

  • Author : Stefan Ilic
  • Date : Jun 2023.
  • Type : UART type

Software Support

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

Standard key functions :

  • wirepas_cfg_setup Config Object Initialization function.

    void wirepas_cfg_setup ( wirepas_cfg_t *cfg );
  • wirepas_init Initialization function.

    err_t wirepas_init ( wirepas_t *ctx, wirepas_cfg_t *cfg );
  • wirepas_default_cfg Click Default Configuration function.

    void wirepas_default_cfg ( wirepas_t *ctx );

Example key functions :

  • wirepas_send_command Wirepas send command function.

    err_t wirepas_send_command ( wirepas_t *ctx, uint8_t primitive_id, uint8_t payload_length, uint8_t *payload );
  • wirepas_write_csap_attribute Wirepas write CSAP attribute function.

    err_t wirepas_write_csap_attribute ( wirepas_t *ctx, uint16_t attribute_id, uint8_t attribute_len, uint8_t *attribute_val );
  • wirepas_send_data Wirepas send data function.

    err_t wirepas_send_data ( wirepas_t *ctx, wirepas_sink_data sink_data, uint8_t tx_op, uint8_t apdu_length, uint8_t *apdu );

Example Description

This example demonstrates the use of Wirepas Click board by processing the incoming data and displaying them on the USB UART in sink mode, and sending data to the sinks in router mode.

The demo application is composed of two sections :

Application Init

Initializes the driver and performs the Click default configuration, setting device mode, node, net and channel addresses, and starting stack.


void application_init ( void ) 
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    wirepas_cfg_t wirepas_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.
    wirepas_cfg_setup( &wirepas_cfg );
    WIREPAS_MAP_MIKROBUS( wirepas_cfg, MIKROBUS_1 );
    if ( UART_ERROR == wirepas_init( &wirepas, &wirepas_cfg ) ) 
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }

    wirepas_default_cfg ( &wirepas );

    wirepas.tx_frame_id = 0;
    do
    {
        log_printf( &logger, " Wirepas stack stop request:" );
        wirepas_send_command( &wirepas, WIREPAS_MSAP_STACK_STOP_REQUEST, 0, NULL );
    }
    while ( WIREPAS_OK != wirepas_wait_response ( &wirepas, WIREPAS_MSAP_STACK_STOP_CONFIRM ) );
    Delay_ms ( 1000 );

    do
    {
        log_printf( &logger, " Wirepas factory reset request:" );
        wirepas_send_command( &wirepas, WIREPAS_CSAP_FACTORY_RESET_REQUEST,
                              strlen( WIREPAS_FACTORY_RESET_CODE ), WIREPAS_FACTORY_RESET_CODE );
    }
    while ( WIREPAS_OK != wirepas_wait_response ( &wirepas, WIREPAS_CSAP_FACTORY_RESET_CONFIRM ) );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );

    do
    {
        log_printf( &logger, " Set node address:" );
        wirepas_set_node_address( &wirepas, NODE_ADDRESS );
    }
    while ( WIREPAS_OK != wirepas_wait_response ( &wirepas, WIREPAS_CSAP_ATTRIBUTE_WRITE_CONFIRM ) );
    Delay_ms ( 1000 );

    do
    {
        log_printf( &logger, " Set net address:" );
        wirepas_set_net_address( &wirepas, NET_ADDRESS );
    }
    while ( WIREPAS_OK != wirepas_wait_response ( &wirepas, WIREPAS_CSAP_ATTRIBUTE_WRITE_CONFIRM ) );
    Delay_ms ( 1000 );

    uint8_t channel_net = CHANNEL_ADDRESS;
    do
    {
        log_printf( &logger, " Set channel address:" );
        wirepas_write_csap_attribute( &wirepas, WIREPAS_CSAP_ATTRIBUTE_NETWORK_CHANNEL, 1, &channel_net );
    }
    while ( WIREPAS_OK != wirepas_wait_response ( &wirepas, WIREPAS_CSAP_ATTRIBUTE_WRITE_CONFIRM ) );
    Delay_ms ( 1000 );


    uint8_t role;
#if ( ROUTER_NODE_ADDRESS == NODE_ADDRESS )
    role = WIREPAS_ROUTER_NODE_MODE;
#else
    role = WIREPAS_SINK_NODE_MODE;
#endif
    do
    {
        log_printf( &logger, " Set role:" );
        wirepas_write_csap_attribute( &wirepas, WIREPAS_CSAP_ATTRIBUTE_NODE_ROLE, 1, &role );
    }
    while ( WIREPAS_OK != wirepas_wait_response ( &wirepas, WIREPAS_CSAP_ATTRIBUTE_WRITE_CONFIRM ) );
    Delay_1sec( );

    do
    {
        log_printf( &logger, " Wirepas Stack start request:" ); 
        wirepas_send_command( &wirepas, WIREPAS_MSAP_STACK_START_REQUEST, 1, &stack_auto_start );
    }
    while ( WIREPAS_OK != wirepas_wait_response ( &wirepas, WIREPAS_MSAP_STACK_START_CONFIRM ) );
    Delay_1sec( );

#if ( ROUTER_NODE_ADDRESS == NODE_ADDRESS )

    sink_1.pduid = 0x00;
    sink_1.source_endpoint = 0x01;
    sink_1.destination_addr = SINK_1_NODE_ADDRESS;
    sink_1.destination_endpoint = 0x01;
    #if defined MULTI_SINK_MODE
        sink_2.pduid = 0x00;
        sink_2.source_endpoint = 0x01;
        sink_2.destination_addr = SINK_2_NODE_ADDRESS;
        sink_2.destination_endpoint = 0x01;
    #endif
#endif
    Delay_ms ( 100 );

    log_info( &logger, " Application Task " );
}

Application Task

Router mode - Sending data to the sinks at the same network. Sink mode - Reads and processes all incoming data and displays them on the USB UART.

void application_task ( void ) 
{
    wirepas_poll_indication ( &wirepas );
#if ( ROUTER_NODE_ADDRESS == NODE_ADDRESS )
    if ( wirepas_get_din_state ( &wirepas ) && ( pdu_capacity > 0 ) )
    {
        log_printf( &logger, " Sending data to the first Sink node: \n" );
        wirepas_send_data ( &wirepas,  sink_1, 0x01, strlen( TX_DATA ), TX_DATA );
        wirepas_wait_response ( &wirepas, WIREPAS_DSAP_DATA_TX_CONFIRM );
        Delay_ms ( 1000 );

        #if defined MULTI_SINK_MODE
            log_printf( &logger, " Sending data to the second Sink node: \n" );
            wirepas_send_data ( &wirepas,  sink_2, 0x01, strlen( TX_DATA ), TX_DATA );
            wirepas_wait_response ( &wirepas, WIREPAS_DSAP_DATA_TX_CONFIRM );
            Delay_ms ( 1000 );
        #endif
    }
#endif
}

Note

For the best experience use two clicks in sink mode and one in router.

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

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

4x4 RGB 2 Click

0

4x4 RGB 2 Click is a compact add-on board that contains a matrix of 16 intelligent RGB LEDs, forming a 4x4 display screen. This board features 16 IN-PC55TBTRGB, 5x5mm RGB LEDs with an integrated IC from Inolux. The LEDs feature an 8-bit color control in 256 steps (256-level greyscale) and a 5-bit brightness control in 32 steps. The intelligent LEDs are cascaded (daisy-chained); thus, every one of them can communicate with the host MCU using the same data lines.

[Learn More]

3D Hall 6 click

5

3D Hall 6 Click is a very accurate, magnetic field sensing Click board, used to measure the intensity of the magnetic field across three perpendicular axes. It is equipped with the MLX90380, a monolithic contactless sensor IC sensitive to the flux density applied orthogonally and parallel to the IC surface, from Melexis.

[Learn More]

Current click

0

This project is a simple demonstration of working with the <b>Current Click</b> board based on the MCP3201 12-bit Analog-to-Digital Converter (ADC) with SPI Interface. This example demosntrates measuring the current drawn by the consumer using a shunt resistor.

[Learn More]