Intermediate
20 min

Achieve long-range IoT connectivity with Wio-E5-LE and ATmega328P

Ultra-low-power long-range IoT communication solution

LR 15 Click with Arduino UNO Rev3

Published Jan 21, 2025

Click board™

LR 15 Click

Dev. board

Arduino UNO Rev3

Compiler

NECTO Studio

MCU

ATmega328P

Ultra-low-power, long-range IoT connectivity with reliable LoRaWAN® support

A

A

Hardware Overview

How does it work?

LR 15 Click is based on the Wio-E5-LE, a LoRaWAN® module from Seeed Studio designed for ultra-low-power long-range communication. As the newest innovation in the Wio-E5 series, the Wio-E5-LE redefines power efficiency, offering remarkably low power consumption while delivering high-performance wireless communication. Built around the STM32WLE5JC system-on-chip (SoC) from STMicroelectronics, the module integrates a high-performance SX126X LoRa® chip with an ultra-low-power microcontroller, making it a perfect choice for a wide range of IoT applications requiring reliable and energy-efficient operation including wireless meter reading, sensor networks, and other low-power wide-area network (LPWAN) use cases. Supporting both LoRa® and (G)FSK modulation modes, the Wio-E5-LE provides many communication capabilities. LoRa® mode offers adjustable bandwidths of 62.5kHz, 125kHz, 250kHz, and 500kHz, allowing users to optimize performance based on specific application requirements. With a transmission output power of 14dBm at 868/915MHz, an exceptional sensitivity of -136.5dBm at SF12 with 125kHz bandwidth, and an impressive link budget of 158dB, this module ensures reliable and long-range connectivity even

in challenging environments. It has an embedded LoRaWAN® protocol and AT command support, enabling seamless integration and efficient operation across global frequency plans such as EU868, US915, AU915, AS923, KR920, and IN865. This Click board™ is designed in a unique format supporting the newly introduced MIKROE feature called "Click Snap." Unlike the standardized version of Click boards, this feature allows the main module area to become movable by breaking the PCB, opening up many new possibilities for implementation. Thanks to the Snap feature, the Wio-E5-LE can operate autonomously by accessing its signals directly on the pins marked 1-8. Additionally, the Snap part includes a specified and fixed screw hole position, enabling users to secure the Snap board in their desired location. The LR 15 Click communicates with the host MCU through a UART interface and AT commands via standard UART RX and TX pins. The default communication speed is set at 115200bps, ensuring efficient data exchange. It also provides an I2C interface. Still, it must be noted that the I2C interface can only be operated in the peripheral mode. In addition to the interface pins, the board features a reset (RST) pin and a RESET button for hard resetting the module

when necessary. The built-in AT command firmware on the module can be upgraded using the UART interface. This enables programming when the module is set to boot mode, which is activated by pressing the dedicated BOOT button on the board, simplifying the firmware upgrade process. Additionally, users can develop custom software using the module's internal MCU. This is supported by the SWD interface, which allows for efficient program erasure and reprogramming and provides flexibility for advanced development and customization. The board features one u.Fl connector for the main LTE antenna that MIKROE offers, like the ISM 868/915MHz Active PCB Antenna for efficient connectivity. In addition to the antenna connector, the board also includes SWD pads designed for use with MIKROE's 6-pin Needle Cable, providing an optional flash and debug SWD (Serial Wire Debug) interface functionality. This Click board™ can be operated only with a 3.3V logic voltage level. The board must perform appropriate logic voltage level conversion before using MCUs with different logic levels. It also comes equipped with a library containing functions and example code that can be used as a reference for further development.

LR 15 Click hardware overview image

Features overview

Development board

Arduino UNO is a versatile microcontroller board built around the ATmega328P chip. It offers extensive connectivity options for various projects, featuring 14 digital input/output pins, six of which are PWM-capable, along with six analog inputs. Its core components include a 16MHz ceramic resonator, a USB connection, a power jack, an

ICSP header, and a reset button, providing everything necessary to power and program the board. The Uno is ready to go, whether connected to a computer via USB or powered by an AC-to-DC adapter or battery. As the first USB Arduino board, it serves as the benchmark for the Arduino platform, with "Uno" symbolizing its status as the

first in a series. This name choice, meaning "one" in Italian, commemorates the launch of Arduino Software (IDE) 1.0. Initially introduced alongside version 1.0 of the Arduino Software (IDE), the Uno has since become the foundational model for subsequent Arduino releases, embodying the platform's evolution.

