Intermediate
30 min

Experience the next-level of LTE connectivity in US with ELS61-US and STM32F031K6

Connectivity perfected: Cat 1 LTE for US

LTE Cat.1-US Click (for United States) with Nucleo 32 with STM32F031K6 MCU

Published Oct 01, 2024

Click board™

LTE Cat.1-US Click (for United States)

Dev. board

Nucleo 32 with STM32F031K6 MCU

Compiler

NECTO Studio

MCU

STM32F031K6

Designed to focus on M2M IoT excellence, our wireless module empowers US businesses with highly efficient Cat 1 LTE connectivity, providing a reliable and versatile communication solution with seamless network fallback to 2G and 3G

A

A

Hardware Overview

How does it work?

LTE Cat.1-US Click is based on the ELS61, a multi-band wireless module from Thales. There are two Click boards™ to cover two different regions: LTE Cat.1-EU Click for the Europe region, which features the ELS61-E module, and the LTE Cat.1-US click for the North American region, which features the ELS61-US module. The main difference between these two modules is the supported frequency bands, which comply with each region's regulations. A complete list of supported bands for each module and other relevant info about the module itself can be found in the attached ELS61 datasheet. The ELS61-US module featured on LTE Cat.1-US Click comes with a Java® embedded virtual machine leveraging a robust ARM11 architecture that allows device manufacturers to utilize the massive to reduce complexity and speed application integration. The latest Java ME 3.2 client runtime platform reduces

total cost of ownership (TCO) and time to market by sharing internal resources such as memory, a large existing codebase, and proven software building blocks. The module uses Multi MIDlet Java execution to host and run multiple applications and protocols simultaneously. The UART bus of the ELS61-US series module is connected to one side of the level shifter, while the other side (shifted) is connected to the respective mikroBUS™ UART pins. However, the ELS61 series module is designed as the traditional DCE device (Data Communication Equipment), offering the full UART pin count, including the hardware flow control pins (CTS, RTS). These pins are routed to the mikroBUS™ CS (CTS) and the INT pin (RTS) and can be used in the MCU software if the hardware flow control is needed. An extended security concept with the latest TLS/SSL engine provides secure and reliable TCP/IP connectivity.

Its sophisticated sandbox modeling and layered architectures simplify device management and allow simultaneous progress of network operator approvals and application code development for a shorter time to market. The LTE Cat.1 module delivers long product lifespans of up to seven years, efficient bandwidth and power utilization, and a feature set that meets the rigorous requirements of M2M IoT solutions, including extended operating temperatures. The LTE Cat.1-US Click ensures easy integration and a fast time to market for innovative solutions, and it also provides a dependable connectivity platform with the support needed for a fast time to market and a value you can trust. Given these features' possibilities, the LTE Cat.1-US Click can be used for various applications such as metering, tracking and tracing, remote surveillance, connected signs, fleet management, and mHealth.

LTE Cat.1-US Click (for United States) hardware overview image

Features overview

Development board

Nucleo 32 with STM32F031K6 MCU board provides an affordable and flexible platform for experimenting with STM32 microcontrollers in 32-pin packages. Featuring Arduino™ Nano connectivity, it allows easy expansion with specialized shields, while being mbed-enabled for seamless integration with online resources. The

board includes an on-board ST-LINK/V2-1 debugger/programmer, supporting USB reenumeration with three interfaces: Virtual Com port, mass storage, and debug port. It offers a flexible power supply through either USB VBUS or an external source. Additionally, it includes three LEDs (LD1 for USB communication, LD2 for power,

and LD3 as a user LED) and a reset push button. The STM32 Nucleo-32 board is supported by various Integrated Development Environments (IDEs) such as IAR™, Keil®, and GCC-based IDEs like AC6 SW4STM32, making it a versatile tool for developers.

Nucleo 32 with STM32F031K6 MCU double side image

Microcontroller Overview

MCU Card / MCU

default

Architecture

