Intermediate
20 min

Provide accurate location information with TESEO-LIV4F and ATmega644

Simultaneous multi-constellation and multi band GNSS (GPS/Galileo/Glonass/BeiDou/QZSS)

GNSS 9 Click with EasyAVR v7

Published Jan 08, 2025

Click board™

GNSS 9 Click

Dev. board

EasyAVR v7

Compiler

NECTO Studio

MCU

ATmega644

Submeter positioning accuracy with low-power dual-band GNSS tracking

A

A

Hardware Overview

How does it work?

GNSS 9 Click is based on the TESEO-LIV4F, a dual-band GNSS module from STMicroelectronics designed for low-power positioning operation. This module integrates the Teseo IV single-die GNSS receiver, capable of simultaneously tracking multiple satellite constellations, including GPS, Galileo, GLONASS, BeiDou, and QZSS, and is IRNSS constellation-ready. The result is reliable, real-time positioning data across various challenging environments. Despite its compact size, the TESEO-LIV4F delivers exceptional submeter-level positioning accuracy thanks to its integrated Temperature Compensated Crystal Oscillator (TCXO) and Real-Time Clock (RTC) oscillator, ensuring reduced Time To First Fix (TTFF). The module also supports Real-Time Assisted GNSS (RT-AGNSS), which predicts satellite data based on past observations, enhancing its efficiency and accuracy. It is CE-certified, ensuring compliance with industry standards and broad applicability. The GNSS receiver supports multiple frequency bands, including GPS/QZSS L1C/A at 1575.42 MHz and L5C at 1176.45 MHz, GLONASS L1OF within the range of 1592.9525 to 1610.485 MHz, BeiDou B1i at 1561.098 MHz and B2a at 1207.14 MHz, Galileo E1 at 1575.42 MHz and E5a at 1176.45 MHz, as

well as SBAS L1C/A. The TESEO-LIV4F module brings the advanced accuracy and robust performance of Teseo IV technology to a wide range of applications. Its embedded firmware and evaluation environment simplify development and make it suitable for diverse use cases, including vehicle tracking and fleet management, goods tracking and logistics, drones and tolling systems, anti-theft and emergency call systems, public transportation, and vehicle diagnostics, as well as people and pet location solutions, insurance platforms, and vehicle sharing systems. The GNSS 9 Click communicates with the host MCU through a UART interface using the standard UART RX and TX pins. The default communication speed is set at 115200bps, ensuring efficient data exchange. It also provides an I2C interface for communication with a host MCU in the I2C Fast speed mode (400kHz). Still, it must be noted that the I2C interface can only be operated in the peripheral mode. Besides interface pins, this Click board™ also incorporates a reset pin (RST) for direct module resetting and an external interrupt signal (WUP) that can be programmed for various functions, such as waking up the module. Furthermore, GNSS 9 Click includes a blue PPS LED indicator, which, in combination with the PPS

pin, detects a synchronized pulse signal from the TESEO-LIV4F once per second. The PPS function is enabled by default, and the module will output the PPS signal once a 3D fix is achieved. This Click board™ also features the SMA antenna connector with an impedance of 50Ω, compatible with various antennas available from MIKROE, like the Active GPS Antenna, to enhance its connectivity. The external antenna supply is not always activated by default but can be controlled via the AON pin. This pin activates the TPS22943 load switch, which enables the module to provide the necessary power supply for the antenna's operation. This design allows for flexible control of the external antenna's power, ensuring it is only supplied when needed. Also, in the case of the primary supply failure, the module can use a backup supply voltage from a connected battery on the back of the board if it is needed for the Click board™ to work as a standalone device. This Click board™ can be operated only with a 3.3V logic voltage level. The board must perform appropriate logic voltage level conversion before using MCUs with different logic levels. It also comes equipped with a library containing functions and example code that can be used as a reference for further development.

GNSS 9 Click hardware overview image

Features overview

Development board

EasyAVR v7 is the seventh generation of AVR development boards specially designed for the needs of rapid development of embedded applications. It supports a wide range of 16-bit AVR microcontrollers from Microchip and has a broad set of unique functions, such as a powerful onboard mikroProg programmer and In-Circuit debugger over USB. The development board is well organized and designed so that the end-user has all the necessary elements in one place, such as switches, buttons, indicators, connectors, and others. With four different connectors for each port, EasyAVR v7 allows you to connect accessory boards, sensors, and custom electronics more

efficiently than ever. Each part of the EasyAVR v7 development board contains the components necessary for the most efficient operation of the same board. An integrated mikroProg, a fast USB 2.0 programmer with mikroICD hardware In-Circuit Debugger, offers many valuable programming/debugging options and seamless integration with the Mikroe software environment. Besides it also includes a clean and regulated power supply block for the development board. It can use a wide range of external power sources, including an external 12V power supply, 7-12V AC or 9-15V DC via DC connector/screw terminals, and a power source via the USB Type-B (USB-B)