Arduino UNO Rev3 double side image

Microcontroller Overview

MCU Card / MCU

default

Architecture

AVR

MCU Memory (KB)

32

Silicon Vendor

Microchip

Pin count

28

RAM (Bytes)

2048

You complete me!

Accessories

Click Shield for Arduino UNO has two proprietary mikroBUS™ sockets, allowing all the Click board™ devices to be interfaced with the Arduino UNO board without effort. The Arduino Uno, a microcontroller board based on the ATmega328P, provides an affordable and flexible way for users to try out new concepts and build prototypes with the ATmega328P microcontroller from various combinations of performance, power consumption, and features. The Arduino Uno has 14 digital input/output pins (of which six can be used as PWM outputs), six analog inputs, a 16 MHz ceramic resonator (CSTCE16M0V53-R0), a USB connection, a power jack, an ICSP header, and reset button. Most of the ATmega328P microcontroller pins are brought to the IO pins on the left and right edge of the board, which are then connected to two existing mikroBUS™ sockets. This Click Shield also has several switches that perform functions such as selecting the logic levels of analog signals on mikroBUS™ sockets and selecting logic voltage levels of the mikroBUS™ sockets themselves. Besides, the user is offered the possibility of using any Click board™ with the help of existing bidirectional level-shifting voltage translators, regardless of whether the Click board™ operates at a 3.3V or 5V logic voltage level. Once you connect the Arduino UNO board with our Click Shield for Arduino UNO, you can access hundreds of Click boards™, working with 3.3V or 5V logic voltage levels.

Click Shield for Arduino UNO accessories 1 image

ISM 868/915MHz Active FPC Antenna (W3312B0100) is a powerful multiband active flat patch antenna from Pulse Electronics ideal for use in LPWA applications. This compact yet efficient flat patch antenna, designed for use in the 868MHz and 915MHz frequency bands, boasts a gain of typical 0.8dBi and a 75x15mm size. With a nominal impedance of 50Ω, it seamlessly integrates with your existing setup. The FPC material used in the antenna guarantees both durability and reliability, while its 2W power rating ensures consistent and trustworthy performance. It includes a 100mm OD coax cable with a U.FL connector, enabling seamless connectivity. Moreover, the W3312B0100 antenna provides convenient and secure mounting options through its flexible PCB thickness of 0.1mm and adhesive tape on the backside. This antenna offers reliable performance and versatility, whether for LoRaWAN®, Sigfox®, WiFi HaLow™, or other ISM and remote control applications. Additionally, it caters to various industries, including M2M, IoT, metering, and industrial automation, making it an excellent choice for a wide range of applications.

LR 15 Click accessories 1 image

6-pin Needle Cable is a compact programming cable made from high-quality materials for longevity and easy portability with a tiny square footprint, similar to a 0805 resistor. Designed for quick programming and debugging, it features a 6-pin 0.1″ pitch ribbon connector and is hand-held or temporarily fixable.

LR 15 Click accessories 2 image

Used MCU Pins

mikroBUS™ mapper

NC
NC
AN
Reset
PD2
RST
ID COMM
PB2
CS
NC
NC
SCK
NC
NC
MISO
NC
NC
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
Boot Mode Control
PD6
PWM
NC
NC
INT
UART TX
PD0
TX
UART RX
PD1
RX
I2C Clock
PC5
SCL
I2C Data
PC4
SDA
NC
NC
5V
Ground
GND
GND
1

Take a closer look

Click board™ Schematic

LR 15 Click Schematic schematic

Step by step

Project assembly

Click Shield for Arduino UNO front image hardware assembly

Start by selecting your development board and Click board™. Begin with the Arduino UNO Rev3 as your development board.

Click Shield for Arduino UNO front image hardware assembly
Arduino UNO Rev3 front image hardware assembly
Charger 27 Click front image hardware assembly
Prog-cut hardware assembly
Charger 27 Click complete accessories setup image hardware assembly
Arduino UNO Rev3 Access MB 1 - upright/background hardware assembly
Necto image step 2 hardware assembly
Necto image step 3 hardware assembly
Necto image step 4 hardware assembly
Necto image step 5 hardware assembly
Necto image step 6 hardware assembly
Arduino UNO MCU Step hardware assembly
Necto No Display image step 8 hardware assembly
Necto image step 9 hardware assembly
Necto image step 10 hardware assembly
Debug Image Necto Step hardware assembly

Track your results in real time

Application Output

