Problem Interfacing SAM M8Q GPS Module with ATSAMD21 Controller (Custom Board)

Hi Everyone,

I have designed a custom board containing UBLOX- SAM M8Q and ATSAMD21 Controller. I have been trying for days to interface the SAM M8Q with the controller without any luck. What is confusing is that I can get the data of GPS Module using echo code which I am also sharing. However, when I run a professional Library's example code, I get no data at all.

The Echo code image along with received data is shared. I am using SERCOM1 Pins PA18 and PA19 of ATSAMD21 for connection with GPS Module's via UART

PA18 -> RX of GPS
PA19 -> TX of GPS

I have tried following libraries

  1. Bolderflight UBLOX library.
  2. Sparkfun UBLOX exmple library
  3. Also tried sample code from this video (10Hz U-blox binary GPS data in 66 lines of code (arduino) - YouTube)

Please help me in resolving this issue. I would be really thankful.

  1. The Echo Code that I uploaded which gives output data from GPS
#include <Arduino.h>
#include "wiring_private.h"
#include "UBLOX.h"


Uart Serial2 (&sercom1, 12, 10, SERCOM_RX_PAD_3, UART_TX_PAD_2);

void SERCOM1_Handler()
{
  Serial2.IrqHandler();
}

UBLOX gps(Serial2,9600);


void setup() {
  Serial.begin(9600);
  Serial2.begin(9600);

  pinPeripheral(10, PIO_SERCOM);
  pinPeripheral(12, PIO_SERCOM);

  //gps.begin();

  while(!Serial);

  Serial.println("Communication Started");

}

void loop() {
  if (Serial2.available()) {
    Serial.write(Serial2.read());
  }

  delay(100);

  if (Serial.available()) {
    Serial2.write(Serial.read());
  }

}
  1. The output that I am getting on Serial Monitor using this code
Serial Monitor Output

46.00,A,2455.62510,N,06705.70401,E,0.228,,060319,,,A*67
$GNVTG,,T,,M,0.228,N,0.422,K,A*31
$GNGGA,071846.00,2455.62510,N,06705.70401,E,1,06,4.82,58.9,M,-44.1,M,,*$G,5151$GNRM,,7,9
$GNR,,7,9
$GNR,,7,9
$GNRT1,,6*$GNRG,22,7$GNRG,22,7$GNRV.207A$GNRN.27,.$GNRN.27,.$GNRV.27,.$GNRN48321$GNRN48322$GNRV.27,.$GNR$-4,V9$GNR$-4,V9$GNRG4.0,0$GNR
,,4S1$GNR
M42G7$GNR
,,,8A$GNR
M450,$GNR69.,,0$GNRA,50,0$GNR*..,20$GNR64.,20$GNR65.,20$GNR
M450,$GNR,6,,27$GNRA0,,28$GNRA0,,29$GNRA0,,20$GNR,6,2,2$GNR,,,,V9$GNR,,,,G7$GNR,1,VL0$GNR,1,VL0$GNR98,SG,$GNR98,SG,$GNR1.,G$E$GNR98,SG,$GNR,,6
*0$GNR0,,G
2$GNR34,P
,$GNR0,,G
4$GNR66,$C2$GNR66,$C1$GNR00,
65$GNR00,
65$GNR,17527$GNR00,
64$GNR,,6
*0$GNR2,,73.$GNR00,
65$GNR5,,73.$GNR4E5*,5$GNR3,,73.$GNR0E5*,5$GNR.6,217$GNR1,7690$GNR0,7690$GNR.0,217$GNR.4,217$GNR.5,217$GNRE0,34,$GNR,667,6$GNR1,7390$GNR046,06$GNR,667,0$GNR,7303N$GNR7.,,,,$GNR,730,0$GNR25A33N$GNR35A358$GNR.0G116$GNR70,270$GNR07A,15$GNR07A,15$GNR76S,3G$GNR80,1,5$GNR.0G014$GNR.0G014$GNR63
,7N$GNR5,N,2L$GNR0NG17L$GNR0NG17L$GNR0NG17L$GNR7,$1,G$GNR03
53G$GNR,9C47N$GNR,9C4,$GNR05$1,G$GNR7,$1,G$GNR,0C4,$GNRN21,4
$GNR,0C4,$GNR,6*32
$GNRN21,4
$GNR,6*32
$GNR,6*32
$GNR1573,6$GNR15.,3*$GNR15.,3*$GNR1573,6$GNR15.,3*$GNR6.343F$GNR24254,$GNR24254,$GNR.,8,63$GNR62,6,5$GNR62,6,5$GNR.,8,63$GNR508,63$GNR507961$GNR23,001$GNR4.4,80$GNR4.4,80$GNR4..0,,$GNR50.001$GNR28,015$GNR,403,8$GNR,504,8$GNRA05,2,$GNRA05,2,$GNRA05,2,$GNRA05,2,$GNR0751V6$GNR00,3S5$GNR00,3S5$GNR00,3S5$GNR00,3S5$GNR,2.6*9$GNR00,3,,$GNR.,,,V6$GNR.,,,V6$GNR.,,,V6$GNR.,,,V6$GNR6A,4S6$GNR0G,4G2$GNR0G,4G2$GNR0G,4G2$GNR1G,,L,$GNR1G,,

