TOP Contributors

  1. MIKROE (2660 codes)
  2. Alcides Ramos (357 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 (137015 times)
  2. FAT32 Library (70142 times)
  3. Network Ethernet Library (56029 times)
  4. USB Device Library (46353 times)
  5. Network WiFi Library (41968 times)
  6. FT800 Library (41295 times)
  7. GSM click (29061 times)
  8. mikroSDK (26499 times)
  9. PID Library (26452 times)
  10. microSD click (25423 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

LTE IoT 4 click

Rating:

0

Author: MIKROE

Last Updated: 2024-04-03

Package Version: 2.1.0.18

mikroSDK Library: 2.0.0.0

Category: LTE IoT

Downloaded: 293 times

Not followed.

License: MIT license  

LTE IoT 4 Click is a compact add-on board that contains an IoT module with worldwide coverage. This board features the nRF9160, highly integrated, low-power SiP with LTE-M/NB-IoT and GPS from Nordic Semiconductor.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "LTE IoT 4 click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "LTE IoT 4 click" changes.

Do you want to report abuse regarding "LTE IoT 4 click".

  • Information
  • Comments (0)

mikroSDK Library Blog


LTE IoT 4 click

LTE IoT 4 Click is a compact add-on board that contains an IoT module with worldwide coverage. This board features the nRF9160, highly integrated, low-power SiP with LTE-M/NB-IoT and GPS from Nordic Semiconductor.

lte_iot_4_click.png

click Product page


Click library

  • Author : Luka Filipovic
  • Date : Dec 2020.
  • Type : UART type

Software Support

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

Standard key functions :

  • Config Object Initialization function.

    void lteiot4_cfg_setup ( lteiot4_cfg_t *cfg );
  • Initialization function.

    LTEIOT4_RETVAL lteiot4_init ( lteiot4_t *ctx, lteiot4_cfg_t *cfg );
  • Click Default Configuration function.

    void lteiot4_default_cfg ( lteiot4_t *ctx );

Example key functions :

Sets state of the rst pin setting.

void lteiot4_set_rst ( lteiot4_t *ctx, uint8_t state );

Send command function.

void lteiot4_send_cmd ( lteiot4_t *ctx, char *cmd );

Set sim card APN.

void lteiot4_set_sim_apn ( lteiot4_t *ctx, char *sim_apn );

Examples Description

This example reads and processes data from LTE IoT 4 clicks.

The demo application is composed of two sections :

Application Init

Initializes driver and wake-up module.

void application_init ( void )
{
    log_cfg_t log_cfg;          /**< Logger config object. */
    lteiot4_cfg_t lteiot4_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 " );
    Delay_ms ( 1000 );

    // Click initialization.
    lteiot4_cfg_setup( &lteiot4_cfg );
    LTEIOT4_MAP_MIKROBUS( lteiot4_cfg, MIKROBUS_1 );
    err_t init_flag  = lteiot4_init( &lteiot4, &lteiot4_cfg );
    if ( init_flag == UART_ERROR )
    {
        log_error( &logger, " Application Init Error. " );
        log_info( &logger, " Please, run program again... " );

        for ( ; ; );
    }

    log_info( &logger, " Power up device... " );
    lteiot4_default_cfg ( &lteiot4 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );

    lteiot4_process(  );
    lteiot4_process(  );
    lteiot4_process(  );
    lteiot4_clear_app_buf(  );

    //AT
    log_info( &logger, " Communication test " );
    lteiot4_send_cmd( &lteiot4, LTEIOT4_CMD_AT );
    app_error_flag = lteiot4_rsp_check();
    lteiot4_error_check( app_error_flag );
    Delay_ms ( 500 );

    //CGMM
    log_info( &logger, " Module version " );
    lteiot4_send_cmd( &lteiot4, LTEIOT4_CMD_MODULE_VERSION );
    app_error_flag = lteiot4_rsp_check();
    lteiot4_error_check( app_error_flag );
    Delay_ms ( 500 );

    //CGMR
    log_info( &logger, " FW version " );
    lteiot4_send_cmd( &lteiot4, LTEIOT4_CMD_FW_VERSION );
    app_error_flag = lteiot4_rsp_check();
    lteiot4_error_check( app_error_flag );
    Delay_ms ( 500 );

    //CFUN
    log_info( &logger, " Flight mode " );
    lteiot4_send_cmd( &lteiot4, LTEIOT4_CMD_FLIGHT_MODE );
    app_error_flag = lteiot4_rsp_check();
    lteiot4_error_check( app_error_flag );
    Delay_ms ( 500 );

    //XSYSTEMMODE
    log_info( &logger, " Enable NB network " );
    lteiot4_send_cmd( &lteiot4, LTEIOT4_CMD_NBIOT_MODE );
    app_error_flag = lteiot4_rsp_check();
    lteiot4_error_check( app_error_flag );
    Delay_ms ( 500 );

    //CIND
    log_info( &logger, " Enable service and messages " );
    lteiot4_send_cmd( &lteiot4, LTEIOT4_CMD_ENABLE_NET_SMS );
    app_error_flag = lteiot4_rsp_check();
    lteiot4_error_check( app_error_flag );
    Delay_ms ( 500 );

    //CFUN
    log_info( &logger, " Full functionalty mode " );
    lteiot4_send_cmd( &lteiot4, LTEIOT4_CMD_FULL_FUNCTION );
    app_error_flag = lteiot4_rsp_check();
    lteiot4_error_check( app_error_flag );
    Delay_ms ( 500 );

    //CGDCONT
    log_info( &logger, " Set APN " );
    lteiot4_set_sim_apn( &lteiot4, SIM_APN );
    app_error_flag = lteiot4_rsp_check();
    lteiot4_error_check( app_error_flag );
    Delay_ms ( 500 );

    //COPS
    log_info( &logger, " Set automatic network search " );
    lteiot4_send_cmd( &lteiot4, LTEIOT4_CMD_AUTO_NET_SRC );
    app_error_flag = lteiot4_rsp_check();
    lteiot4_error_check( app_error_flag );
    Delay_ms ( 500 );

    //CEREG
    log_info( &logger, " Activate search for network  " );
    lteiot4_send_cmd( &lteiot4, LTEIOT4_CMD_SEARCH_NET );
    app_error_flag = lteiot4_rsp_check();
    lteiot4_error_check( app_error_flag );
    Delay_ms ( 500 );

    //CIMI
    log_info( &logger, " SIM test " );
    lteiot4_send_cmd( &lteiot4, LTEIOT4_CMD_SIM_TEST );
    app_error_flag = lteiot4_rsp_check();
    lteiot4_error_check( app_error_flag );
    Delay_ms ( 500 );

    app_buf_len = 0;
    app_buf_cnt = 0;
    app_connection_status = WAIT_FOR_CONNECTION;
    log_info( &logger, " Application Task\r\n" );
    log_printf( &logger, "-------------------------------\r\n" );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
}

Application Task

Reads the received data and parses it.

void application_task ( void )
{
    if ( app_connection_status == WAIT_FOR_CONNECTION )
    {
        //CEREG
        log_info( &logger, " Check connection  " );
        lteiot4_send_cmd( &lteiot4, LTEIOT4_CMD_CHECK_CONNECTION );
        app_error_flag = lteiot4_rsp_check();
        lteiot4_error_check( app_error_flag );
        Delay_ms ( 500 );

        //CEREG
        log_info( &logger, " Check network status  " );
        lteiot4_send_cmd( &lteiot4, LTEIOT4_CMD_CHECK_REGISTARTION );
        app_error_flag = lteiot4_rsp_check();
        lteiot4_error_check( app_error_flag );
        Delay_ms ( 500 );

        //CEREG
        log_info( &logger, " Check signal quality  " );
        lteiot4_send_cmd( &lteiot4, LTEIOT4_CMD_SIGNAL_QUALITY );
        app_error_flag = lteiot4_rsp_check();
        lteiot4_error_check( app_error_flag );
        log_printf( &logger, "-------------------------------\r\n" );
        Delay_ms ( 1000 );
        Delay_ms ( 1000 );
        Delay_ms ( 1000 );
        Delay_ms ( 1000 );
        Delay_ms ( 1000 );
    }
    else
    {
        log_info( &logger, "CONNECTED TO NETWORK\r\n" );
        log_printf( &logger, "-------------------------------\r\n" );
        //CCLK
        log_info( &logger, " Set Time " );
        lteiot4_send_cmd( &lteiot4, LTEIOT4_CMD_SET_DUMMY_CLOCK );
        app_error_flag = lteiot4_rsp_check();
        lteiot4_error_check( app_error_flag );
        log_printf( &logger, "-------------------------------\r\n" );
        Delay_ms ( 1000 );
        Delay_ms ( 1000 );
        Delay_ms ( 1000 );

        for(;;)
        {
            //XTEMP
            log_info( &logger, " Check Temperature " );
            lteiot4_send_cmd( &lteiot4, LTEIOT4_CMD_CHECK_TEMPERATURE );
            app_error_flag = lteiot4_rsp_check();
            lteiot4_error_check( app_error_flag );
            Delay_ms ( 500 );
            //CCLK
            log_info( &logger, " Check Time " );
            lteiot4_send_cmd( &lteiot4, LTEIOT4_CMD_CHECK_CLOCK );
            app_error_flag = lteiot4_rsp_check();
            lteiot4_error_check( app_error_flag );
            log_printf( &logger, "-------------------------------\r\n" );
            Delay_ms ( 1000 );
            Delay_ms ( 1000 );
            Delay_ms ( 1000 );
            Delay_ms ( 1000 );
            Delay_ms ( 1000 );
        }
    }
}

Note

In order for the example to work, enter valid data for the following macros: SIM_APN.

E.g. SIM_APN "vip.mobile"

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

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

I2C MUX 7 click

0

I2C MUX 7 Click is a compact add-on board representing a bidirectional selector dedicated to applications with I2C slave address conflicts. This board features the PI4MSD5V9547, an octal bidirectional translating multiplexer controlled by the I2C-bus from Texas Instruments. Only one SCL/SDA channel can be selected at a time, determined by the contents of the programmable control register. The board powers up with Channel 0 connected, allowing immediate communication between the Master and downstream devices on that channel.

[Learn More]

Buck 2 click

0

Buck 2 click is a powerful step down DC-DC switching regulator. It gives a high precision regulated voltage at its output and it can handle an ample amount of current.

[Learn More]

Oximeter2 click

0

Oximeter 2 Click is a compact add-on board perfectly suited for measuring the blood oxygen saturation.

[Learn More]