ARM Cortex-M0

MCU Memory (KB)

32

Silicon Vendor

STMicroelectronics

Pin count

32

RAM (Bytes)

4096

You complete me!

Accessories

Click Shield for Nucleo-32 is the perfect way to expand your development board's functionalities with STM32 Nucleo-32 pinout. The Click Shield for Nucleo-32 provides two mikroBUS™ sockets to add any functionality from our ever-growing range of Click boards™. We are fully stocked with everything, from sensors and WiFi transceivers to motor control and audio amplifiers. The Click Shield for Nucleo-32 is compatible with the STM32 Nucleo-32 board, providing an affordable and flexible way for users to try out new ideas and quickly create prototypes with any STM32 microcontrollers, choosing from the various combinations of performance, power consumption, and features. The STM32 Nucleo-32 boards do not require any separate probe as they integrate the ST-LINK/V2-1 debugger/programmer and come with the STM32 comprehensive software HAL library and various packaged software examples. This development platform provides users with an effortless and common way to combine the STM32 Nucleo-32 footprint compatible board with their favorite Click boards™ in their upcoming projects.

Click Shield for Nucleo-32 accessories 1 image

LTE Flat Rotation Antenna is a versatile choice for boosting the performance of 3G/4G LTE devices. With a wide frequency range of 700-2700MHz, it ensures optimal connectivity on major cellular bands worldwide. This flat antenna features an SMA male connector, making it easy to attach directly to your device or SMA module connector. One of its standout features is its adjustable angle, which can be set in 45⁰ increments (0⁰/45⁰/90⁰), allowing you to fine-tune the antenna's orientation for maximum signal reception. With an impedance of 50Ω and a VSW Ratio of <2.0:1, this antenna ensures a reliable and efficient connection. Its 5dB gain, vertical polarization, and omnidirectional radiation pattern enhance signal strength, making it suitable for various applications. Measuring 196mm in length and 38mm in width, this antenna offers a compact yet effective solution for improving your connectivity. With a maximum input power of 50W, it can handle the demands of various devices.

LTE Cat.1-US Click accessories image

This multiband LTE Rubber Antenna with adjustable angle is an excellent choice for all 3G/4G LTE-based click boards from our offer, as well as other devices that require excellent throughput on all major cellular bands worldwide. The antenna has an SMA male connector, which allows it to be mounted directly on the Click board™ or the female SMA module connector. The antenna position can be adjusted in 45⁰ increments (0⁰/45⁰/90⁰).

LTE Cat.1-US Click accessories 2 image

Used MCU Pins

mikroBUS™ mapper

NC
NC
AN
Reset
PA11
RST
UART CTS
PA4
CS
SPI Clock
PB3
SCK
SPI Data OUT
PB4
MISO
SPI Data IN
PB5
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
SPI Chip Select
PA8
PWM
UART RTS
PA12
INT
UART TX
PA10
TX
UART RX
PA9
RX
I2C Clock
PB6
SCL
I2C Data
PB7
SDA
Power Supply
5V
5V
Ground
GND
GND
1

Take a closer look

Click board™ Schematic

LTE Cat.1-US Click (for United States) Schematic schematic

Step by step

Project assembly

Click Shield for Nucleo-144 front image hardware assembly

Start by selecting your development board and Click board™. Begin with the Nucleo 32 with STM32F031K6 MCU as your development board.

Click Shield for Nucleo-144 front image hardware assembly
Nucleo 144 with STM32L4A6ZG MCU front image hardware assembly
Stepper 22 Click front image hardware assembly
Prog-cut hardware assembly
Stepper 22 Click complete accessories setup image hardware assembly
Board mapper by product8 hardware assembly
Necto image step 2 hardware assembly
Necto image step 3 hardware assembly
Necto image step 4 hardware assembly
Necto image step 5 hardware assembly
Necto image step 6 hardware assembly
STM32 M4 Clicker HA MCU/Select Step hardware assembly
Necto No Display image step 8 hardware assembly
Necto image step 9 hardware assembly
Necto image step 10 hardware assembly
Debug Image Necto Step hardware assembly

