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_cmd This function sends a specified command to the LTE IoT 12 Click module.
    void lteiot12_send_cmd ( lteiot12_t *ctx, char *cmd );
    void lteiot12_send_cmd(lteiot12_t *ctx, char *cmd)
    LTE IoT 12 send command function.
  • lteiot12_send_cmd_with_params This function sends a command with specified parameter to the LTE IoT 12 Click module.
    void lteiot12_send_cmd_with_params ( lteiot12_t *ctx, char *at_cmd_buf, char *param_buf );
    void lteiot12_send_cmd_with_params(lteiot12_t *ctx, char *at_cmd_buf, char *param_buf)
    LTE IoT 12 send command function with parameter.
  • 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, char *service_center_number, char *phone_number, char *sms_text );
    err_t lteiot12_send_sms_pdu(lteiot12_t *ctx, char *service_center_number, char *phone_number, char *sms_text)
    LTE IoT 12 send SMS in PDU mode.

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 application_init(void)
Definition: main.c:212
#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;
}
{
#if ( DEMO_EXAMPLE == TCP_UDP_EXAMPLE )
lteiot12_tcp_udp_example( );
#elif ( DEMO_EXAMPLE == SMS_EXAMPLE )
lteiot12_send_sms( );
Delay_ms( 10000 );
#elif ( DEMO_EXAMPLE == GNSS_EXAMPLE )
#define LTEIOT12_NEMA_SENTENCE "\"GGA\""
lteiot12_send_cmd_with_params( &lteiot12, LTEIOT12_CMD_QGPSGNMEA, LTEIOT12_NEMA_SENTENCE );
lteiot12_process( &lteiot12 );
gnss_parser_application ( app_buf );
lteiot12_clear_app_buf ( );
Delay_ms( 5000 );
#endif
break;
}
default:
{
log_error( &logger, "Application status error! " );
app_connection_status = LTEIOT12_CONFIGURE_FOR_EXAMPLE;
Delay_ms( 1000 );
break;
}
}
}
#define LTEIOT12_CMD_QGPSGNMEA
Definition: lteiot12.h:100
void application_task(void)
Definition: main.c:284
@ LTEIOT12_EXAMPLE
Definition: main.c:73
@ LTEIOT12_CONFIGURE_FOR_EXAMPLE
Definition: main.c:72

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.