0

I have a Linx RXM-GPS-R4-x GPS module that uses the UART pins on the Raspberry Pi 3 model B's GPIO pinout. I'm also using the wiringPi's serial library. However, I'm having difficulty with understanding the communication between the GPS module and my Pi. The datasheet is here. This module uses the NMEA protocols for GPS data.

First, does the module require a wake up or start signal from the Pi to the module before data is sent from the module to the Pi? If this isn't the case, does the module just send and continuous stream for each type of GPS protocol? Lastly, can I just use the wiringPi's serialGetchar() to read the module-to-Pi signal?

I have a moderate understanding of C++ and a novice experience of the UART interface. Thank you for your time and help!

Below is a very unfinished prototype code if you'd like to suggest how I could approach this problem (I'm building upon a file by the author of the wiringPi author Gordon Henderson, file here):

#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <wiringPi.h>
#include <wiringSerial.h>

int main(){
int fd;
int count;
unsigned int nextTime;
if((fd=serialOpen("/dev/ttyAMA0",9600))<0){
    fprintf(stderr,"Unable to open serial device: %s\n",strerror(errno));
    return 1;
}
if(wiringPiSetup()==1){
    fprintf(stdout,"Unable to start wiringPi: %s\n",strerror(errno));
    return 1;
}
nextTime=millis()+300;
for(count=0;count<3;){
    printf("\nOut: %3d: ",count);
    if(millis()>nextTime){
        printf("\nOut: %3d: ",count);
        fflush(stdout);
        char in_recieved;/*what the Pi recieves from the module*/
        /*Begin Here*/ //serialPrintf();
    }
    while(serialDataAvail(fd)){
        printf(" -> %3d",serialGetchar(fd));
        fflush(stdout);
    }
    count+=1;
}

return 0;
}
  • 1
    It is EXTREMELY unlikely that the interface is /dev/ttyAMA0 See How-do-i-make-serial-work-on-the-raspberry-pi3 – Milliways Feb 21 '18 at 04:14
  • I had no idea that changed, I'll make the change and retry using a python script for troubleshooting. Thank you for that note. – Brandon Williams Feb 21 '18 at 05:18
  • Changing the port from ttyAMA0 to either /dev/serial0 or /dev/ttyS0 didn't make a change. – Brandon Williams Feb 21 '18 at 05:26
  • 1
    All the GPS units I have used start spitting out NMEA sentences as soon as they are powered. There is lots of software to read the sentences as this has been a standard for decades. There are even Linux GPS daemons you could use, e.g. gpsd. Perhaps try sudo apt-get install gpsd then man gpsd. – joan Feb 21 '18 at 08:31
  • 1.) What kind of GPS units have you used (brands, types, etc.)? 2.) I'm curious about the auto-feed concept because I did more searching and found the SiRF NMEA protocol manual https://www.sparkfun.com/datasheets/GPS/NMEA%20Reference%20Manual-Rev2.1-Dec07.pdf. It has a Controller-to-module output protocol section. Furthermore, in chapter 2 (Table 2-9, protocol 103) there is a 'Query/Rate Control' message. Having these possible messages is confusing me and I'm trying to make sense out of it all. – Brandon Williams Feb 21 '18 at 19:11

0 Answers0