T-beam NEO-6. NMEA output has stopped working

I have two tbeams. I wrote a program to read the NMEA sentence. Strip out all the unnecessary strings and chars .Then send the location data over Lora to the other tbeam to reconstruct it into a valid NMEA and serial out the string into google earth. All worked perfect. This is when i discovered Meshtastic. So uploaded the BIN files to my devices to try Meshtastic out. However found even though the red lock LED flashes. The OLED on both devices says ‘No GPS’ . So after looking through the Meshtastic code, I could not find the reason for this. So i reverted back to my own working code, only to find that this no longer worked with my tbeams. From what i can gather, there it no longer any NMEA data coming from my devices.My only conclusion is Meshtastic disables the NMEA output of the GPS. How do i factory reset or re-enable NMEA sentences on my onboard T-Beam blox NEO-6M GPS? below is the link to the T-beam i have. https://www.cnx-software.com/wp-content/uploads/2018/07/TTGO-T-Beam-Pinout-Large.jpg

Above I left a guide how to reset the gps module by shorting the buton cell. Maybe it solves the problem, even if it may not have anything to do with your problem, it costs nothing to try :smile:

Read your idea of shorting the button battery on another thread and have tried that, to no success. Also my board is different to the one you show. On my board there are not to solder pins by the side of the battery. However by using a set of tweezers i could short my version out. But as said this still failed to resolve the issue.

I’m sorry it didn’t work. I think you have to reflash the firmware of the ESP32 with the flash download tool, by downloading it from the website of the espressif. Try to go to the site, maybe you find more information

Just to confirm, you are loading the tbeam v07.bin fimware file? The different tbeam versions use different GPS RX and TX pins.

1 Like

I have uploaded my own tried and tested arduino routine to read in the GPS serial 9600 NMEA data with IO12 and IO15. I suspect the ESP32 is ok unless it has had a problem communicating with it’s own IO ports. It is more likely that the NEO GPS has had it’s settings changed so that it is no longer sending serial NMEA. So i would rather look at how to re-flash or factory reset the NEO GPS. Before suspecting the ESP has an issue.

You are right, it is my misstake.
However, deleting the gps backup memory by shorting the gps backup battery and loading the firmware again on my ttgo worked even after I did some tests.
I can’t understand why it didn’t work in yours! your GPS module will have non-volatile memory!
I’ll do other tests.
I have to investigate this thing better

I have loaded my own original TinyGPS++ routine that worked before reading the serial NMEA data. Which proves there are no NMEA strings coming from the GPS. This would rule out the Meshtastic firmware bin version being wrong as i am using a known working GPS program prior to Meshtastic. I know from my experience of writing the program, that NMEA strings are sent even when the GPS does not have a lock. I am edging towards the GPS has some how got set to sending binary data and not NMEA sentences and therefore tinyGPS++ functions report back no data. I need to find a routine that prints out the raw data stream coming from the GPS and then debug it out as HEX and Chars just to prove the GPS is at least sending something. Rather than use tinyGPS++ which only converts NMEA strings. Or maybe there is a raw data debug function in tinyGPS++. Will investigate further with this. Unless some one can save me some time with prior knowledge.

Titan Tronics. Yes was hoping shorting the battery would have worked for me, as this would be the most logical simplest solution. I to will try again. And short the battery while double checking my original working code is in the esp32, As by leaving the Meshtastic code in the esp32 will most likely re-introduced the problem on the next boot up.

Yes, try taking a test by doing this.

  1. Remove the T-beam battery
  2. Short out the gps backup battery
  3. program the T-Beam with your code by enabling NMEA or UBX protocol by saving the settings in the gps memory
  4. press the reset button , disconnect the T-Beam
  5. Put the battery, “optional” and plug the T-Beam back into the computer and see if the protocol works.
    I’m very curious if the gps module holds settings after this
    However, I will also do my own tests :wink:
2 Likes

Thank you Titan Tronics … Now working as NMEA 9600 baud strings again
I did this to both TTGO’s

  1. program the T-Beam with my original code
    2.Remove the T-beam battery
  2. Short out the gps backup battery
    4.Put the battery, “optional” and plug the T-Beam back into the computer and now NMEA 9600 is working.

Did this two both Modules and my old program using TinyGPS++ is now working.

For the record here is my own GPS Location code for Arduino using NMEA decoding and stripping flood sending and receiver reconstructed to NMEA string suitable for Google earth to read via the serial input mesh repeater routine for the tbeam.
It works, but is messy and does not follow rules on Lora Data Bandwidth. With a bit more work, would make a nice simple device tracker.
And it never progressed because i discovered Meshtastic as a better approach.