1. Application Output - In Debug mode, the 'Application Output' window enables real-time data monitoring, offering direct insight into execution results. Ensure proper data display by configuring the environment correctly using the provided tutorial.

2. UART Terminal - Use the UART Terminal to monitor data transmission via a USB to UART converter, allowing direct communication between the Click board™ and your development system. Configure the baud rate and other serial settings according to your project's requirements to ensure proper functionality. For step-by-step setup instructions, refer to the provided tutorial.

3. Plot Output - The Plot feature offers a powerful way to visualize real-time sensor data, enabling trend analysis, debugging, and comparison of multiple data points. To set it up correctly, follow the provided tutorial, which includes a step-by-step example of using the Plot feature to display Click board™ readings. To use the Plot feature in your code, use the function: plot(*insert_graph_name*, variable_name);. This is a general format, and it is up to the user to replace 'insert_graph_name' with the actual graph name and 'variable_name' with the parameter to be displayed.

Software Support

Library Description

LR 15 Click demo application is developed using the NECTO Studio, ensuring compatibility with mikroSDK's open-source libraries and tools. Designed for plug-and-play implementation and testing, the demo is fully compatible with all development, starter, and mikromedia boards featuring a mikroBUS™ socket.

Example Description
This example demonstrates the use of LR 15 Click board by showing the communication between two Click boards configured in TEST mode.

Key functions:

  • lr15_cfg_setup - Config Object Initialization function.

  • lr15_init - Initialization function.

  • lr15_reset_device - This function resets the device by toggling the reset pin logic state.

  • lr15_cmd_run - This function sends a specified command to the Click module.

  • lr15_cmd_set - This function sets a value to a specified command of the Click module.

Application Init
Initializes the driver and logger.

Application Task
Application task is split in few stages:

  • LR15_POWER_UP: Powers up the device, performs a device factory reset and reads system information.

  • LR15_CONFIG_EXAMPLE: Configures device for the LoRa P2P network mode.

  • LR15_EXAMPLE: Performs a LoRa P2P test example by exchanging messages with another LR 14 Click board.

Open Source

Code example

The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.

/*!
 * @file main.c
 * @brief LR 15 Click Example.
 *
 * # Description
 * This example demonstrates the use of LR 15 Click board by showing
 * the communication between two Click boards configured in TEST mode.
 *
 * The demo application is composed of two sections :
 *
 * ## Application Init
 * Initializes the driver and logger.
 *
 * ## Application Task
 * Application task is split in few stages:
 *  - LR15_POWER_UP:
 * Powers up the device, performs a device factory reset and reads system information.
 *  - LR15_CONFIG_EXAMPLE:
 * Configures device for the LoRa P2P network mode.
 *  - LR15_EXAMPLE:
 * Performs a LoRa P2P test example by exchanging messages with another LR 15 Click board.
 *
 * ## Additional Function
 * - static void lr15_clear_app_buf ( void )
 * - static void lr15_log_app_buf ( void )
 * - static err_t lr15_process ( lr15_t *ctx )
 * - static err_t lr15_read_response ( lr15_t *ctx, uint8_t *rsp, uint32_t timeout )
 * - static err_t lr15_power_up ( lr15_t *ctx )
 * - static err_t lr15_config_example ( lr15_t *ctx )
 * - static err_t lr15_example ( lr15_t *ctx )
 *
 * @author Stefan Filipovic
 *
 */

#include "board.h"
#include "log.h"
#include "lr15.h"
#include "conversions.h"
#include "generic_pointer.h"

#define DEMO_TEXT_MESSAGE   "MIKROE - LR 15 Click board"

static lr15_t lr15;
static log_t logger;

// Application buffer size
#define APP_BUFFER_SIZE     600
#define PROCESS_BUFFER_SIZE 200

static uint8_t app_buf[ APP_BUFFER_SIZE ] = { 0 };
static int32_t app_buf_len = 0;

/**
 * @brief Example states.
 * @details Predefined enum values for application example state.
 */
typedef enum
{
    LR15_POWER_UP = 1,
    LR15_CONFIG_EXAMPLE,
    LR15_EXAMPLE

} lr15_app_state_t;

static lr15_app_state_t app_state = LR15_POWER_UP;

/**
 * @brief LR 15 clearing application buffer.
 * @details This function clears memory of application buffer and reset its length.
 * @note None.
 */
static void lr15_clear_app_buf ( void );

/**
 * @brief LR 15 log application buffer.
 * @details This function logs data from application buffer to USB UART.
 * @note None.
 */
static void lr15_log_app_buf ( void );

