lteiot6  2.0.0.0
Main Page

LTE IoT 6 click

LTE IoT 6 Click is a compact add-on board that contains an IoT module with worldwide coverage. This board features the SARA-R412M, a cellular module that offers multi-band data transmissions for Low Power Wide Area solutions in a compact form factor from u-Blox.

click Product page


Click library

  • Author : Luka Filipovic
  • Date : Nov 2020.
  • Type : UART GPS/GNSS type

Software Support

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

Standard key functions :

  • Config Object Initialization function.

    void lteiot6_cfg_setup ( lteiot6_cfg_t *cfg );

  • Initialization function.

    LTEIOT6_RETVAL lteiot6_init ( lteiot6_t *ctx, lteiot6_cfg_t *cfg );

  • Click Default Configuration function.

    void lteiot6_default_cfg ( lteiot6_t *ctx );

Example key functions :

  • LTE IoT 6 power on.

    void lteiot6_power_on ( lteiot6_t *ctx );

  • Send command function.

    void lteiot6_send_cmd ( lteiot6_t *ctx, char *cmd );

  • LTE IoT 6 send text message.

    void lteiot6_send_text_message ( lteiot6_t *ctx, char *phone_number, char *message_context );

Examples Description

This example reads and processes data from LTE IoT 6 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;
lteiot6_cfg_t lteiot6_cfg;
// Logger initialization.
LOG_MAP_USB_UART( log_cfg );
log_cfg.level = LOG_LEVEL_DEBUG;
log_cfg.baud = 115200;
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
Delay_ms( 1000 );
// Click initialization.
lteiot6_cfg_setup( &lteiot6_cfg );
LTEIOT6_MAP_MIKROBUS( lteiot6_cfg, MIKROBUS_1 );
err_t init_flag = lteiot6_init( &lteiot6, &lteiot6_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... " );
lteiot6_reset( &lteiot6 );
lteiot6_power_on( &lteiot6 );
lteiot6_process( );
lteiot6_clear_app_buf( );
//AT
app_error_flag = lteiot6_rsp_check();
lteiot6_error_check( app_error_flag );
Delay_ms( 1000 );
//ATI
app_error_flag = lteiot6_rsp_check();
lteiot6_error_check( app_error_flag );
Delay_ms( 1000 );
//CFUN
app_error_flag = lteiot6_rsp_check();
lteiot6_error_check( app_error_flag );
Delay_ms( 1000 );
//CEREG
app_error_flag = lteiot6_rsp_check();
lteiot6_error_check( app_error_flag );
Delay_ms( 1000 );
//CGDCONT
app_error_flag = lteiot6_rsp_check();
lteiot6_error_check( app_error_flag );
Delay_ms( 1000 );
//COPS
app_error_flag = lteiot6_rsp_check();
lteiot6_error_check( app_error_flag );
Delay_ms( 1000 );
//CIMI
app_error_flag = lteiot6_rsp_check();
lteiot6_error_check( app_error_flag );
Delay_ms( 1000 );
app_buf_len = 0;
app_buf_cnt = 0;
app_connection_status = WAIT_FOR_CONNECTION;
log_info( &logger, " Application Task " );
Delay_ms( 2000 );
}

Application Task

Reads the received data and parses it.

void application_task ( void )
{
if ( app_connection_status == WAIT_FOR_CONNECTION )
{
app_error_flag = lteiot6_rsp_check();
lteiot6_error_check( app_error_flag );
Delay_ms( 2000 );
app_error_flag = lteiot6_rsp_check();
lteiot6_error_check( app_error_flag );
Delay_ms( 2000 );
app_error_flag = lteiot6_rsp_check();
lteiot6_error_check( app_error_flag );
Delay_ms( 2000 );
}
else
{
//Setting SMS mode
lteiot6_send_cmd_with_parameter( &lteiot6, "AT+CMGF", "1" );
app_error_flag = lteiot6_rsp_check();
lteiot6_error_check( app_error_flag );
Delay_ms( 3000 );
for( ; ; )
{
log_printf( &logger, "> Sending message to phone number...\r\n" );
app_error_flag = lteiot6_rsp_check();
lteiot6_error_check( app_error_flag );
Delay_ms( 10000 );
}
}
}

Note

#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 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.LTEIoT6

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.


MESSAGE_CONTENT
#define MESSAGE_CONTENT
Definition: main.c:51
LTEIOT6_CMD_CREG
#define LTEIOT6_CMD_CREG
Definition: lteiot6.h:59
lteiot6_set_sim_apn
void lteiot6_set_sim_apn(lteiot6_t *ctx, char *sim_apn)
Set sim card APN.
lteiot6_init
err_t lteiot6_init(lteiot6_t *ctx, lteiot6_cfg_t *cfg)
LTE IoT 6 initialization function.
LTEIOT6_CMD_CSQ
#define LTEIOT6_CMD_CSQ
Definition: lteiot6.h:63
LTEIOT6_CMD_ATI
#define LTEIOT6_CMD_ATI
Definition: lteiot6.h:56
lteiot6_send_cmd
void lteiot6_send_cmd(lteiot6_t *ctx, char *cmd)
Send command function.
LTEIOT6_CMD_CIMI
#define LTEIOT6_CMD_CIMI
Definition: lteiot6.h:61
application_task
void application_task(void)
Definition: main.c:205
SIM_APN
#define SIM_APN
Definition: main.c:49
lteiot6_cfg_setup
void lteiot6_cfg_setup(lteiot6_cfg_t *cfg)
LTE IoT 6 configuration object setup function.
LTEIOT6_CMD_AT
#define LTEIOT6_CMD_AT
LTE IoT 6 description register.
Definition: lteiot6.h:55
WAIT_FOR_CONNECTION
#define WAIT_FOR_CONNECTION
Definition: main.c:55
lteiot6_cfg_t
LTE IoT 6 Click configuration object.
Definition: lteiot6.h:148
lteiot6_send_cmd_check
void lteiot6_send_cmd_check(lteiot6_t *ctx, char *at_cmd_buf)
Check the sent command.
LTEIOT6_MAP_MIKROBUS
#define LTEIOT6_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition: lteiot6.h:108
lteiot6_power_on
void lteiot6_power_on(lteiot6_t *ctx)
LTE IoT 6 power on.
LTEIOT6_CMD_COPS
#define LTEIOT6_CMD_COPS
Definition: lteiot6.h:64
application_init
void application_init(void)
Definition: main.c:123
lteiot6_send_cmd_with_parameter
void lteiot6_send_cmd_with_parameter(lteiot6_t *ctx, char *at_cmd_buf, char *param_buf)
Send command function with parameter.
LTEIOT6_CMD_CGATT
#define LTEIOT6_CMD_CGATT
Definition: lteiot6.h:62
lteiot6_send_text_message
void lteiot6_send_text_message(lteiot6_t *ctx, char *phone_number, char *message_context)
LTE IoT 6 send text message.
lteiot6_reset
void lteiot6_reset(lteiot6_t *ctx)
LTE IoT 6 power on.
PHONE_NUMBER_TO_MESSAGE
#define PHONE_NUMBER_TO_MESSAGE
Definition: main.c:50
LTEIOT6_CMD_CFUN
#define LTEIOT6_CMD_CFUN
Definition: lteiot6.h:58