Software Support

Library Description

This library contains API for LTE Cat.1-US Click driver.

Key functions:

  • ltecat1eu_send_cmd - This function sends the specified command to the click module

  • ltecat1eu_send_cmd_with_parameter - This function sends commands to the click module

  • ltecat1eu_send_text_message - This function sends text message to a phone number.

Open Source

Code example

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.

/*!
 * @file main.c
 * @brief LTE Cat.1-US Click Example.
 *
 * # Description
 * This example reads and processes data from LTE Cat.1-US Clicks.
 *
 * The demo application is composed of two sections :
 * 
 * ## Application Init 
 * Initializes driver and wake-up module and sets default configuration for connecting device to network.
 * 
 * ## Application Task  
 * Waits for device to connect to network and then sends SMS to selected phone number.
 * 
 * ## Additional Function
 * - static void ltecat1us_clear_app_buf ( void )
 * - static void ltecat1us_error_check( err_t error_flag )
 * - static void ltecat1us_log_app_buf ( void )
 * - static void ltecat1us_check_connection( void )
 * - static err_t ltecat1us_rsp_check ( void )
 * - static err_t ltecat1us_process ( void )
 * 
 * @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 "vipmobile"
    PHONE_NUMBER_TO_MESSAGE "+381659999999"
 *
 * @author Stefan Ilic
 *
 */

#include "board.h"
#include "log.h"
#include "ltecat1us.h"

#define APP_OK                      0
#define APP_ERROR_DRIVER           -1
#define APP_ERROR_OVERFLOW         -2
#define APP_ERROR_TIMEOUT          -3

#define RSP_OK                     "OK"
#define RSP_SYSSTART               "^SYSSTART"
#define RSP_ERROR                  "ERROR"

#define SIM_APN                    ""  // Set valid SIM APN
#define PHONE_NUMBER_TO_MESSAGE    ""  // Set Phone number to message
#define MESSAGE_CONTENT            "LTE Cat.1-US Click"   // Messege content 

#define PROCESS_BUFFER_SIZE        500

#define WAIT_FOR_CONNECTION        0
#define CONNECTED_TO_NETWORK       1

static ltecat1us_t ltecat1us;
static log_t logger;

static char app_buf[ PROCESS_BUFFER_SIZE ] = { 0 };
static int32_t app_buf_len = 0;
static int32_t app_buf_cnt = 0;

static uint8_t app_connection_status        = WAIT_FOR_CONNECTION;

static err_t app_error_flag;

/**
 * @brief LTE Cat.1-US clearing application buffer.
 * @details This function clears memory of application buffer and reset it's length and counter.
 * @note None.
 */
static void ltecat1us_clear_app_buf ( void );

/**
 * @brief LTE Cat.1-US data reading function.
 * @details This function reads data from device and concats data to application buffer.
 * 
 * @return @li @c  0 - Read some data.
 *         @li @c -1 - Nothing is read.
 *         @li @c -2 - Application buffer overflow.
 *
 * See #err_t definition for detailed explanation.
 * @note None.
 */
static err_t ltecat1us_process ( void );

/**
 * @brief LTE Cat.1-US check for errors.
 * @details This function checks for different types of errors and logs them on UART.
 * @note None.
 */
static void ltecat1us_error_check( err_t error_flag );

/**
 * @brief LTE Cat.1-US logs application buffer.
 * @details This function logs data from application buffer.
 * @note None.
 */
static void ltecat1us_log_app_buf ( void );

/**
 * @brief LTE Cat.1-US response check.
 * @details This function checks for response and returns the status of response.
 * @param[in] response : Expected response.
 * 
 * @return application status.
 * See #err_t definition for detailed explanation.
 * @note None.
 */
static err_t ltecat1us_rsp_check ( char * response );