/**
 * @brief LR 15 data reading function.
 * @details This function reads data from device and concatenates data to application buffer. 
 * @param[in] ctx : Click context object.
 * See #lr15_t object definition for detailed explanation.
 * @return @li @c  0 - Read some data.
 *         @li @c -1 - Nothing is read.
 * See #err_t definition for detailed explanation.
 * @note None.
 */
static err_t lr15_process ( lr15_t *ctx );

/**
 * @brief LR 15 read response function.
 * @details This function waits for a response message, reads and displays it on the USB UART.
 * @param[in] ctx : Click context object.
 * See #lr15_t object definition for detailed explanation.
 * @param[in] rsp : Expected response.
 * @param[in] timeout : Response timeout in milliseconds.
 * @return @li @c  0 - OK response.
 *         @li @c -2 - Timeout error.
 *         @li @c -3 - Command error.
 * See #err_t definition for detailed explanation.
 * @note None.
 */
static err_t lr15_read_response ( lr15_t *ctx, uint8_t *rsp, uint32_t timeout );

/**
 * @brief LR 15 power up function.
 * @details This function powers up the device, performs device factory reset and
 * reads system information.
 * @param[in] ctx : Click context object.
 * See #lr15_t object definition for detailed explanation.
 * @return @li @c    0 - OK.
 *         @li @c != 0 - Read response error.
 * See #err_t definition for detailed explanation.
 * @note None.
 */
static err_t lr15_power_up ( lr15_t *ctx );

/**
 * @brief LR 15 config example function.
 * @details This function configures device for LoRa P2P example.
 * @param[in] ctx : Click context object.
 * See #lr15_t object definition for detailed explanation.
 * @return @li @c    0 - OK.
 *         @li @c != 0 - Read response error.
 * See #err_t definition for detailed explanation.
 * @note None.
 */
static err_t lr15_config_example ( lr15_t *ctx );

/**
 * @brief LR 15 example function.
 * @details This function performs a LoRa P2P test example by exchanging messages
 * with another LR 15 Click board.
 * @param[in] ctx : Click context object.
 * See #lr15_t object definition for detailed explanation.
 * @return @li @c    0 - OK.
 *         @li @c != 0 - Read response error.
 * See #err_t definition for detailed explanation.
 * @note None.
 */
static err_t lr15_example ( lr15_t *ctx );

void application_init ( void ) 
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    lr15_cfg_t lr15_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.
    lr15_cfg_setup( &lr15_cfg );
    LR15_MAP_MIKROBUS( lr15_cfg, MIKROBUS_1 );
    if ( UART_ERROR == lr15_init( &lr15, &lr15_cfg ) ) 
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }

    log_info( &logger, " Application Task " );

    app_state = LR15_POWER_UP;
    log_printf( &logger, ">>> APP STATE - POWER UP <<<\r\n\n" );
}

void application_task ( void ) 
{
    switch ( app_state )
    {
        case LR15_POWER_UP:
        {
            if ( LR15_OK == lr15_power_up( &lr15 ) )
            {
                app_state = LR15_CONFIG_EXAMPLE;
                log_printf( &logger, ">>> APP STATE - CONFIG EXAMPLE <<<\r\n\n" );
            }
            break;
        }
        case LR15_CONFIG_EXAMPLE:
        {
            if ( LR15_OK == lr15_config_example( &lr15 ) )
            {
                app_state = LR15_EXAMPLE;
                log_printf( &logger, ">>> APP STATE - EXAMPLE <<<\r\n\n" );
            }
            break;
        }
        case LR15_EXAMPLE:
        {
            lr15_example( &lr15 );
            break;
        }
        default:
        {
            log_error( &logger, " APP STATE." );
            break;
        }
    }
}

int main ( void ) 
{
    /* Do not remove this line or clock might not be set correctly. */
    #ifdef PREINIT_SUPPORTED
    preinit();
    #endif
    
    application_init( );
    
    for ( ; ; ) 
    {
        application_task( );
    }

    return 0;
}

static void lr15_clear_app_buf ( void ) 
{
    memset( app_buf, 0, app_buf_len );
    app_buf_len = 0;
}

static void lr15_log_app_buf ( void )
{
    for ( int32_t buf_cnt = 0; buf_cnt < app_buf_len; buf_cnt++ )
    {
        log_printf( &logger, "%c", app_buf[ buf_cnt ] );
    }
}