As per the guidelines in the post "How to use this forum - please read" pinned to the tope of the list of posts, can you provide the code you are actually using ?

Its difficult to provide help when only a small part of the code you are using is shown in a not easy to read screenshot. Also provide cut and paste the serial monitor output as text, its a lot easier for us to read.

There is also a forum section for posting GPS type questions, its the section;

Networking, Protocols, and Devices - I2C, SPI, XBee, GPS, etc.

Hi, thanks for the responses. I am going to share things properly.

This is the Arduino Sketch that I am using for echo

  1. Arduino Echo Sketch

#include <Arduino.h>
#include "wiring_private.h"
#include "UBLOX.h"

Uart Serial2 (&sercom1, 12, 10, SERCOM_RX_PAD_3, UART_TX_PAD_2);

void SERCOM1_Handler()
{
Serial2.IrqHandler();
}

UBLOX gps(Serial2,9600);

void setup() {
Serial.begin(9600);
Serial2.begin(9600);

pinPeripheral(10, PIO_SERCOM);
pinPeripheral(12, PIO_SERCOM);

//gps.begin();

while(!Serial);

Serial.println("Communication Started");

}

void loop() {
if (Serial2.available()) {
Serial.write(Serial2.read());
}

delay(100);

if (Serial.available()) {
Serial2.write(Serial.read());
}

}

  1. The serial monitor output for this code is :

Communication Started

46.00,A,2455.62510,N,06705.70401,E,0.228,,060319,,,A67
$GNVTG,,T,,M,0.228,N,0.422,K,A
31
$GNGGA,071846.00,2455.62510,N,06705.70401,E,1,06,4.82,58.9,M,-44.1,M,,$G,5151$GNRM,,7,9
$GNR,,7,9
$GNR,,7,9
$GNRT1,,6
$GNRG,22,7$GNRG,22,7$GNRV.207A$GNRN.27,.$GNRN.27,.$GNRV.27,.$GNRN48321$GNRN48322$GNRV.27,.$GNR$-4,V9$GNR$-4,V9$GNRG4.0,0$GNR
,,4S1$GNR
M42G7$GNR
,,,8A$GNR
M450,$GNR69.,,0$GNRA,50,0$GNR*..,20$GNR64.,20$GNR65.,20$GNR
M450,$GNR,6,,27$GNRA0,,28$GNRA0,,29$GNRA0,,20$GNR,6,2,2$GNR,,,,V9$GNR,,,,G7$GNR,1,VL0$GNR,1,VL0$GNR98,SG,$GNR98,SG,$GNR1.,G$E$GNR98,SG,$GNR,,6
0$GNR0,,G
2$GNR34,P
,$GNR0,,G
4$GNR66,$C2$GNR66,$C1$GNR00,
65$GNR00,
65$GNR,17527$GNR00,
64$GNR,,6
0$GNR2,,73.$GNR00,
65$GNR5,,73.$GNR4E5
,5$GNR3,,73.$GNR0E5
,5$GNR.6,217$GNR1,7690$GNR0,7690$GNR.0,217$GNR.4,217$GNR.5,217$GNRE0,34,$GNR,667,6$GNR1,7390$GNR046,06$GNR,667,0$GNR,7303N$GNR7.,,,,$GNR,730,0$GNR25A33N$GNR35A358$GNR.0G116$GNR70,270$GNR07A,15$GNR07A,15$GNR76S,3G$GNR80,1,5$GNR.0G014$GNR.0G014$GNR63
,7N$GNR5,N,2L$GNR0NG17L$GNR0NG17L$GNR0NG17L$GNR7,$1,G$GNR03
53G$GNR,9C47N$GNR,9C4,$$GNR05$1,G$GNR7,$1,G$GNR,0C4,$$GNRN21,4
$GNR,0C4,$$GNR,632
$GNRN21,4
$GNR,6
32
$GNR,632
$GNR1573,6$GNR15.,3
$GNR15.,3*$GNR1573,6$GNR15.,3*$GNR6.343F$GNR24254,$GNR24254,$GNR.,8,63$GNR62,6,5$GNR62,6,5$GNR.,8,63$GNR508,63$GNR507961$GNR23,001$GNR4.4,80$GNR4.4,80$GNR4..0,,$GNR50.001$GNR28,015$GNR,403,8$GNR,504,8$GNRA05,2,$GNRA05,2,$GNRA05,2,$GNRA05,2,$GNR0751V6$GNR00,3S5$GNR00,3S5$GNR00,3S5$GNR00,3S5$GNR,2.6*9$GNR00,3,,$GNR.,,,V6$GNR.,,,V6$GNR.,,,V6$GNR.,,,V6$GNR6A,4S6$GNR0G,4G2$GNR0G,4G2$GNR0G,4G2$GNR1G,,L,$GNR1G,,

