Beginners: please read this post and this post before posting to the forum.
0 Members and 1 Guest are viewing this topic.
#include "sys/Axon.h" #include "rprintf.h" #include "uart.h" #include "Sensors/GPS/NMEA/gpsNMEA.h" //GPS libraryGPS_NMEA myGPS = MAKE_GPS_NMEA(UART0,4800); //Declares the GPS as a device, Set UART port and baud ratevoid appInitHardware(void){ //setup UART uartInit(UART1, 9600); rprintfInit(&uart1SendByte);} TICK_COUNT appInitSoftware(TICK_COUNT loopStart){ return 0;}// This is the main loopTICK_COUNT appControl(LOOP_COUNT loopCount, TICK_COUNT loopStart){ //GPS section if(gpsNMEAprocess(&myGPS) ){ // We have received something if(myGPS.info.valid){ // And we have a satellite fix if(myGPS.info.changes.values.longitude && myGPS.info.changes.values.latitude && myGPS.info.changes.values.speed && myGPS.info.changes.values.track){ // Longitude and latitude have been received - so fetch the values double longitude = myGPS.info.longitude; double latitude = myGPS.info.latitude; double speed = myGPS.info.speed; double track = myGPS.info.track; rprintf("Longitude = %d\n",myGPS.info.longitude); rprintf("Latitude = %d\n",myGPS.info.latitude); rprintf("Speed = %d\n",myGPS.info.speed); //In Knots rprintf("Track = %d\n",myGPS.info.track); } } else rprintf ("Fail to acquire signal"); } else rprintf ("Fail to receive something");return 0;}
//setup UART communication protocol uartInit(UART1, 9600); //set the Baud rate for communication at UART 1 (USB) rprintfInit(&uart1SendByte); uartInit(UART0, 4800);//set the Baud rate for communication at UART 0 (GPS)
For the signal, I was outside and had the GPS powered for 45 minutes, just to be sure.I have added an Initialise for UART 0 in this form: Code: [Select]//setup UART communication protocol uartInit(UART1, 9600); //set the Baud rate for communication at UART 1 (USB) rprintfInit(&uart1SendByte); uartInit(UART0, 4800);//set the Baud rate for communication at UART 0 (GPS) I am assuming I've done the initialise properly.Still nothing I don't currently have any way to connect the GPS directly to my PC for testing. I am also concerned about the Enable/Disable wire, I am assuming the GPS is enabled by default...I am trying to eliminate possibilities here, so is there anything silly I'm missing in my code? I know the GPS works at 4800 baud, and I have the Axon 2 at 9600 so it doesn't spit out miles and miles of readings too fast to read on screen.
Saw this on the Sparkfun comments:"Some things not in the data sheet--tie both enable and RX to 3.3 V and the output is defaulted to 4800 baud 8,n,1. "3.3V power levels...