static err_t lr15_process ( lr15_t *ctx ) 
{
    uint8_t rx_buf[ PROCESS_BUFFER_SIZE ] = { 0 };
    int32_t overflow_bytes = 0;
    int32_t rx_cnt = 0;
    int32_t rx_size = lr15_generic_read( ctx, rx_buf, PROCESS_BUFFER_SIZE );
    if ( ( rx_size > 0 ) && ( rx_size <= APP_BUFFER_SIZE ) ) 
    {
        if ( ( app_buf_len + rx_size ) > APP_BUFFER_SIZE ) 
        {
            overflow_bytes = ( app_buf_len + rx_size ) - APP_BUFFER_SIZE;
            app_buf_len = APP_BUFFER_SIZE - rx_size;
            memmove ( app_buf, &app_buf[ overflow_bytes ], app_buf_len );
            memset ( &app_buf[ app_buf_len ], 0, overflow_bytes );
        }
        for ( rx_cnt = 0; rx_cnt < rx_size; rx_cnt++ ) 
        {
            if ( rx_buf[ rx_cnt ] ) 
            {
                app_buf[ app_buf_len++ ] = rx_buf[ rx_cnt ];
            }
        }
        return LR15_OK;
    }
    return LR15_ERROR;
}

static err_t lr15_read_response ( lr15_t *ctx, uint8_t *rsp, uint32_t timeout ) 
{
    uint32_t timeout_cnt = 0;
    lr15_clear_app_buf ( );
    lr15_process( ctx );
    while ( ( 0 == strstr( app_buf, rsp ) ) &&
            ( 0 == strstr( app_buf, LR15_RSP_ERROR ) ) )
    {
        lr15_process( ctx );
        if ( timeout_cnt++ > timeout )
        {
            lr15_log_app_buf( );
            log_error( &logger, " Timeout!" );
            return LR15_ERROR_TIMEOUT;
        }
        Delay_ms( 1 );
    }
    Delay_ms ( 200 );
    lr15_process( ctx );
    lr15_log_app_buf( );
    if ( strstr( app_buf, LR15_RSP_ERROR ) )
    {
        log_error( &logger, " CMD!" );
        return LR15_ERROR_CMD;
    }
    log_printf( &logger, "--------------------------------\r\n" );
    return LR15_OK;
}

static err_t lr15_power_up ( lr15_t *ctx )
{
    err_t error_flag = LR15_OK;
    
    log_printf( &logger, ">>> Reset device.\r\n" );
    lr15_reset_device( &lr15 );
    while ( LR15_OK == lr15_process( ctx ) )
    {
        lr15_log_app_buf( );
        lr15_clear_app_buf ( );
    }
    log_printf( &logger, "--------------------------------\r\n" );

    log_printf( &logger, ">>> Check communication.\r\n" );
    lr15_cmd_run( &lr15, LR15_CMD_AT );
    error_flag |= lr15_read_response( &lr15, LR15_RSP_AT, LR15_RSP_TIMEOUT_DEFAULT );

    log_printf( &logger, ">>> Factory reset.\r\n" );
    lr15_cmd_run( &lr15, LR15_CMD_FDEFAULT );
    error_flag |= lr15_read_response( &lr15, LR15_RSP_FDEFAULT, LR15_RSP_TIMEOUT_DEFAULT );

    log_printf( &logger, ">>> Get device firmware version.\r\n" );
    lr15_cmd_get( ctx, LR15_CMD_VER );
    error_flag |= lr15_read_response( ctx, LR15_RSP_VER, LR15_RSP_TIMEOUT_DEFAULT );

    log_printf( &logger, ">>> Get module ID.\r\n" );
    lr15_cmd_get( ctx, LR15_CMD_ID );
    error_flag |= lr15_read_response( ctx, LR15_RSP_ID, LR15_RSP_TIMEOUT_DEFAULT );

    return error_flag;
}

static err_t lr15_config_example ( lr15_t *ctx )
{
    err_t error_flag = LR15_OK;

    log_printf( &logger, ">>> Enter TEST mode.\r\n" );
    lr15_cmd_set( ctx, LR15_CMD_MODE, LR15_PARAM_MODE_TEST );
    error_flag |= lr15_read_response( ctx, LR15_RSP_MODE, LR15_RSP_TIMEOUT_DEFAULT );

    log_printf( &logger, ">>> Check test mode and RF configuration.\r\n" );
    lr15_cmd_get( ctx, LR15_CMD_TEST );
    error_flag |= lr15_read_response( ctx, LR15_RSP_TEST_RFCFG, LR15_RSP_TIMEOUT_DEFAULT );
    
    // Default RF configuration: FREQUENCY, SF, BANDWIDTH, TX PR, RX PR, TX POWER, CRC, IQ, NET
    #define RF_CFG_DEFAULT "868, SF7, 125, 8, 8, 14, ON, OFF, OFF"
    log_printf( &logger, ">>> Set RF configuration.\r\n" );
    lr15_cmd_param_set( ctx, LR15_CMD_TEST, LR15_PARAM_TEST_RFCFG, RF_CFG_DEFAULT );
    error_flag |= lr15_read_response( ctx, LR15_RSP_TEST_RFCFG, LR15_RSP_TIMEOUT_DEFAULT );

    return error_flag;
}