#include <SPI.h>
#include <LoRa.h>
#include <Wire.h>
#include <TinyGPS++.h>
#include “SSD1306.h”
#include <WiFi.h>
#include <Wstring.h>
//extern HardwareSerial Serial(0);
//extern HardwareSerial Serial1(1);
HardwareSerial MySerial2(2);
TinyGPSPlus gps;
#define SCK 5 // GPIO5 – SX1278’s SCK
#define MISO 19 // GPIO19 – SX1278’s MISnO
#define MOSI 27 // GPIO27 – SX1278’s MOSI
#define SS 18 // GPIO18 – SX1278’s CS
#define RST 14 // GPIO14 – SX1278’s RESET
#define DI0 26 // GPIO26 – SX1278’s IRQ(Interrupt Request)
#define BAND 868E6

SSD1306 display(0x3c, 21, 22);
//String Reconstruct;
const byte buff_len = 90;
char CRCbuffer[buff_len];
String msg="";
String rssi = “RSSI --”;
String packSize = “–”;
String packet =“New”;
String packetOld ="";
String packetOld1="";
String TimeNow;
String NS;
String EW;
uint64_t chipid;
int sats;
int hrs;
int mins;
int secs;
float Longt;
float Langt;
uint64_t ChipID;
char RXchipIDS[13];
uint64_t RxID;
unsigned int counter = 0;

void loraData(){

if (packet != packetOld )
{
if (chipid != RxID)
{
Serial.printf(“MyID = %04X”,(uint16_t)(chipid>>32));//print High 2 bytes
Serial.printf("%08X\n",(uint32_t)chipid);//print Low 4bytes.
Serial.printf(“RxID = %04X”,(uint16_t)(RxID>>32));//print High 2 bytes
Serial.printf("%08X\n",(uint32_t)RxID);//print Low 4bytes.
Serial.println(packet);
Serial.println(packetOld);
Serial.println(packetOld1);
int packet_len = packet.length() + 1;
char packetOld[packet_len];
packet.toCharArray(packetOld, packet_len);
RepeatPacket (packet); // resend recieved packet if different from last

  }
 else 
  {
    Serial.println("Ignore another station repeating this Station msg ");
  }

}

else
{
//Serial.println(“Ignore repeating echo loop around”);
}

display.clear();
display.drawString(0 , 16, packet);
display.drawString(50, 0, rssi);
display.display();
packet.toCharArray(RXchipIDS, 13);
RxID =( (long long unsigned)getUInt64fromHex(RXchipIDS)) ;
if (packet.substring(13,14)==“A”){
String sats = (getValue(packet,’,’,0));
String hrs = ( getValue(packet,’,’,1));
String mins = (getValue(packet,’,’,2));
String secs = (getValue(packet,’,’,3));
String latitude = (getValue(packet,’,’,4));
String longitude = (getValue(packet,’,’,5));
String height = getValue(packet,’,’,6);
float Longt= atof(longitude.c_str());
float Langt = atof(latitude.c_str());

  if ((Longt)>0) {
    EW="W";
 }
  else {
    EW="E";
    Longt=(-Longt);
  }

  if ((Langt)>0 ){
    NS="S";
  }
  else {
    NS="N";
    Langt=(-Langt);
  }
long Longtm=(int(Longt));
long Langtm=(int(Langt));
Longt=(Longt-Longtm)*60+(Longtm*100);
Langt=(Langt-Langtm)*60+(Langtm*100);
//msg =("$GPRMC,002454,A,3553.5295,N,13938.6570,E,0.0,43.1,180700,7.1,W,A*");// valid fake  NMEA 3F is checksum
//outputMsg(msg);  // ouput a valid test NMEA string
msg = ("$GPRMC,002454,A," + String(Longt)  + "," + NS +","+ String (Langt) + "," + EW + ",0.0,43.1,180700,7.1,W,A*");
outputMsg(msg); // print the entire message string, and append the CRC

}
else {
Serial.println(“No Valid Fix”);
}
}
String getValue(String data, char separator, int index)
{
int found = 0;
int strIndex[] = {0, -1};
int maxIndex = data.length()-1;

for(int i=0; i<=maxIndex && found<=index; i++){
if(data.charAt(i)==separator || i==maxIndex){
found++;
strIndex[0] = strIndex[1]+1;
strIndex[1] = (i == maxIndex) ? i+1 : i;
}
}

return found>index ? data.substring(strIndex[0], strIndex[1]) : “”;
}
void cbk(int packetSize) {
packet ="";
packSize = String(packetSize,DEC);
for (int i = 0; i < packetSize; i++) { packet += (char) LoRa.read(); }
rssi = "RSSI " + String(LoRa.packetRssi(), DEC) ;
loraData();

}

