GNSS Module | Getting Data Through UART Interface
Update #10124  |  08 Nov 2014


This update shows how to get data in the computer module Colibri T20 from the GNSS receiver through the UART interface, print it into the console and later save it into a file.


1.      Hardware connection


GNSS Interfaces



As it can be seen on the block diagram above [1], the GNSS module provide USB, UART, I2C and SPI. For our project, the UART (Universal Asynchronous Receiver/Transmitter) interface is selected.


GNSS UART interface description

The serial ports consist of an RX and a TX line. Neither handshaking signals nor hardware flow control signals are available. These serial ports operate in asynchronous mode [2].

The baud rate supported by the GNSS module are:


The baud rate selected is 9600.


Colibri T20 UART interface

Extract from Colibrit T20 datasheet - The Colibri Tegra provides up to five serial UART interfaces. Three of them are backward compatible with the Colibri PXAxxx modules. [3]

UART Features

  • Support 16450 and 16550 compatible modes.
  • 16 byte FIFO.
  • Up 4.5 Mbaud.
  • Word length 5 to 8 bit, optional parity, one or two stop bits.
  • Auto sense baud detection.


As was explained in the last update the peripherical interface for the colibriT20 is provide by the Iris Carrier board.

From the five UART interfaces, we have selected the UART B, from the extension connector (X16) Iris Carrier Board.


Hardware connection between Colibri T20 – GNSS MODULE

Iris CB – Extension Connector X16

GNSS module – Board
















For a more detail connection please follow the diagram below

For a full hardware description of the GNSS module, please visit the GNSS Module Selection update. Here

For a full description of the computer module Colibri T20, please visit Toradex Website or the Coding - Getting started | "Hello World" update, here.


2.      Preliminary test using “out of the box” example – how to use UART by Toradex

For this preliminary test we will use the tutorial provide by toradex, how to use UART, here.

Key points:

  • The UART interface is treated as a COM PORT by windows. Verify that the port used is COM2 for UART_B.
    •  /// Open interface to reader
          if (*port == INVALID_HANDLE_VALUE)
              printf("Error Opening COM Port\n");
              return FALSE;
  • The information received from the GNSS module, will be save in “receiveBuffer”. Set a buffer size big enough to obtain a representative data set, in our case is 512.
    • char receiveBuffer[512] = {0};
    • memset(receiveBuffer, 0, 512);
    • ReadFile(portHandle, receiveBuffer, 512, &noOfBytesRead, NULL);
  • Set a nice and understandable presentation to show the data in the console. :)
    •   printf("\n\n\n**************************************************************************\n");
                  printf("GLOBODAQ - PRELIMINARY TEST UART INTERFACE - TORADEX |how to use UART|\n");
                  printf("[1] Read\n");
                  printf("[2] Write\n");
                  printf("[3] Exit\n");
                  printf("Enter your choice:\t");
                  scanf_s("%d", &firstChoice);   
                  printf("                               NMEA SENTENCES ARE:\n\n");


For its implementation and more details please watch the video below.


3.      Saving NMEA sentences into a “GPS.txt” file.

Next to the acquisition of the GNSS module data through the UART interface, is implemented the function to store the data incoming into a txt file. In order to storage NMEA sentences and used for later data processing.

This was implemented using the functions CreateFile and WriteFile from the C library, is relevant to mention that every time the read data is going to be right at the end of the GPS.txt file.

For its implementation and more details please watch the video below.






[1] NEO 7 datasheet Ublox

[2] U-blox 7 Receiver Description Including Protocol Specification V14

[3] Colibri T20 datasheet, Toradex AG.


more info globodaq.co


gmail       pinterest   twitter   wordpress