static err_t lr15_example ( lr15_t *ctx )
{
    err_t error_flag = LR15_OK;
    uint8_t msg_hex[ 201 ] = { 0 };
    uint8_t byte_hex[ 3 ] = { 0 };
    uint8_t len[ 10 ] = { 0 };
    uint8_t rssi[ 10 ] = { 0 };
    uint8_t snr[ 10 ] = { 0 };
    uint8_t cnt = 0;

    memset( msg_hex, 0, sizeof ( msg_hex ) );
    for ( cnt = 0; ( cnt < strlen ( DEMO_TEXT_MESSAGE ) ) && ( cnt < 100 ); cnt++ ) 
    {
        uint8_to_hex ( DEMO_TEXT_MESSAGE[ cnt ], byte_hex );
        strcat ( msg_hex, byte_hex );
    }
    log_printf( &logger, ">>> Send message: \"%s\".\r\n", ( char * ) DEMO_TEXT_MESSAGE );
    lr15_cmd_param_set( ctx, LR15_CMD_TEST, LR15_PARAM_TEST_TXLRPKT, msg_hex );
    error_flag |= lr15_read_response( ctx, LR15_RSP_TEST_TX_DONE, LR15_RSP_TIMEOUT_DEFAULT );
    
    if ( LR15_OK == error_flag )
    {
        memset( msg_hex, 0, sizeof ( msg_hex ) );
        #define RX_MODE_TIMEOUT 30000
        log_printf( &logger, ">>> Go to RX mode (timeout: 30s).\r\n" );
        lr15_cmd_param_get( ctx, LR15_CMD_TEST, LR15_PARAM_TEST_RXLRPKT );
        error_flag |= lr15_read_response( ctx, LR15_RSP_TEST_RX, RX_MODE_TIMEOUT );
    }
    
    if ( LR15_OK == error_flag )
    {
        uint8_t * __generic_ptr start_ptr = strstr( app_buf, LR15_RSP_TEST_RXLEN );
        uint8_t * __generic_ptr end_ptr = NULL;
        if ( start_ptr )
        {
            start_ptr = start_ptr + strlen ( LR15_RSP_TEST_RXLEN );
            end_ptr = strstr ( start_ptr, "," );
            memcpy ( len, start_ptr, end_ptr - start_ptr );

            start_ptr = strstr ( end_ptr, ":" ) + 1;
            end_ptr = strstr ( start_ptr, "," );
            memcpy ( rssi, start_ptr, end_ptr - start_ptr );
            
            start_ptr = strstr ( end_ptr, ":" ) + 1;
            end_ptr = strstr ( start_ptr, "\r\n" );
            memcpy ( snr, start_ptr, end_ptr - start_ptr );

            start_ptr = strstr ( end_ptr, "\"" ) + 1;
            end_ptr = strstr ( start_ptr, "\"" );
            memcpy ( msg_hex, start_ptr, end_ptr - start_ptr );

            for ( cnt = 0; cnt < strlen ( msg_hex ); cnt += 2 )
            {
                msg_hex[ cnt / 2 ] = hex_to_uint8 ( &msg_hex [ cnt ] );
            }
            msg_hex[ cnt / 2 ] = 0;
            log_printf( &logger, ">>> Parse received message.\r\n" );
            log_printf ( &logger, " Message: %s\r\n", msg_hex );
            log_printf ( &logger, " LEN: %s\r\n", len );
            log_printf ( &logger, " RSSI: %s\r\n", rssi );
            log_printf ( &logger, " SNR: %s\r\n", snr );
            log_printf( &logger, "--------------------------------\r\n" );
        }
    }

    Delay_ms ( 1000 );

    return error_flag;
}

// ------------------------------------------------------------------------ END

Additional Support

Resources

Love this project?

'Buy This Kit' button takes you directly to the shopping cart where you can easily add or remove products.