Intermediate
30 min

Know the exact position of your solution with PIC32MZ1024EFE144 and A2200-A

Navigating life's routes with unmatched GPS precision

GPS 6 Click with UNI Clicker

Published Sep 02, 2023

Click board™

GPS 6 Click

Dev Board

UNI Clicker

Compiler

NECTO Studio

MCU

PIC32MZ1024EFE144

Explore new horizons, blaze trails, and experience the outdoors with the assurance that your journey is enhanced by exceptional GPS accuracy

A

A

Hardware Overview

How does it work?

GPS 6 Click is based on the A2200-A, a high-performance Global Positioning System (GPS) module from Lantronix. This GPS module enables fast acquisition and tracking built on the SiRFstar IV technology. It operates with a frequency of 1,575GHz with accuracy from 2 to 2.5m and fully addresses the demand for the lowest power consumption. It is characterized by a high sensitivity of -148dBm during acquisition or while tracking (navigation sensitivity of -160dBm and tracking sensitivity of -163dBm) besides removing jammers during acquisition, allowing usage in many different environments and under harsh operating conditions. This Click board™ is configured in the Self-Start mode of operation by ON_OFF and WAKEUP pins connected. The entire

power operation will be activated in Self-Start mode once the 3V3 power rail is applied. The A2200-A communicates with the MCU using the UART interface with commonly used UART RX and TX pins as its communication protocol, operating at 115200bps by default to transmit and exchange data with the host MCU. It also possesses an active-low reset signal routed on the RST pin of the mikroBUS™ socket that activates a hardware reset of the A2200-A. On this line, the MAX809 is also connected, which performs a single function; it asserts a reset signal whenever the 3V3 supply voltage declines below a preset threshold. In addition to precise positioning, GPS allows for accurate timing due to the synchronized atomic clocks in the GPS satellites.  While the current date

and time are transmitted in NMEA sentences (UTC), a precise and accurate timing signal is provided via the 1PPS pin of the A2200 GPS receiver and indicated via a red LED indicator marked as PPS. GPS 6 Click possesses the SMA antenna connector with an impedance of 50Ω, which can connect the appropriate passive antenna that MIKROE offers for improved range and received signal strength. 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. Also, it comes equipped with a library containing functions and an example code that can be used as a reference for further development.

GPS 6 Click top side image
GPS 6 Click bottom side image

Features overview

Development board

UNI Clicker is a compact development board designed as a complete solution that brings the flexibility of add-on Click boards™ to your favorite microcontroller, making it a perfect starter kit for implementing your ideas. It supports a wide range of microcontrollers, such as different ARM, PIC32, dsPIC, PIC, and AVR from various vendors like Microchip, ST, NXP, and TI (regardless of their number of pins), four mikroBUS™ sockets for Click board™ connectivity, a USB connector, LED indicators, buttons, a debugger/programmer connector, and two 26-pin headers for interfacing with external electronics. Thanks to innovative manufacturing technology, it allows you to build

gadgets with unique functionalities and features quickly. Each part of the UNI Clicker development kit contains the components necessary for the most efficient operation of the same board. In addition to the possibility of choosing the UNI Clicker programming method, using a third-party programmer or CODEGRIP/mikroProg connected to onboard JTAG/SWD header, the UNI Clicker board also includes a clean and regulated power supply module for the development kit. It provides two ways of board-powering; through the USB Type-C (USB-C) connector, where onboard voltage regulators provide the appropriate voltage levels to each component on the board, or using a Li-Po/Li

Ion battery via an onboard battery connector. All communication methods that mikroBUS™ itself supports are on this board (plus USB HOST/DEVICE), including the well-established mikroBUS™ socket, a standardized socket for the MCU card (SiBRAIN standard), and several user-configurable buttons and LED indicators. UNI Clicker is an integral part of the Mikroe ecosystem, allowing you to create a new application in minutes. Natively supported by Mikroe software tools, it covers many aspects of prototyping thanks to a considerable number of different Click boards™ (over a thousand boards), the number of which is growing every day.

UNI clicker double image

Microcontroller Overview

MCU Card / MCU

default

Type

8th Generation

Architecture

PIC32

MCU Memory (KB)

1024

Silicon Vendor

Microchip

Pin count

144

RAM (Bytes)

262144

You complete me!

Accessories

GPS/3G External Antenna is an ideal choice for our GPS/GSM/3G Click boards™. It excels in providing strong GSM and 3G signal reception alongside impressive GPS positioning capabilities. Its robust design features a screw mount and adhesive base, ensuring secure attachment and optimal performance. This antenna boasts separate lines for GPS, GSM, and 3G, making it a versatile choice for applications that demand reliable communication and precise positioning. With a broad frequency range covering 850/900/1800/1900/2100MHz and 50Ω impedance, this antenna guarantees connectivity across various network bands. Its VSW Ratio of 2:1 and peak gain ranging from 1 to 1.5dBic (dependent on frequency) further enhance signal strength. The antenna offers a bandwidth exceeding 10MHz, ensuring consistent reception, while its linear polarization and omnidirectional azimuth coverage provide comprehensive signal accessibility.