void setup() {
pinMode(16,OUTPUT);
pinMode(2,OUTPUT);

digitalWrite(16, LOW); // set GPIO16 low to reset OLED
delay(50);
digitalWrite(16, HIGH); // while OLED is running, must set GPIO16 in high

Serial.begin(115200);
Serial1.begin(9600, SERIAL_8N1, 12, 15); //12-TX 15-RX >NEO GPS
MySerial2.begin(9600, SERIAL_8N1, 13, 25); //13-TX 25-RX >Fake NMEA string for google earth
while (!Serial);
Serial.println();

chipid=ESP.getEfuseMac();//The chip ID is essentially its MAC address(length: 6 bytes).
Serial.printf(“ESP32 Chip ID = %04X”,(uint16_t)(chipid>>32));//print High 2 bytes
Serial.printf("%08X\n",(uint32_t)chipid);//print Low 4bytes.

SPI.begin(SCK,MISO,MOSI,SS);
LoRa.setPins(SS,RST,DI0);
if (!LoRa.begin(868E6)) {
Serial.println(“Starting LoRa failed!”);
while (1);
}
Serial.println(“LoRa init ok”);

display.init();
display.flipScreenVertically();
display.setFont(ArialMT_Plain_10);
LoRa.receive();
// LoRa.onReceive(cbk);// Callback not working No Interupt on pin;

}

void loop() {
smartDelay(10110);
display.drawString(104,0, “TX”);
display.display();
TimeNow=(“Time “+String(gps.time.hour())+”:”+String(gps.time.minute())+":"+ String(gps.time.second()));
Serial.println(TimeNow);
counter++;
// send packet
LoRa.beginPacket();
LoRa.printf("%04X",(uint16_t)(chipid>>32));//print High 2 bytes
LoRa.printf("%08X\n",(uint32_t)chipid);//print Low 4bytes.
if (gps.satellites.value()>3) {
LoRa.print(“A”);
}
else {
LoRa.print(“V”);
}
//LoRa.print(“Sats: “);
LoRa.print(gps.satellites.value());
LoRa.print(”,”);
LoRa.print(gps.time.hour());
LoRa.print(",");
LoRa.print(gps.time.minute());
LoRa.print(",");
LoRa.print(gps.time.second());
if (gps.satellites.value()>3){
LoRa.print(",");
LoRa.print(gps.location.lng(), 5);
LoRa.print(",");
LoRa.print(gps.location.lat(), 5);
LoRa.print(",");
LoRa.print(gps.altitude.feet() / 3.2808);
}
LoRa.endPacket();

}
void RepeatPacket( String RPpacket)
{
display.drawString(104,0, “RP”);
display.display();
LoRa.beginPacket();
LoRa.print (RPpacket);
Serial.println("REPEAT " +RPpacket );
LoRa.endPacket();
}

// -----------------------------------------------------------------------
void outputMsg(String msg) {
msg.toCharArray(CRCbuffer,sizeof(CRCbuffer)); // put complete string into CRCbuffer
byte crc = convertToCRC(CRCbuffer);
Serial.print(msg); // repeat for UART output
if (crc < 16) Serial.print(“0”); // add leading 0 if needed
Serial.println(crc,HEX);

}
//---------------------------------------------------------------------------------------
String uint64ToString(uint64_t input) {
String result = “”;
uint8_t base = 10;

do {
char c = input % base;
input /= base;

if (c < 10)
  c +='0';
else
  c += 'A' - 10;
result = c + result;

} while (input);
return result;
}
//----------------------------------------------------------------------------------------------------
uint64_t getUInt64fromHex(char const str)
{
uint64_t accumulator = 0;
for (size_t i = 0 ; isxdigit((unsigned char)str[i]) ; ++i)
{
char c = str[i];
accumulator = 16;
if (isdigit©) /
‘0’ … ‘9’
/
accumulator += c - ‘0’;
else if (isupper©) /* ‘A’ … ‘F’/
accumulator += c - ‘A’ + 10;
else /
‘a’ … ‘f’*/
accumulator += c - ‘a’ + 10;

}

return accumulator;

}
//-------------------------------------------------------------------------
byte convertToCRC(char buff) {
// NMEA CRC: XOR each byte with previous for all chars between ‘$’ and '

char c;
byte i;
byte start_with = 0;
byte end_with = 0;
byte crc = 0;

for (i = 0; i < buff_len; i++) {
c = buff[i];
if(c == ‘'){ start_with = i; } if(c == '*'){ end_with = i; } } if (end_with > start_with){ for (i = start_with+1; i < end_with; i++){ // XOR every character between '’ and ‘*’
crc = crc ^ buff[i] ; // compute CRC
}
}
else { // else if error, print a msg (to both ports)
Serial.println(“CRC ERROR”);
}
return crc;
//based on code by Elimeléc López - July-19th-2013
}