connector. Communication options such as USB-UART and RS-232 are also included, alongside the well-established mikroBUS™ standard, three display options (7-segment, graphical, and character-based LCD), and several different DIP sockets which cover a wide range of 16-bit AVR MCUs. EasyAVR v7 is an integral part of the Mikroe ecosystem for rapid development. Natively supported by Mikroe software tools, it covers many aspects of prototyping and development thanks to a considerable number of different Click boards™ (over a thousand boards), the number of which is growing every day.

EasyAVR v7 horizontal image

Microcontroller Overview

MCU Card / MCU

ATmega644

Architecture

AVR

MCU Memory (KB)

64

Silicon Vendor

Microchip

Pin count

40

RAM (Bytes)

4096

You complete me!

Accessories

Active GPS antenna is designed to enhance the performance of your GPS and GNSS Click boards™. This external antenna boasts a robust construction, making it ideal for various weather conditions. With a frequency range of 1575.42MHz and a 50Ohm impedance, it ensures reliable signal reception. The antenna delivers a gain of greater than -4dBic within a wide angular range, securing over 75% coverage. The bandwidth of +/- 5MHz further guarantees precise data acquisition. Featuring a Right-Hand Circular Polarization (RHCP), this antenna offers stable signal reception. Its compact dimensions of 48.53915mm and a 2-meter cable make it easy to install. The magnetic antenna type with an SMA male connector ensures a secure and convenient connection. If you require a dependable external antenna for your locator device, our active GPS antenna is the perfect solution.

GNSS 9 Click accessories 1 image

Used MCU Pins

mikroBUS™ mapper

Antenna Supply Control
PA7
AN
Reset
PA6
RST
ID COMM
PA5
CS
NC
NC
SCK
NC
NC
MISO
NC
NC
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
Module Wake-Up Interrupt
PD4
PWM
Time Pulse
PD2
INT
UART TX
PD1
TX
UART RX
PD0
RX
I2C Clock
PC0
SCL
I2C Data
PC1
SDA
NC
NC
5V
Ground
GND
GND
1

Take a closer look

Click board™ Schematic

GNSS 9 Click Schematic schematic

Step by step

Project assembly

EasyAVR v7 front image hardware assembly

Start by selecting your development board and Click board™. Begin with the EasyAVR v7 as your development board.

EasyAVR v7 front image hardware assembly
GNSS2 Click front image hardware assembly
GNSS2 Click complete accessories setup image hardware assembly
EasyAVR v7 Access DIP MB 1 - upright/background hardware assembly
Necto image step 2 hardware assembly
Necto image step 3 hardware assembly
Necto image step 4 hardware assembly
NECTO Compiler Selection Step Image hardware assembly
NECTO Output Selection Step Image hardware assembly
Necto image step 6 hardware assembly
Necto DIP image step 7 hardware assembly
EasyPIC PRO v7a Display Selection Necto Step hardware assembly
Necto image step 9 hardware assembly
Necto image step 10 hardware assembly
Necto PreFlash Image hardware assembly

Track your results in real time

Application Output

1. Application Output - In Debug mode, the 'Application Output' window enables real-time data monitoring, offering direct insight into execution results. Ensure proper data display by configuring the environment correctly using the provided tutorial.

2. UART Terminal - Use the UART Terminal to monitor data transmission via a USB to UART converter, allowing direct communication between the Click board™ and your development system. Configure the baud rate and other serial settings according to your project's requirements to ensure proper functionality. For step-by-step setup instructions, refer to the provided tutorial.

3. Plot Output - The Plot feature offers a powerful way to visualize real-time sensor data, enabling trend analysis, debugging, and comparison of multiple data points. To set it up correctly, follow the provided tutorial, which includes a step-by-step example of using the Plot feature to display Click board™ readings. To use the Plot feature in your code, use the function: plot(*insert_graph_name*, variable_name);. This is a general format, and it is up to the user to replace 'insert_graph_name' with the actual graph name and 'variable_name' with the parameter to be displayed.

Software Support

Library Description

GNSS 9 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.

Example Description
This example demonstrates the use of GNSS 9 Click by reading and displaying the GNSS coordinates.

Key functions:

  • gnss9_cfg_setup - Config Object Initialization function.

  • gnss9_init - Initialization function.

  • gnss9_get_pps_pin - This function returns the PPS pin logic state.

  • gnss9_reset_device - This function resets the device by toggling the RST pin.

  • gnss9_parse_gpgga - This function parses the GPGGA data from the read response buffer.

Application Init
Initializes the driver and resets the Click board.

Application Task
Reads the received data, parses the GPGGA info from it, and once it receives the position fix it will start displaying the coordinates on the USB UART.

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 GNSS 9 Click example
 *
 * # Description
 * This example demonstrates the use of GNSS 9 Click by reading and displaying
 * the GNSS coordinates.
 *
 * The demo application is composed of two sections :
 *
 * ## Application Init
 * Initializes the driver and resets the Click board.
 *
 * ## Application Task
 * Reads the received data, parses the GPGGA info from it, and once it receives the position fix
 * it will start displaying the coordinates on the USB UART.
 *
 * ## Additional Function
 * - static void gnss9_clear_app_buf ( void )
 * - static err_t gnss9_process ( gnss9_t *ctx )
 * - static void gnss9_parser_application ( uint8_t *rsp )
 *
 * @author Stefan Ilic
 *
 */

