lteiot12 2.1.0.0
Main Page

LTE IoT 12 click

PRVIH_PAR_RECENICA_SA_PRODUCT_PAGE_DA_ISPRATE_CELINU

[click Product page](CLICK_PRODUCT_PAGE_LINK)


Click library

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

Software Support

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

Standard key functions :

  • lteiot12_cfg_setup Config Object Initialization function.
    void lteiot12_cfg_setup(lteiot12_cfg_t *cfg)
    LTE IoT 12 configuration object setup function.
    LTE IoT 12 Click configuration object.
    Definition: lteiot12.h:215
  • lteiot12_init Initialization function.
    err_t lteiot12_init(lteiot12_t *ctx, lteiot12_cfg_t *cfg)
    LTE IoT 12 initialization function.
    LTE IoT 12 Click context object.
    Definition: lteiot12.h:191
  • lteiot12_default_cfg Click Default Configuration function.
    err_t lteiot12_default_cfg ( lteiot12_t *ctx );

Example key functions :

  • lteiot12_send_sms_text_mode This function sends text message to a phone number.
    void lteiot12_send_sms_text_mode ( lteiot12_t *ctx, uint8_t *phone_number, uint8_t *sms_text );
    void lteiot12_send_sms_text_mode(lteiot12_t *ctx, uint8_t *phone_number, uint8_t *sms_text)
    LTE IoT 12 send SMS in text mode.
  • lteiot12_send_sms_pdu This function sends text message to a phone number in PDU mode.
    err_t lteiot12_send_sms_pdu ( lteiot12_t *ctx, uint8_t *service_center_number, uint8_t *phone_number, uint8_t *sms_text );
    err_t lteiot12_send_sms_pdu(lteiot12_t *ctx, uint8_t *service_center_number, uint8_t *phone_number, uint8_t *sms_text)
    LTE IoT 12 send SMS in PDU mode.
  • lteiot12_parse_gngga This function parses the GNGGA data from the read response buffer.
    err_t lteiot12_parse_gngga ( uint8_t *rsp_buf, uint8_t gngga_element, uint8_t *element_data );
    err_t lteiot12_parse_gngga(uint8_t *rsp_buf, uint8_t gngga_element, uint8_t *element_data)
    LTE IoT 12 parse GNGGA function.

Example Description

Application example shows device capability of connecting to the network and

sending SMS, TCP/UDP messages or getting GNSS data using standard "AT" commands.

The demo application is composed of two sections :

Application Init

Sets the device configuration for sending SMS, TCP/UDP messages or getting GNSS data.

void application_init ( void )
{
log_cfg_t log_cfg;
lteiot12_cfg_t lteiot12_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
lteiot12_cfg_setup( &lteiot12_cfg );
LTEIOT12_MAP_MIKROBUS( lteiot12_cfg, MIKROBUS_1 );
if ( UART_ERROR == lteiot12_init( &lteiot12, &lteiot12_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
log_printf( &logger, " Power on device... \r\n" );
lteiot12_hw_reset( &lteiot12 );
app_error_flag = lteiot12_rsp_check( &lteiot12, LTEIOT12_RSP_RDY );
#define LTEIOT12_MIN_FUN "0"
app_error_flag = lteiot12_rsp_check( &lteiot12, LTEIOT12_RSP_APPRDY );
lteiot12_error_check( app_error_flag );
app_error_flag = lteiot12_rsp_check( &lteiot12, LTEIOT12_RSP_OK );
lteiot12_error_check( app_error_flag );
app_error_flag = lteiot12_rsp_check( &lteiot12, LTEIOT12_RSP_OK );
lteiot12_error_check( app_error_flag );
#define LTEIOT12_FULL_FUN "1"
app_error_flag = lteiot12_rsp_check( &lteiot12, LTEIOT12_RSP_OK );
lteiot12_error_check( app_error_flag );
#define LTEIOT12_DISABLE_PSM "1"
app_error_flag = lteiot12_rsp_check( &lteiot12, LTEIOT12_RSP_OK );
lteiot12_error_check( app_error_flag );
#define LTEIOT12_EN_LOCATION_AND_NETWORK "2"
app_error_flag = lteiot12_rsp_check( &lteiot12, LTEIOT12_RSP_OK );
lteiot12_error_check( app_error_flag );
#define LTEIOT12_DISABLE_SLEEP "0"
app_error_flag = lteiot12_rsp_check( &lteiot12, LTEIOT12_RSP_OK );
lteiot12_error_check( app_error_flag );
app_error_flag = lteiot12_rsp_check( &lteiot12, LTEIOT12_RSP_OK );
lteiot12_error_check( app_error_flag );
log_info( &logger, " Application Task " );
}
#define LTEIOT12_CMD_QSCLK
Definition: lteiot12.h:92
#define LTEIOT12_CMD_CPSMS
Definition: lteiot12.h:90
#define LTEIOT12_CMD_AT
LTE IoT 12 control commands.
Definition: lteiot12.h:69
#define LTEIOT12_CMD_ATI
Definition: lteiot12.h:70
#define LTEIOT12_CMD_CFUN
Definition: lteiot12.h:72
#define LTEIOT12_RSP_RDY
Definition: lteiot12.h:108
#define LTEIOT12_RSP_OK
LTE IoT 12 response.
Definition: lteiot12.h:107
#define LTEIOT12_RSP_APPRDY
Definition: lteiot12.h:109
#define LTEIOT12_CMD_CEREG
Definition: lteiot12.h:74
#define LTEIOT12_CMD_CIMI
Definition: lteiot12.h:79
#define LTEIOT12_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition: lteiot12.h:174
void lteiot12_hw_reset(lteiot12_t *ctx)
LTE IoT 12 hardware reset function.
void lteiot12_send_cmd(lteiot12_t *ctx, uint8_t *cmd)
LTE IoT 12 send command function.
void lteiot12_send_cmd_with_params(lteiot12_t *ctx, uint8_t *at_cmd_buf, uint8_t *param_buf)
LTE IoT 12 send command function with parameter.
void application_init(void)
Definition: main.c:192
#define LTEIOT12_MIN_FUN
#define LTEIOT12_DISABLE_SLEEP
#define LTEIOT12_DISABLE_PSM
#define LTEIOT12_EN_LOCATION_AND_NETWORK
#define LTEIOT12_FULL_FUN

Application Task

Depending on the selected demo example, it sends an SMS message

(in PDU or TXT mode) or a TCP/UDP message or getting GNSS data ( position and altitude ).

void application_task ( void )
{
switch( app_connection_status )
{
{
lteiot12_config_for_example( );
break;
}
{
lteiot12_example( );
break;
}
default:
{
log_error( &logger, "Application status error! " );
app_connection_status = LTEIOT12_CONFIGURE_FOR_EXAMPLE;
Delay_ms( 1000 );
break;
}
}
}
void application_task(void)
Definition: main.c:264
@ LTEIOT12_EXAMPLE
Definition: main.c:77
@ LTEIOT12_CONFIGURE_FOR_EXAMPLE
Definition: main.c:76

Note

In order for the examples to work, user needs to set the APN and SMSC (SMS PDU mode only)

of entered SIM card as well as the phone number (SMS mode only) to which he wants to send an SMS. Enter valid values for the following macros: SIM_APN, SIM_SMSC and PHONE_NUMBER_TO_MESSAGE.

Example:

  • SIM_APN "internet"
  • SIM_SMSC "+381610401"
  • PHONE_NUMBER_TO_MESSAGE "+381659999999"

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

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.