lteiot9  2.0.0.0
Main Page

LTE IoT 9 click

LTE IoT 9 Click is a compact add-on board containing a cellular IoT Module that supports 3GPP Release 14 and all LTE bands.

click Product page


Click library

  • Author : Luka FIlipovic
  • Date : Feb 2021.
  • Type : UART type

Software Support

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

Standard key functions :

Example key functions :

  • lteiot9_generic_read Function reads a desired number of data bytes by using UART serial interface.
    err_t lteiot9_generic_read ( lteiot9_t *ctx, char *data_buf, uint16_t max_len );
  • lteiot9_send_cmd Function sends the specified command to the click module.
    void lteiot9_send_cmd ( lteiot9_t *ctx, char *cmd );
  • lteiot9_set_sim_apn Function sets APN for sim card.
    void lteiot9_set_sim_apn ( lteiot9_t *ctx, char *sim_apn );

Example Description

This application shows capability of LTE IoT 9 click board.

It connects to network with standard "AT" commands, then sends SMS whit SIM card, and then logs GNNS data.

The demo application is composed of two sections :

Application Init

Initializes driver and wake-up module and checks

communication and device version.

void application_init ( void )
{
log_cfg_t log_cfg;
lteiot9_cfg_t lteiot9_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
Delay_ms ( 1000 );
// Click initialization.
lteiot9_cfg_setup( &lteiot9_cfg );
LTEIOT9_MAP_MIKROBUS( lteiot9_cfg, MIKROBUS_1 );
err_t init_flag = lteiot9_init( &lteiot9, &lteiot9_cfg );
if ( init_flag == UART_ERROR ) {
log_error( &logger, " Application Init Error. " );
log_info( &logger, " Please, run program again... " );
for ( ; ; );
}
log_info( &logger, " Power on device... " );
lteiot9_default_cfg ( &lteiot9 );
lteiot9_process( );
lteiot9_clear_app_buf( );
lteiot9_power_up_wait();
app_buf_len = 0;
app_buf_cnt = 0;
//AT
app_error_flag = lteiot9_rsp_check();
lteiot9_error_check( app_error_flag );
Delay_ms ( 500 );
//ATI
app_error_flag = lteiot9_rsp_check();
lteiot9_error_check( app_error_flag );
Delay_ms ( 500 );
app_connection_status = CONFIGURATION_FOR_NETWORK;
log_info( &logger, " Application Task " );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
}

Application Task

Application taks is split in few stages:

  • CONFIGURATION_FOR_NETWORK : Sets configuration to device to

be able to connect to newtork.

  • CHECK_NETWORK_CONNECTION : Checks device connection status

till device is connected to network.

  • SENDING_SMS : Sends SMS message to desired number in text mode. >- CONFIGURATION_FOR_GNSS : Sets configuration to device to enable GNSS data.
  • GNSS_DATA : Reads and parses data from device to

get latitude, longitude and altitude from device

void application_task ( void )
{
switch( app_connection_status )
{
{
lteiot9_config_device_for_network( );
break;
}
{
lteiot9_check_connection_to_network( );
break;
}
{
lteiot9_send_sms( );
break;
}
{
lteiot9_config_device_for_gnss( );
break;
}
case GNSS_DATA:
{
lteiot9_gnss_data();
break;
}
default:
{
log_error( &logger, "Application status error!" );
app_connection_status = CHECK_NETWORK_CONNECTION;
Delay_ms ( 1000 );
break;
}
}
}

Note

In order for the example to work,

user needs to set the phone number and sim apn to which he wants to send an SMS

Enter valid data for the following macros: SIM_APN and PHONE_NUMBER_TO_MESSAGE.

E.g.

SIM_APN "vip.mobile", PHONE_NUMBER_TO_MESSAGE "999999999"

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

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.


lteiot9_set_sim_apn
void lteiot9_set_sim_apn(lteiot9_t *ctx, char *sim_apn)
Set sim card APN.
LTEIOT9_CMD_ATI
#define LTEIOT9_CMD_ATI
Definition: lteiot9.h:74
CONFIGURATION_FOR_NETWORK
#define CONFIGURATION_FOR_NETWORK
Definition: main.c:90
lteiot9_generic_read
err_t lteiot9_generic_read(lteiot9_t *ctx, char *data_buf, uint16_t max_len)
LTE IoT 9 data reading function.
CONFIGURATION_FOR_GNSS
#define CONFIGURATION_FOR_GNSS
Definition: main.c:93
lteiot9_send_cmd_with_parameter
void lteiot9_send_cmd_with_parameter(lteiot9_t *ctx, char *at_cmd_buf, char *param_buf)
Send command function with parameter.
lteiot9_t
LTE IoT 9 Click context object.
Definition: lteiot9.h:177
application_task
void application_task(void)
Definition: main.c:296
LTEIOT9_CMD_AT
#define LTEIOT9_CMD_AT
LTE IoT 9 description commands.
Definition: lteiot9.h:73
SENDING_SMS
#define SENDING_SMS
Definition: main.c:92
lteiot9_init
err_t lteiot9_init(lteiot9_t *ctx, lteiot9_cfg_t *cfg)
LTE IoT 9 initialization function.
LTEIOT9_MAP_MIKROBUS
#define LTEIOT9_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition: lteiot9.h:161
lteiot9_cfg_t
LTE IoT 9 Click configuration object.
Definition: lteiot9.h:200
GNSS_DATA
#define GNSS_DATA
Definition: main.c:94
lteiot9_cfg_setup
void lteiot9_cfg_setup(lteiot9_cfg_t *cfg)
LTE IoT 9 configuration object setup function.
application_init
void application_init(void)
Definition: main.c:238
CHECK_NETWORK_CONNECTION
#define CHECK_NETWORK_CONNECTION
Definition: main.c:91
LTEIOT9_CMD_CFUN
#define LTEIOT9_CMD_CFUN
Definition: lteiot9.h:76
lteiot9_send_cmd
void lteiot9_send_cmd(lteiot9_t *ctx, char *cmd)
Send command function.
lteiot9_default_cfg
err_t lteiot9_default_cfg(lteiot9_t *ctx)
LTE IoT 9 default configuration function.