srnet:
As per the guidelines in the post "How to use this forum - please read"

@Faisi_968 you did not read the guidelines, did you? Why should the forum help you if you won't do the smallest thing you are requested to do?

I am sorry. Going to re-post sir

No, do not re-post. Modify your original post.

Done

Remove the delay in loop() and try again.

Sir, I am getting GPS data using this code as u can see in the output. I am not able to get the data when I use any libraries or example codes. I basically want to extract Latitude and Longitude information from the data which the libraries would assist in due to their functions. However, when I upload library example code, I get no data and Serial Monitor remains blank.

Faizi_968:
Sir, I am getting GPS data using this code as u can see in the output.

Follow the advice in post #8 and then post what the GPS 'data' looks like.

Followed the advice Sir. The data is coming more proper now. How to extract Lat Long from this.

Serial Monitor Output

$GNRMC,083103.00,A,2455.63371,N,06705.68690,E,0.981,,060319,,,A*69
$GNVTG,,T,,M,0.981,N,1.816,K,A*33
$GNGGA,083103.00,2455.6300,A,2455.63394,N,06705.68646,E,1.081,33.36,060319,,,A*4D
$GNVTG,33.36,T,,M,1.081,N,2.002,K,A*1E
$GNGGA,083104.00,2455.63394,N,06705.68646,E,1,11,1.05,86.2,M,-44.1,M,,*5B
$GNGSA,A,3,09,05,28,30,07,11,,,,,,,2.00,1.05,1.70*1E
$GNGSA,A,3,67,66,75,76,77,,,,,,,,2.00,1.05,1.70*1E
$GPGSV,4,1,13,01,00,143,,04,,,34,05,07,307,18,07,52,000,39*4F
$GPGSV,4,2,13,08,44,071,17,09,79,156,21,11,22,132,10,17,01,197,*7A
$GPGSV,4,3,13,18,03,118,18,23,44,145,20,27,19,046,19,28,40,245,27*7B
$GPGSV,4,4,13,30,36,316,23*48
$GLGSV,3,1,09,65,25,182,,66,59,262,34,67,24,323,29,75,14,049,10*69
$GLGSV,3,2,09,76,38,009,12,77,27,294,21,85,14,047,18,86,28,103,*60
$GLGSV,3,3,09,87,09,159,21*54
$GNGLL,2455.63394,N,06705.68646,E,083104.00,A,A*7A
$GNRMC,083105.00,A,2455.63383,N,06705.68646,E,0.504,,060319,,,A*68
$GNVTG,,T,,M,0.504,N,0.933,K,A*35
$GNGGA,083105.00,2455.63383,N,06705.68646,E,1,11,0.94,86.8,M,-44.1,M,,*5F
$GNGSA,A,3,09,05,28,30,07,11,,,,,,,1.81,0.94,1.54*1B
$GNGSA,A,3,67,66,75,76,77,,,,,,,,1.81,0.94,1.54*1B
$GPGSV,4,1,13,01,00,143,,04,,,34,05,07,307,18,07,52,000,39*4F
$GPGSV,4,2,13,08,44,071,16,09,79,156,21,11,22,132,10,17,01,197,*7B
$GPGSV,4,3,13,18,03,118,18,23,44,145,21,27,19,046,19,28,40,245,27*7A
$GPGSV,4,4,13,30,36,316,25*4E
$GLGSV,3,1,09,65,25,182,,66,59,262,34,67,24,323,29,75,14,049,10*69
$GLGSV,3,2,09,76,38,009,09,77,27,294,20,85,14,047,18,86,28,103,*6B
$GLGSV,3,3,09,87,09,159,21*54
$GNGLL,2455.63383,N,06705.68646,E,083105.00,A,A*7D

At last, proper GPS sentences.

One of the easiest GPS libraries to use is TinyGPSplus. There will be 'how to' examples with the library.

Perfect. Now, how to convert basic example sketch in the library to support Software Serial or SERCOM instead of normal Serial port for GPS communication.

Sir srnet, Thankyou so much for your help. Getting proper data now. Really appreciate your help. Stay Blessed.

Faizi_968:
Done

Thanks. +1 Karma. What about post #3?