lteiot12 2.2.0
Loading...
Searching...
No Matches
lteiot12


LTE IoT 12 Click

LTE IoT 12 Click demo application is developed using the NECTO Studio, ensuring compatibility with mikroSDK's open-source libraries and tools. Designed for plug-and-play implementation and testing, the demo is fully compatible with all development, starter, and mikromedia boards featuring a mikroBUS™ socket.


Click Library

  • Author : Stefan Filipovic
  • Date : Jul 2024.
  • Type : UART type

Software Support

Example Description

Application example shows device capability of connecting to the network and sending SMS or TCP/UDP messages, or retrieving data from GNSS using standard "AT" commands.

Example Libraries

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.LTEIoT12

Example 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:212
  • 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:187
  • lteiot12_set_sim_apn This function sets APN for SIM card.
    void lteiot12_set_sim_apn ( lteiot12_t *ctx, uint8_t *sim_apn );
    void lteiot12_set_sim_apn(lteiot12_t *ctx, uint8_t *sim_apn)
    LTE IoT 12 set SIM card APN function.
  • lteiot12_send_sms_text This function sends text message to a phone number.
    void lteiot12_send_sms_text ( lteiot12_t *ctx, uint8_t *phone_number, uint8_t *sms_text );
    void lteiot12_send_sms_text(lteiot12_t *ctx, uint8_t *phone_number, uint8_t *sms_text)
    LTE IoT 12 send SMS in text mode function.
  • lteiot12_cmd_run This function sends a specified command to the Click module.
    void lteiot12_cmd_run ( lteiot12_t *ctx, uint8_t *cmd );
    void lteiot12_cmd_run(lteiot12_t *ctx, uint8_t *cmd)
    LTE IoT 12 cmd run function.

Application Init

Initializes the driver and logger.

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_info( &logger, " Application Task " );
app_state = LTEIOT12_POWER_UP;
log_printf( &logger, ">>> APP STATE - POWER UP <<<\r\n\n" );
}
#define LTEIOT12_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition lteiot12.h:170
void application_init(void)
Definition main.c:215
@ LTEIOT12_POWER_UP
Definition main.c:95

Application Task

Application task is split in few stages:

  • LTEIOT12_POWER_UP:

    Powers up the device, performs a factory reset and reads system information.

  • LTEIOT12_CONFIG_CONNECTION:

    Sets configuration to device to be able to connect to the network (used only for SMS or TCP/UDP demo examples).

  • LTEIOT12_CHECK_CONNECTION:

    Waits for the network registration indicated via CREG command and then checks the signal quality report (used only for SMS or TCP/UDP demo examples).

  • LTEIOT12_CONFIG_EXAMPLE:

    Configures device for the selected example.

  • LTEIOT12_EXAMPLE:

    Depending on the selected demo example, it sends an SMS message (in PDU or TXT mode) or TCP/UDP message or waits for the GPS fix to retrieve location info from GNSS. By default, the TCP/UDP example is selected.

void application_task ( void )
{
switch ( app_state )
{
{
if ( LTEIOT12_OK == lteiot12_power_up( &lteiot12 ) )
{
log_printf( &logger, ">>> APP STATE - CONFIG CONNECTION <<<\r\n\n" );
}
break;
}
{
if ( LTEIOT12_OK == lteiot12_config_connection( &lteiot12 ) )
{
log_printf( &logger, ">>> APP STATE - CHECK CONNECTION <<<\r\n\n" );
}
break;
}
{
if ( LTEIOT12_OK == lteiot12_check_connection( &lteiot12 ) )
{
log_printf( &logger, ">>> APP STATE - CONFIG EXAMPLE <<<\r\n\n" );
}
break;
}
{
if ( LTEIOT12_OK == lteiot12_config_example( &lteiot12 ) )
{
app_state = LTEIOT12_EXAMPLE;
log_printf( &logger, ">>> APP STATE - EXAMPLE <<<\r\n\n" );
}
break;
}
{
lteiot12_example( &lteiot12 );
break;
}
default:
{
log_error( &logger, " APP STATE." );
break;
}
}
}
@ LTEIOT12_OK
Definition lteiot12.h:239
void application_task(void)
Definition main.c:248
@ LTEIOT12_CHECK_CONNECTION
Definition main.c:97
@ LTEIOT12_EXAMPLE
Definition main.c:99
@ LTEIOT12_CONFIG_EXAMPLE
Definition main.c:98
@ LTEIOT12_CONFIG_CONNECTION
Definition main.c:96

Note

In order for the examples to work (except GNSS example), 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.

Example:

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

Application Output

This Click board can be interfaced and monitored in two ways:

  • Application Output - Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
  • UART Terminal - Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.

Additional Notes and Information

The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.