Page 1 of 2

STM32F103C8 and NEO-M6N gps module

Posted: Sun Apr 05, 2020 1:21 pm
by jxid
Hi to all
i am working on a project with an STM32F103C8 and a GPS Module M6N.
I am using Arduino IDE and the code below:

Code: Select all

#include <TinyGPS++.h>

TinyGPSPlus gps;  

void setup() {
    Serial1.begin(9600);
    Serial.begin(115200);
}

void loop() {
  while (Serial1.available()>0)
  gps.encode(Serial1.read());
  unsigned long start;
  double lat_val, lng_val;
  bool loc_valid;
  lat_val = gps.location.lat();
  loc_valid = gps.location.isValid(); 
  lng_val = gps.location.lng();

  if (!loc_valid)
  {
    Serial.println("No Valid GPS Data");
    delay(5000);
  }
  else                             
  {    
    Serial.println("GPS READING: ");
    Serial.print("Latitude : ");
    Serial.println(lat_val, 3); 
    Serial.print("Longitude : ");
    Serial.println(lng_val, 3);
    delay(2000);   

}
}
My connections are:

GPS Module----STM32
=====================
VCC-----------5V
GND-----------GND
TX-------------PA10
RX-------------PA9

The problem is that i can not get any data in my Serial monitor.
Can anyone help me?
Thank you,
Yannis

Re: STM32F103C8 and NEO-M6N gps module

Posted: Sun Apr 05, 2020 1:46 pm
by stevestrong
Do you have the USB serial driver installed?

Re: STM32F103C8 and NEO-M6N gps module

Posted: Sun Apr 05, 2020 1:54 pm
by jxid
What driver do you mean?

Re: STM32F103C8 and NEO-M6N gps module

Posted: Sun Apr 05, 2020 3:38 pm
by Pito
Add the test for Serial (usb)..

Code: Select all

void setup() {
    Serial1.begin(9600);
    Serial.begin(115200);
    delay(2000);
    Serial.println("GPS NEO6N starts..");
}
What do you get now?

Re: STM32F103C8 and NEO-M6N gps module

Posted: Sun Apr 05, 2020 3:47 pm
by jxid
I get:

Code: Select all

GPS NEO6N starts..
No Valid GPS Data
No Valid GPS Data
No Valid GPS Data
That means that the Serial works fine and prints everything.
But as i can understand i don't get the Serial1 (TX,RX) data to the serial monitor.

Re: STM32F103C8 and NEO-M6N gps module

Posted: Sun Apr 05, 2020 3:57 pm
by Pito
Doublecheck Rx/Tx lines (I always put 470ohm resistors in series with both rx/tx in case I messed up the wiring, btw).
Also doubleckeck whether Neo6 is in binary mode (there are two modes afaik, text and binary).

Re: STM32F103C8 and NEO-M6N gps module

Posted: Sun Apr 05, 2020 3:59 pm
by jxid
Thanks for the interest and your help Pito.
Rx and Tx lines are OK.
But how to check if the Neo6 is in binary mode?
Also is there any way to see what i get in Serial1 port?

Re: STM32F103C8 and NEO-M6N gps module

Posted: Sun Apr 05, 2020 4:11 pm
by Pito
Fastest way - you may add LEDs (via 1k resistors) on the RX and TX lines of the Serial1.
Active is low with serial.
Vcc--[1k]--|>|----RX/TX
You will see blinks when data on Rx or Tx

Btw is your NEO6 5V or 3.3V??

Re: STM32F103C8 and NEO-M6N gps module

Posted: Sun Apr 05, 2020 4:15 pm
by jxid
Pito wrote: Sun Apr 05, 2020 3:57 pm Doublecheck Rx/Tx lines (I always put 470ohm resistors in series with both rx/tx in case I messed up the wiring, btw).
Also doubleckeck whether Neo6 is in binary mode (there are two modes afaik, text and binary).
By the way Pito have you ever manage to make Neo-M6N to get work with STM32 board?
I have manage to get work M6N,M7N,M8N modules with Arduino UNO, ESP32, and ESP8266 in the past but never with STM32 board.
I would apreciate if you can post a working code for STM32 and M6N module.

Re: STM32F103C8 and NEO-M6N gps module

Posted: Sun Apr 05, 2020 4:16 pm
by jxid
Pito wrote: Sun Apr 05, 2020 4:11 pm Fastest way - you may add LEDs (via 1k resistors) on the RX and TX lines of the Serial1.
Active is low with serial.
Vcc--[1k]--|>|----RX/TX

Btw is your NEO6 5V or 3.3V??
Thanks for the tip.
My module is a 5V.