problem with gps :( only 0.0000 instead of real data:(

Post here first, or if you can't find a relevant section!
therion
Posts: 13
Joined: Sun Jan 14, 2018 5:47 am

Re: problem with gps :( only 0.0000 instead of real data:(

Post by therion » Sun Jan 14, 2018 12:06 pm

Arduino IDE 1.8.5.0
BluePill

Code: Select all

#include <Arduino.h>
Arduino IDE reinstalled, library libmaple core (https://github.com/rogerclarkmelbourne/Arduino_STM32) added (i had them ealier too)- and still
exit status 1
'Serial3' was not declared in this scope

stevestrong
Posts: 2062
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany
Contact:

Re: problem with gps :( only 0.0000 instead of real data:(

Post by stevestrong » Sun Jan 14, 2018 12:14 pm

If I understood correctly, you are uploading over Serial1, correct?
That means, you do not have SERIAL_USB defined.
In this case, UART3 is mapped to Serial2, see: https://github.com/rogerclarkmelbourne/ ... ial.h#L211
So try Serial2 instead Serial3.

Code: Select all

#define ss3 Serial2

therion
Posts: 13
Joined: Sun Jan 14, 2018 5:47 am

Re: problem with gps :( only 0.0000 instead of real data:(

Post by therion » Sun Jan 14, 2018 12:55 pm

Yes serial 1 (programator is connected to PA9,PA10)

Ok with this

Code: Select all

#define ss3 Serial2
it compile so we have a little sucess:)
Only little because still value is 0.00000:(
I tried to change Baud rate
From baud rate which was working well on aduino (4800):

Code: Select all

static const uint32_t GPSBaud = 4800;
I have tried:
and 4800, 9600, 19200, 38400, 57600, 115200, 230400
in GPS TX pin connected to PB11, RX to PB10
and oposite (TX PB10, RX PB11)
Value still 0.00000

Serial.begin(9600); allways 9600.

I dont have idea where is mistake:(

stevestrong
Posts: 2062
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany
Contact:

Re: problem with gps :( only 0.0000 instead of real data:(

Post by stevestrong » Sun Jan 14, 2018 1:06 pm

Monitor the data received from the GPS on PC:

Code: Select all

uint32_t time;
void loop() 
{
  if ( (millis()-time)<1000 )
  {
    if (ss3.available())
    {
      char c = ss3.read();
      Serial.write(c); // monitor the data from GPS on PC
      gps.encode(c);
    }
  }
  time = millis();
Serial.println("TEST");
Serial.println(gps.location.lat(),6);
Serial.println("_____");
}

therion
Posts: 13
Joined: Sun Jan 14, 2018 5:47 am

Re: problem with gps :( only 0.0000 instead of real data:(

Post by therion » Sun Jan 14, 2018 7:34 pm

i have really bad feeling about my stm32 future.
Now with thic code i have yhis wierd thing:
it should be only "TEST" i dont understand why there are additional signs (1,9,p...)

Code: Select all

1TEST
0.000000
_____
9TEST
0.000000
_____
PTEST
0.000000
_____
.TEST
0.000000
_____
1TEST
0.000000
_____
9TEST
0.000000
_____
STEST
0.000000
_____
2TEST
0.000000
Code:

Code: Select all

#include <TinyGPS++.h> 
#include <Arduino.h>
// -----------------gps
TinyGPSPlus gps;
#define ss3 Serial2
static const uint32_t GPSBaud = 9600;
// -----------------gps

void setup() 
{
  Serial.begin(9600);
  ss3.begin(GPSBaud);
}
uint32_t time;
void loop() 
{
  if ( (millis()-time)<1000 )
  {
    if (ss3.available())
    {
      char c = ss3.read();
      Serial.write(c); // monitor the data from GPS on PC
      gps.encode(c);
  }
  time = millis();
Serial.println("TEST");
Serial.println(gps.location.lat(),6);
Serial.println("_____");
delay(250);
}}

zmemw16
Posts: 1681
Joined: Wed Jul 08, 2015 2:09 pm
Location: St Annes, Lancs,UK

Re: problem with gps :( only 0.0000 instead of real data:(

Post by zmemw16 » Sun Jan 14, 2018 8:23 pm

try printing in hex line for each 'c', they might be non-printable ascii ?
stephen

stevestrong
Posts: 2062
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany
Contact:

Re: problem with gps :( only 0.0000 instead of real data:(

Post by stevestrong » Sun Jan 14, 2018 9:46 pm

OK, those characters are received from the GPS module, but the example was not quite the one I wanted (i missed a quote, and you put it on the wrong place...).
Now let's do a very simple test:

Code: Select all

void loop() 
{
  if (ss3.available())
  {
      char c = ss3.read();
      Serial.write(c); // monitor only the data from GPS on PC
  }
}
This should only print the received characters from the GPS module in raw format, like here: https://github.com/mikalhart/TinyGPSPlu ... le.ino#L10

Please post here the result.

User avatar
mrburnette
Posts: 2207
Joined: Mon Apr 27, 2015 12:50 pm
Location: Greater Atlanta
Contact:

Re: problem with gps :( only 0.0000 instead of real data:(

Post by mrburnette » Sun Jan 14, 2018 9:56 pm

therion wrote:
Sun Jan 14, 2018 12:55 pm
<...>
I tried to change Baud rate
From baud rate which was working well on aduino (4800):

Code: Select all

static const uint32_t GPSBaud = 4800;
I have tried:
and 4800, 9600, 19200, 38400, 57600, 115200, 230400
in GPS TX pin connected to PB11, RX to PB10
and oposite (TX PB10, RX PB11)
Value still 0.00000

Serial.begin(9600); allways 9600.

I dont have idea where is mistake:(
The Neo6 brand of GPS devices come from the factory at 9600 BAUD, based on my experience. If set to 4800 by software commands, it stays at 4800 (or whatever it was set for...)

They can take upwards to 25 minutes to acquire their first fix. Many GPS libraries will not output until the GPS status is locked ... can be a very real problem inside. There are a variety of GPS test programs that run on your PC that can give you visual info. You will need a USB-serial adapter, however.
http://www.visualgps.net/#clockmaze-content
https://en.softonic.com/downloads/gps-test
(I know nothing about these download sites... Google first)
While AVR Arduino may look a lots like STM32 Arduino, all of the core code and most supporting libraries have chsnged. Assume nothing.

If has been years (> 3) since I messed with the Neo6 and STM32F1XX Maple Mini. So, the ZIP I have on my project page is very likely to fail with the current version of the core, but you are welcome to look over stuff.
https://www.hackster.io/rayburne/color- ... ock-a8b121

If you plan on doing lots of serial projects, this is a useful device:
https://www.hackster.io/rayburne/the-qb ... tor-ae7015


Ray

PS:
stevestrong is one of our best, work with him and he'll get you through this rough spot.

therion
Posts: 13
Joined: Sun Jan 14, 2018 5:47 am

Re: problem with gps :( only 0.0000 instead of real data:(

Post by therion » Mon Jan 15, 2018 9:29 am

stevestrong is one of our best, work with him and he'll get you through this rough spot.
Ray, You are right, He is :)
By the way thanks for links. I have been earlier on Your site. Youre projects are too difficult for me now but maybe some day:)

Stevestrong Youre code start to working :)
Code

Code: Select all

void loop() 
{
  if (ss3.available())
  {
      char c = ss3.read();
      Serial.write(c); // monitor only the data from GPS on PC
  }
}
It show data exactly as in example You pointed in "https://github.com/mikalhart/TinyGPSPlu ... le.ino#L10"

On baudrate 9600 its working. hmmmm the same gps module work well on arduino only in Baudrate 4800... ok no matter:)

Ok now we have all data. For my project i need only latitude and longtitude. If by the way i can have altitude and number of satelites, it will be great.
And best for me if it can be save as data type like "float" or "double".
For example:
latitude - double1
Longtitude - double2
altitude - double3

Then i can make something like:
LCD TFT screen and buttons, press button 1 to show latitude, button 2 to show altitude etc...

stevestrong
Posts: 2062
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany
Contact:

Re: problem with gps :( only 0.0000 instead of real data:(

Post by stevestrong » Mon Jan 15, 2018 9:48 am

OK, now let's go back to the example I suggested before (corrected version):

Code: Select all

uint32_t time;
void loop() 
{
  if ( (millis()-time)<1000 )
  {
    if (ss3.available())
    {
      char c = ss3.read();
      Serial.write(c); // monitor the data from GPS on PC --- this is optional, can be commented out
      gps.encode(c);
    } // this line was missing before
  }
  time = millis();
Serial.println("TEST");
Serial.println(gps.location.lat(),6);
Serial.println("_____");
}
The first (maybe more than one) test line will most probably show zero, but after couple of seconds it should work and display a reasonable value.

Post Reply