/**
 * @brief LTE Cat.1-US chek connection.
 * @details This function checks connection to the network and 
 *          logs that status to UART.
 * 
 * @note None.
 */
static void ltecat1us_check_connection( void );

void application_init ( void ) {
    log_cfg_t log_cfg;  /**< Logger config object. */
    ltecat1us_cfg_t ltecat1us_cfg;  /**< Click config object. */

    /** 
     * Logger initialization.
     * Default baud rate: 115200
     * Default log level: LOG_LEVEL_DEBUG
     * @note If USB_UART_RX and USB_UART_TX 
     * are defined as HAL_PIN_NC, you will 
     * need to define them manually for log to work. 
     * See @b LOG_MAP_USB_UART macro definition for detailed explanation.
     */
    LOG_MAP_USB_UART( log_cfg );
    log_init( &logger, &log_cfg );
    log_info( &logger, " Application Init " );
    Delay_ms ( 1000 );
    
    // Click initialization.
    ltecat1us_cfg_setup( &ltecat1us_cfg );
    LTECAT1US_MAP_MIKROBUS( ltecat1us_cfg, MIKROBUS_1 );
    err_t init_flag  = ltecat1us_init( &ltecat1us, &ltecat1us_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... " );
    
    ltecat1us_power_on( &ltecat1us );
    
    // CFUN - restart ME
    ltecat1us_send_cmd_with_parameter( &ltecat1us, LTECAT1US_CMD_CFUN, "0" );
    app_error_flag = ltecat1us_rsp_check( RSP_SYSSTART );
    ltecat1us_error_check( app_error_flag );
    
    // AT
    ltecat1us_send_cmd( &ltecat1us, LTECAT1US_CMD_AT );
    app_error_flag = ltecat1us_rsp_check( RSP_OK );
    ltecat1us_error_check( app_error_flag );
    Delay_ms ( 500 );
    
    // ATI - product information
    ltecat1us_send_cmd( &ltecat1us, LTECAT1US_CMD_ATI );
    app_error_flag = ltecat1us_rsp_check( RSP_OK );
    ltecat1us_error_check( app_error_flag );
    Delay_ms ( 500 );
    
    // CGMR - firmware version
    ltecat1us_send_cmd( &ltecat1us, LTECAT1US_CMD_CGMR );
    app_error_flag = ltecat1us_rsp_check( RSP_OK );
    ltecat1us_error_check( app_error_flag );
    Delay_ms ( 500 );
    
    // COPS - deregister from network
    ltecat1us_send_cmd_with_parameter( &ltecat1us, LTECAT1US_CMD_COPS, "2" );
    app_error_flag = ltecat1us_rsp_check( RSP_OK );
    ltecat1us_error_check( app_error_flag );
    Delay_ms ( 500 );
    
    // CGDCONT - set sim apn
    ltecat1us_set_sim_apn( &ltecat1us, SIM_APN );
    app_error_flag = ltecat1us_rsp_check( RSP_OK );
    ltecat1us_error_check( app_error_flag );
    Delay_ms ( 500 );
     
    // CFUN - full funtionality
    ltecat1us_send_cmd_with_parameter( &ltecat1us, LTECAT1US_CMD_CFUN, "1" );
    app_error_flag = ltecat1us_rsp_check( RSP_OK );
    ltecat1us_error_check( app_error_flag );
    Delay_ms ( 500 );
    
    // COPS - automatic mode
    ltecat1us_send_cmd_with_parameter( &ltecat1us, LTECAT1US_CMD_COPS, "0" );
    app_error_flag = ltecat1us_rsp_check( RSP_OK );
    ltecat1us_error_check( app_error_flag );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    
    // CEREG - network registration status
    ltecat1us_send_cmd_with_parameter( &ltecat1us, LTECAT1US_CMD_CEREG, "2" );
    app_error_flag = ltecat1us_rsp_check( RSP_OK );
    ltecat1us_error_check( app_error_flag );
    Delay_ms ( 500 );
    
    // CIMI - request IMSI
    ltecat1us_send_cmd( &ltecat1us, LTECAT1US_CMD_CIMI );
    app_error_flag = ltecat1us_rsp_check( RSP_OK );
    ltecat1us_error_check( app_error_flag );
    Delay_ms ( 500 );
    
    app_buf_len = 0;
    app_buf_cnt = 0;
    app_connection_status = WAIT_FOR_CONNECTION;
    log_info( &logger, " Application Task " );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
}

void application_task ( void ) {
    if ( app_connection_status == WAIT_FOR_CONNECTION ) {
        // CGATT - request IMSI
        ltecat1us_send_cmd_check( &ltecat1us, LTECAT1US_CMD_CGATT );
        app_error_flag = ltecat1us_rsp_check( RSP_OK );
        ltecat1us_error_check( app_error_flag );
        Delay_ms ( 500 );
        
        // CEREG - network registration status
        ltecat1us_send_cmd_check( &ltecat1us, LTECAT1US_CMD_CEREG );
        app_error_flag = ltecat1us_rsp_check( RSP_OK );
        ltecat1us_error_check( app_error_flag );
        Delay_ms ( 500 );
        
        // CSQ - signal quality
        ltecat1us_send_cmd( &ltecat1us, LTECAT1US_CMD_CSQ );
        app_error_flag = ltecat1us_rsp_check( RSP_OK );
        ltecat1us_error_check( app_error_flag );
        Delay_ms ( 1000 );
        Delay_ms ( 1000 );
        Delay_ms ( 1000 );
        Delay_ms ( 1000 );
        Delay_ms ( 1000 );
    } else {
        log_info( &logger, "CONNECTED TO NETWORK" );
        
        // SMS message format - text mode
        ltecat1us_send_cmd_with_parameter( &ltecat1us, "AT+CMGF", "1" );
        app_error_flag = ltecat1us_rsp_check( RSP_OK );
        ltecat1us_error_check( app_error_flag );
        Delay_ms ( 1000 );
        Delay_ms ( 1000 );
        Delay_ms ( 1000 );
        
        for( ; ; ) {   
            log_printf( &logger, "> Sending message to phone number...\r\n" );
            ltecat1us_send_text_message( &ltecat1us, PHONE_NUMBER_TO_MESSAGE, MESSAGE_CONTENT );
            app_error_flag = ltecat1us_rsp_check( RSP_OK );
            ltecat1us_error_check( app_error_flag );
            // 30 seconds delay
            Delay_ms ( 1000 );
            Delay_ms ( 1000 );
            Delay_ms ( 1000 );
            Delay_ms ( 1000 );
            Delay_ms ( 1000 );
            Delay_ms ( 1000 );
            Delay_ms ( 1000 );
            Delay_ms ( 1000 );
            Delay_ms ( 1000 );
            Delay_ms ( 1000 );
            Delay_ms ( 1000 );
            Delay_ms ( 1000 );
            Delay_ms ( 1000 );
            Delay_ms ( 1000 );
            Delay_ms ( 1000 );
            Delay_ms ( 1000 );
            Delay_ms ( 1000 );
            Delay_ms ( 1000 );
            Delay_ms ( 1000 );
            Delay_ms ( 1000 );
            Delay_ms ( 1000 );
            Delay_ms ( 1000 );
            Delay_ms ( 1000 );
            Delay_ms ( 1000 );
            Delay_ms ( 1000 );
            Delay_ms ( 1000 );
            Delay_ms ( 1000 );
            Delay_ms ( 1000 );
            Delay_ms ( 1000 );
            Delay_ms ( 1000 );
        }
    }
}

int main ( void ) 
{
    /* Do not remove this line or clock might not be set correctly. */
    #ifdef PREINIT_SUPPORTED
    preinit();
    #endif
    
    application_init( );
    
    for ( ; ; ) 
    {
        application_task( );
    }

    return 0;
}

static void ltecat1us_clear_app_buf ( void ) {
    memset( app_buf, 0, app_buf_len );
    app_buf_len = 0;
    app_buf_cnt = 0;
}

static err_t ltecat1us_process ( void ) {
    err_t return_flag = APP_ERROR_DRIVER;
    int32_t rx_size;
    char rx_buff[ PROCESS_BUFFER_SIZE ] = { 0 };
    
    rx_size = ltecat1us_generic_read( &ltecat1us, rx_buff, PROCESS_BUFFER_SIZE );

    if ( rx_size > 0 ) { 
        int32_t buf_cnt = 0;
        return_flag = APP_OK;

        if ( app_buf_len + rx_size >= PROCESS_BUFFER_SIZE ) {
            ltecat1us_clear_app_buf(  );
            return_flag = APP_ERROR_OVERFLOW;
        } else {
            buf_cnt = app_buf_len;
            app_buf_len += rx_size;
        }

        for ( int32_t rx_cnt = 0; rx_cnt < rx_size; rx_cnt++ ) {
            if ( rx_buff[ rx_cnt ] != 0 ) {
                app_buf[ ( buf_cnt + rx_cnt ) ] = rx_buff[ rx_cnt ];
            } else {
                app_buf_len--;
                buf_cnt--;
            }
        }
    } 

    return return_flag;
}


static err_t ltecat1us_rsp_check ( char * response ) {
    uint16_t timeout_cnt = 0;
    uint16_t timeout = 50000;
    
    err_t error_flag = ltecat1us_process(  );
    if ( ( error_flag != 0 ) && ( error_flag != -1 ) ) {
        return error_flag;
    }
    
    while ( ( strstr( app_buf, response ) == 0 ) && ( strstr( app_buf, RSP_ERROR ) == 0 ) ) {
        error_flag = ltecat1us_process(  );
        if ( ( error_flag != 0 ) && ( error_flag != -1 ) ) {
            return error_flag;
        }
        
        timeout_cnt++;
        if ( timeout_cnt > timeout ) {
            while ( ( strstr( app_buf, response ) == 0 ) && ( strstr( app_buf, RSP_ERROR ) == 0 ) ) {
                ltecat1us_send_cmd( &ltecat1us, LTECAT1US_CMD_AT );
                ltecat1us_process(  );
                Delay_ms ( 100 );
            }
            ltecat1us_clear_app_buf(  );
            return APP_ERROR_TIMEOUT;
        }
        
        Delay_ms ( 1 );
    }
    
    ltecat1us_check_connection();
    
    ltecat1us_log_app_buf();
    
    log_printf( &logger, "-----------------------------------\r\n" );
    
    return APP_OK;
}

static void ltecat1us_error_check( err_t error_flag ) {
    if ( ( error_flag != 0 ) && ( error_flag != -1 ) ) {
        switch ( error_flag ) {
            case -2: {
                log_error( &logger, " Overflow!" );
                break;
            }
            case -3: {
                log_error( &logger, " Timeout!" );
                break;
            }
            default: {
                break;
            }
        }
    }
}

static void ltecat1us_log_app_buf ( void ) {
    for ( int32_t buf_cnt = 0; buf_cnt < app_buf_len; buf_cnt++ ) {
        log_printf( &logger, "%c", app_buf[ buf_cnt ] );
    }
    log_printf( &logger, "\r\n" );
    ltecat1us_clear_app_buf(  );
}

static void ltecat1us_check_connection( void ) {
    #define CONNECTED "+CGATT: 1"
    
    if ( strstr( app_buf, CONNECTED ) != 0 ) {
        app_connection_status = CONNECTED_TO_NETWORK;
    }
}

// ------------------------------------------------------------------------ END

Additional Support

Resources

Love this project?

'Buy This Kit' button takes you directly to the shopping cart where you can easily add or remove products.