static void smartDelay(unsigned long ms)
{
unsigned long start = millis();
do
{
while (Serial1.available())
gps.encode(Serial1.read());
int packetSize = LoRa.parsePacket();
if (packetSize) { cbk(packetSize); }
} while (millis() - start < ms);
}

static void LoRaRxSmartWait(unsigned long ms)
{
unsigned long start = millis();

while (LoRa.parsePacket()==0)
    while (millis() - start < ms);

}

static void MillDelay(unsigned long ms)
{
unsigned long start = millis();
while (millis() - start < ms);

}

1 Like

wow nice.
I’ll stop my tests :smile:
You did it all, there is no room for more tests. Congratulations to the wonderful work you have done. :fire:

NOPE FAILED!!
Ah, No spoke to soon. Although the to tbeams started communicating with each other with my program. And the red fix led was flashing. The display did not populate with fix data. So have used a U-blox arduino routine to see if any data comes out when fix is acquired. And Nothing coming out in U-Blox digital mode. Then used another simple serial echo routine to see if any NMEA data was coming out. And still nothing. Seems both GPS neo 6 modules are dead and none accessible, even with trying to factory reset by shorting the battery. There are rumours there were fakes flying around that could not be used with U-blox digital mode.I am confused how by trying it has bricked the GPS?. Price of a new GPS chip to re float solder, lowest i have seen is £5. No guarantees it’s not fake as well. I might try it for the hell of it.

Ok before ordering a new GPS chip. I might as well try uploading the ESP32 firmware, just in case the problem is with that. How is that done? Do you have a link?

Oh and when i mean Firmware, I mean the ESP32 boot loaders and I/O back to factory . As maybe am getting confused by what is considered to be firmware and what i consider to be a program like Meshtastic as software. Also going to try shorting the battery back up pins directly on the Neo GPS chip. Also the Neo data sheet talks about 2 pins that set up what mode the Neo GPS wakes up in.As it makes no sense how Meshtastic has bricked the GPS and shorting the back up battery does not reset the GPS to factory default of sending out NMEA sentences at 9600 serial.

So is there any way of testing to see if the NEO 6 is stuck in i2c mode. Is there an i2c function call in ublox for a factory reset. As it looks from the Meshtastic code , that a reset is requested only in the serial mode. Here is a link to a group, looking into the implementation of a cold start function that is not included in the .h . Could this have any bearing on the problems of slow acquisition and also the inability to communicate with some GPS like mine? https://github.com/PX4/GpsDrivers/issues/26.

sorry I hadn’t noticed this thread before. Meshtastic has always switched the ublox GPS into ubx protocol mode, because UBX has a lot of advantages over NMEA. Both UBX and NMEA work over serial, UBX is just a different protocol. The ublox stores which protocol to use in its battery backed up ram.

If you’d like to use a different project you’ll need to switch it back (I haven’t written any code for this because this project didn’t need it). Someone just asked for something similar in this bug: https://github.com/meshtastic/Meshtastic-device/issues/334

I need to fix a few bugs first, but in the next couple of weeks I can add some sort of “switch GPS back to NMEA feature (somehow)”

No problem, learnt more about the code and how Neo 6 GPS work, by spending time trying to read up, work out and ask questions. I got it resolved by following this thread. Gps does not work in my application after installing Mestastic

As you say would be nice to have a snip-it of code to code to revert back to factory NMEA output. But see the issue regarding how will Meshtastic know to revert back? perhaps holding in one of the switches while powering up. Taking that a step further holding a button while powering up starts a menu for debug,settings, etc. Keep up the good work. I am learning more from this project than any other.

2 Likes