#include "board.h"
#include "log.h"
#include "gnss9.h"

#define PROCESS_BUFFER_SIZE 300

static gnss9_t gnss9;
static log_t logger;

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

/**
 * @brief GNSS 9 clearing application buffer.
 * @details This function clears memory of application buffer and reset its length and counter.
 * @return None.
 * @note None.
 */
static void gnss9_clear_app_buf ( void );

/**
 * @brief GNSS 9 data reading function.
 * @details This function reads data from device and concatenates data to application buffer.
 * @param[in] ctx : Click context object.
 * See #gnss9_t object definition for detailed explanation.
 * @return @li @c  0 - Read some data.
 *         @li @c -1 - Nothing is read or Application buffer overflow.
 * See #err_t definition for detailed explanation.
 * @note None.
 */
static err_t gnss9_process ( gnss9_t *ctx );

/**
 * @brief GNSS 9 parser application.
 * @param[in] rsp Response buffer.
 * @details This function logs GNSS data on the USB UART.
 * @return None.
 * @note None.
 */
static void gnss9_parser_application ( uint8_t *rsp );

void application_init ( void )
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    gnss9_cfg_t gnss9_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 " );

    // Click initialization.
    gnss9_cfg_setup( &gnss9_cfg );
    GNSS9_MAP_MIKROBUS( gnss9_cfg, MIKROBUS_1 );
    err_t init_flag = gnss9_init( &gnss9, &gnss9_cfg );
    if ( ( UART_ERROR == init_flag ) || ( I2C_MASTER_ERROR == init_flag ) )
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }
    
    log_info( &logger, " Application Task " );
}

void application_task ( void )
{
    if ( GNSS9_OK == gnss9_process( &gnss9 ) )
    {
        if ( PROCESS_BUFFER_SIZE == app_buf_len )
        {
            gnss9_parser_application( app_buf );
        }
    }
}

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 gnss9_clear_app_buf ( void ) 
{
    memset( app_buf, 0, app_buf_len );
    app_buf_len = 0;
}

static err_t gnss9_process ( gnss9_t *ctx ) 
{
    int32_t rx_size = 0;
    uint8_t rx_buf[ PROCESS_BUFFER_SIZE ] = { 0 };
    if ( GNSS9_DRV_SEL_UART == ctx->drv_sel )
    {
        rx_size = gnss9_generic_read( ctx, rx_buf, PROCESS_BUFFER_SIZE );
    }
    else
    {
        if ( GNSS9_OK == gnss9_generic_read( ctx, rx_buf, 1 ) )
        {
            if ( GNSS9_DUMMY != rx_buf[ 0 ] )
            {
                rx_size = 1;
            }
        }
    }
    if ( rx_size > 0 ) 
    {
        int32_t buf_cnt = app_buf_len;
        if ( ( ( app_buf_len + rx_size ) > PROCESS_BUFFER_SIZE ) && ( app_buf_len > 0 ) ) 
        {
            buf_cnt = PROCESS_BUFFER_SIZE - ( ( app_buf_len + rx_size ) - PROCESS_BUFFER_SIZE );
            memmove ( app_buf, &app_buf[ PROCESS_BUFFER_SIZE - buf_cnt ], buf_cnt );
        }
        for ( int32_t rx_cnt = 0; rx_cnt < rx_size; rx_cnt++ ) 
        {
            if ( rx_buf[ rx_cnt ] ) 
            {
                app_buf[ buf_cnt++ ] = rx_buf[ rx_cnt ];
                if ( app_buf_len < PROCESS_BUFFER_SIZE )
                {
                    app_buf_len++;
                }
            }
        }
        return GNSS9_OK;
    }
    return GNSS9_ERROR;
}

static void gnss9_parser_application ( uint8_t *rsp )
{
    uint8_t element_buf[ 100 ] = { 0 };
    if ( GNSS9_OK == gnss9_parse_gpgga( rsp, GNSS9_GPGGA_LATITUDE, element_buf ) )
    {
        static uint8_t wait_for_fix_cnt = 0;
        if ( ( strlen( element_buf ) > 0 ) )
        {
            log_printf( &logger, "\r\n Latitude: %.2s degrees, %s minutes \r\n", element_buf, &element_buf[ 2 ] );
            gnss9_parse_gpgga( rsp, GNSS9_GPGGA_LONGITUDE, element_buf );
            log_printf( &logger, " Longitude: %.3s degrees, %s minutes \r\n", element_buf, &element_buf[ 3 ] );
            memset( element_buf, 0, sizeof( element_buf ) );
            gnss9_parse_gpgga( rsp, GNSS9_GPGGA_ALTITUDE, element_buf );
            log_printf( &logger, " Altitude: %s m \r\n", element_buf );
            wait_for_fix_cnt = 0;
        }
        else
        {
            if ( wait_for_fix_cnt % 5 == 0 )
            {
                log_printf( &logger, " Waiting for the position fix...\r\n\n" );
                wait_for_fix_cnt = 0;
            }
            wait_for_fix_cnt++;
        }
        gnss9_clear_app_buf(  );
    }
}

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