GPS 6 Click accessories image

Used MCU Pins

mikroBUS™ mapper

NC
NC
AN
Reset
PH2
RST
NC
NC
CS
NC
NC
SCK
NC
NC
MISO
NC
NC
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
NC
NC
PWM
NC
NC
INT
UART TX
PB14
TX
UART RX
PB15
RX
NC
NC
SCL
NC
NC
SDA
NC
NC
5V
Ground
GND
GND
1

Take a closer look

Schematic

GPS 6 Click Schematic schematic

Step by step

Project assembly

UNI Clicker front image hardware assembly

Start by selecting your development board and Click board™. Begin with the UNI Clicker as your development board.

UNI Clicker front image hardware assembly
GNSS2 Click front image hardware assembly
SiBRAIN for STM32F745VG front image hardware assembly
Prog-cut hardware assembly
GNSS2 Click complete accessories setup image hardware assembly
UNI Clicker Access 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 image step 5 hardware assembly
Necto image step 6 hardware assembly
Necto image step 7 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

Track your results in real time

Application Output

After loading the code example, pressing the "DEBUG" button builds and programs it on the selected setup.

Application Output Step 1

After programming is completed, a header with buttons for various actions available in the IDE appears. By clicking the green "PLAY "button, we start reading the results achieved with Click board™.

Application Output Step 3

Upon completion of programming, the Application Output tab is automatically opened, where the achieved result can be read. In case of an inability to perform the Debug function, check if a proper connection between the MCU used by the setup and the CODEGRIP programmer has been established. A detailed explanation of the CODEGRIP-board connection can be found in the CODEGRIP User Manual. Please find it in the RESOURCES section.

Application Output Step 4

Software Support

Library Description

This library contains API for GPS 6 Click driver.

Key functions:

  • gps6_enable_device - This function enables device by setting the RST pin to LOW logic state

  • gps6_generic_read - This function reads a desired number of data bytes by using UART serial interface

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

Open Source

Code example

This example can be found in NECTO Studio. Feel free to download the code, or you can copy the code below.

/*!
 * @file main.c
 * @brief GPS 6 Click Example.
 *
 * # Description
 * This example demonstrates the use of GPS 6 click by reading and displaying
 * the GPS coordinates.
 *
 * The demo application is composed of two sections :
 *
 * ## Application Init
 * Initializes the driver and logger and enables 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 gps6_clear_app_buf ( void )
 * - static err_t gps6_process ( gps6_t *ctx )
 * - static void gps6_parser_application ( char *rsp )
 *
 * @author Stefan Filipovic
 *
 */

#include "board.h"
#include "log.h"
#include "gps6.h"

#define PROCESS_BUFFER_SIZE 200

static gps6_t gps6;
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;

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

/**
 * @brief GPS 6 data reading function.
 * @details This function reads data from device and concatenates data to application buffer.
 * @param[in] ctx : Click context object.
 * See #gps6_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 gps6_process ( gps6_t *ctx );

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

void application_init ( void ) 
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    gps6_cfg_t gps6_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.
    gps6_cfg_setup( &gps6_cfg );
    GPS6_MAP_MIKROBUS( gps6_cfg, MIKROBUS_1 );
    if ( UART_ERROR == gps6_init( &gps6, &gps6_cfg ) ) 
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }
    log_info( &logger, " Application Task " );
}

void application_task ( void ) 
{
    gps6_process( &gps6 );
    if ( app_buf_len > ( sizeof ( ( char * ) GPS6_RSP_GPGGA ) + GPS6_GPGGA_ELEMENT_SIZE ) ) 
    {
        gps6_parser_application( app_buf );
    }
}

void main ( void ) 
{
    application_init( );

    for ( ; ; ) 
    {
        application_task( );
    }
}

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

static err_t gps6_process ( gps6_t *ctx ) 
{
    int32_t rx_size = 0;
    char rx_buf[ PROCESS_BUFFER_SIZE ] = { 0 };
    rx_size = gps6_generic_read( ctx, rx_buf, PROCESS_BUFFER_SIZE );
    if ( rx_size > 0 ) 
    {
        int32_t buf_cnt = 0;
        if ( app_buf_len + rx_size >= PROCESS_BUFFER_SIZE ) 
        {
            gps6_clear_app_buf(  );
            return GPS6_ERROR;
        } 
        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_buf[ rx_cnt ] ) 
            {
                app_buf[ ( buf_cnt + rx_cnt ) ] = rx_buf[ rx_cnt ];
            }
            else
            {
                app_buf_len--;
                buf_cnt--;
            }
        }
        return GPS6_OK;
    }
    return GPS6_ERROR;
}

static void gps6_parser_application ( char *rsp )
{
    char element_buf[ 100 ] = { 0 };
    if ( GPS6_OK == gps6_parse_gpgga( rsp, GPS6_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 ] );
            gps6_parse_gpgga( rsp, GPS6_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 ) );
            gps6_parse_gpgga( rsp, GPS6_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++;
        }
        gps6_clear_app_buf(  );
    }
}

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

Additional Support

Resources