kizniche/ttgo-tbeam-ttn-tracker

GPS doesn't work...

schroepfer opened this issue · 59 comments

... with t-beam Rev1.
My T_BEAM_V10 is defined in the configuration.h , the RX and TX of the GPS is set right.
The blue GPS-LED blinks, even the t-beam is switched off!

I searched GPS for hours. It doesn*t work. With Meshtastic GPS is working fine.
With the t-beam GPS-testsoftware from https://github.com/luckynrslevin/TTGO-T-Beam-GPS it also doesn't work.
Any hints?

Juergen

double check your GPS RX PIN they moved it around with redesigns between the versions
the test code could be for older board

T22_V05 20180608 (https://www.banggood.com/LILYGO-TTGO-T-Beam-ESP32-433868915Mhz-WiFi-Wireless-bluetooth-Module-p-1320390.html)
T22_V06 20180705 (https://www.banggood.com/LILYGO-TTGO-T-Beam-433MHz470MHz868MHz915MHz-ESP32-WiFi-Wireless-bluetooth-Module-p-1345473.html)
T22_V07 20180711
T22_V1.0 20190612

My board is T22_V1.0 20190612.
This is, what i set:

// Select which T-Beam board is being used. Only uncomment one.
//#define T_BEAM_V07 // AKA Rev0 (first board released)
#define T_BEAM_V10 // AKA Rev1 (second board released)
....
#define GPS_RX_PIN 34
#define GPS_TX_PIN 12

I've got the same problem - meshtastic locks - this script doesn't
I did switch the gps pins around to no avail - both times the gps led started to flash after a while to indicate successful lock, but the software still stated no lock :/

Yes, only Meshtastic works now for the t-beam 1.x .
It seems, that ther is no tracker-software now for these boards.
hottimuc and noppingen tracker doesn't work too......

@kizniche could you have a look at this and maybe compare it to meshtastics gps implementation?

I'll take a look at it.

and any news?

UPDATE: After leaving the device on the balcony over night, I do get GPS information in the serial monitor, like

TRANSMITTING
Lat: 47.975985
Lng: 7.824609
Alt: 7.824608
Hdop: 9
Sats: 11

It works!

The only difficulty is when you copy the DevEUI, AppEUI you have to select "lsb" mode (first click on < >, then on the settings icon) - while AppKey needs "msb" - then just copy the code.

Now I have to see how to feed the data to TTNmapper..

--- This was my previous post ---
I seem to have the same problem. I bought a T-Beam T22_V1.1 from Tindie. On the board, they are indicating

GPS TX: IO34 = ESP32 RX
GPS RX: IO12 = ESP32 TX

Corresponds well to

#define GPS_RX_PIN 34
#define GPS_TX_PIN 12

The blue LED blinks, the red LED is rather dim. On the serial console, I can see this when booting:

en:8896
load:0⸮⸮⸮⸮c
I2C device found at address 0x34 !
axp192 PMU found
done

AXP192 Begin PASS
DCDC1: ENABLE
DCDC2: ENABLE
LDO2: ENABLE
LDO3: ENABLE
DCDC3: ENABLE
Exten: ENABLE
----------------------------------------
DCDC1: ENABLE
DCDC2: ENABLE
LDO2: ENABLE
LDO3: ENABLE
DCDC3: ENABLE
Exten: ENABLE
TTN MAP-TRACK 1.1.1
TTN MAP-TRACK 1.1.1

I also see "Charging - No Charging" when I press the button. Any ideas?
Andreas

I can confirm GPS works in the latest commit. I haven't been able to reproduce the issue. It also looks like you're no longer having this issue. Are we good to close this issue?

.. i have still no GPS after hours. I use you newest release from today on my t-beam v1.0.

If you get no error when compiling and everything uploads fine the thing might be broken. Is the GPS antenna attached? Does a red LED close the the GPS chip blink? (Not the dim red one ).

Do you have a battery inserted (I know it's not necessary) and does the blue LED go on when charging? Do you see the starup messages in the serial console? Is your power source really good and stable?

Hello hagenbuch,
if you read my comments, you wouldn't ask these questions!
(the module works fine with Meshtasic!)
The red LED is off, the blue one lights, when charging.

Sorry I didn't - then the question is, could Meshtastic (whatever that is) read the GPS?

Ah thanks.. looks great - well then I would try to switch on all available debugging signals, is LoRa working correctly? Could you create and transfer the AppEUI, DevEUI (both lsb) and AppKey (msb)? Does the TTN server show data?

I didn't test anything else. I first wait, until GPS is working....

I'm sure you've set

#define T_BEAM_V10

...

sure! Aber 100%ig !

i think too, that there are differeces between the versions 20190612 (mine), 20191212 and 20201212 in the GPS.
Who knows?

Interestingly, I powered up another T-Beam from the same batch and left the Meshtastic software that it shipped with running.
That failed to get a GPS fix too.
I found the following thread:
meshtastic/firmware#187
Note the comments about a race condition in the Sparkfun_ublox library ...anyway downloading and flashing that latest Meshtastic firmware, my device picked up 5 satellites almost immediately.
When I then flash ttgo-tbeam-ttn-tracker, no GPS....

From the testing we've done today, it looks like no serial Comms are happening with the GPS on affected devices. My best guess (and it is a guess at this stage) is that the problem could be to do with the serial baud rate. Apparently the Neo6M can have the hardware baud set in software, so if the devices have been shipped with a baud other than 9600 then maybe that explains the issue.
Still investigating but thought I'd post this in case others can look into it too...

Thanks for the insight. I wish I had this device to help with testing. Please share any new developments.

We've come to the conclusion that Meshtastic has "broken" the TBeams GPS. We took a know good T-Beam running ttgo-tbeam-ttn-tracker (GPS lock acquired within a few minutes). Then flashed Meshtastic 0.91. That acquired a GPS lock within a few minutes. Then we reflashed ttgo-tbeam-ttn-tracker - now NO GPS.
We loaded up a basic GPS serial comms sketch and theres no output from the GPS serial port. I tied the battery short reset but that doesnt make a difference.
I've filed a bug report on the Meshtastic Github page:
meshtastic/firmware#334
Just received a shipment of 6 TBeams from LilyGo (all shipped with Meshtastic) and none of them will acquire a GPS lock.

TinyGPS is very limited in scope, so I've been experimenting with SparkFun_Ublox_Arduino_Library. I've been able to switch the GPS to NMEA mode and selectively enable/disable NMEA sentences, with the settings persisting across reboots. However, it seems TinyGPS still isn't properly parsing any of the NMEA sentences I've tried individually enabling. I haven't had a lot of time to work on this, but it's progress. Here's the code I used for the T-Beam V1.0:

//https://github.com/sparkfun/SparkFun_Ublox_Arduino_Library
//http://librarymanager/All#SparkFun_Ublox_GPS
#include <SparkFun_Ublox_Arduino_Library.h>
SFE_UBLOX_GPS myGPS;

// Select your board version
//#define T_BEAM_V07  // AKA Rev0 (first board released)
#define T_BEAM_V10  // AKA Rev1 (second board released)

#if defined(T_BEAM_V07)
#define GPS_RX_PIN      12
#define GPS_TX_PIN      15
#elif defined(T_BEAM_V10)
#include <Wire.h>
#include "axp20x.h"
AXP20X_Class axp;
#define I2C_SDA         21
#define I2C_SCL         22
#define GPS_RX_PIN      34
#define GPS_TX_PIN      12
#endif

void setup() {
  Serial.begin(115200);
  while (!Serial);  // Wait for user to open the terminal
  Serial.println("Connected to Serial");

#if defined(T_BEAM_V10)
  Wire.begin(I2C_SDA, I2C_SCL);
  if (!axp.begin(Wire, AXP192_SLAVE_ADDRESS)) {
      Serial.println("AXP192 Begin PASS");
  } else {
      Serial.println("AXP192 Begin FAIL");
  }
  axp.setPowerOutPut(AXP192_LDO3, AXP202_ON); // GPS main power
#endif
  
  Serial1.begin(9600, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN);

  do {
    if (myGPS.begin(Serial1)) {
      Serial.println("Connected to GPS");
      myGPS.setUART1Output(COM_TYPE_NMEA); //Set the UART port to output NMEA only
      myGPS.saveConfiguration(); //Save the current settings to flash and BBR
      Serial.println("GPS serial connected, output set to NMEA");
      myGPS.disableNMEAMessage(UBX_NMEA_GLL, COM_PORT_UART1);
      myGPS.disableNMEAMessage(UBX_NMEA_GSA, COM_PORT_UART1);
      myGPS.disableNMEAMessage(UBX_NMEA_GSV, COM_PORT_UART1);
      myGPS.disableNMEAMessage(UBX_NMEA_VTG, COM_PORT_UART1);
      myGPS.disableNMEAMessage(UBX_NMEA_RMC, COM_PORT_UART1);
      myGPS.enableNMEAMessage(UBX_NMEA_GGA, COM_PORT_UART1);
      Serial.println("Enabled/disabled NMEA sentences");
      break;
    }
    delay(1000);
  } while(1);
}

void loop() {
  if (Serial1.available()) {
    Serial.write(Serial1.read());  // print anything comes in from the GPS
  }
}

Hello
I've modified a LilyGO sketch with SparkFun libraries to help you out to reset U-blox NEO GPS devices on TTGO T-beam T22- V1.0 and 1.1
This sketch will bring back U-blox GPS N6M & N8M factory settings so that NMEA 9600 over the GPS serial output is enabled.
You can download this sketch on my GitHub:
https://github.com/eriktheV-king/TTGO_T-beam_GPS-reset
It worked fine for my 5 T-beams... good luck !

Fantastic. Thanks for your help.

@eriktheV-king, I modified this exact same Sparkfun example file, in pretty much the same way, however it did not restore functionality after flashing the ttn-tracker code. Have you been able to successfully get a GPS lock with ttn-tracker following an execution of the code you link to?

t0xa commented

TinyGPS is very limited in scope, so I've been experimenting with SparkFun_Ublox_Arduino_Library. I've been able to switch the GPS to NMEA mode and selectively enable/disable NMEA sentences, with the settings persisting across reboots. However, it seems TinyGPS still isn't properly parsing any of the NMEA sentences I've tried individually enabling. I haven't had a lot of time to work on this, but it's progress. Here's the code I used for the T-Beam V1.0:

//https://github.com/sparkfun/SparkFun_Ublox_Arduino_Library
//http://librarymanager/All#SparkFun_Ublox_GPS
#include <SparkFun_Ublox_Arduino_Library.h>
SFE_UBLOX_GPS myGPS;

void setup() {
  Serial.begin(115200);
  while (!Serial);  // Wait for user to open the terminal
  Serial.println("Connected to Serial");
  Serial1.begin(9600, SERIAL_8N1, 34, 12);

  do {
    if (myGPS.begin(Serial1)) {
      Serial.println("Connected to GPS");
      myGPS.setUART1Output(COM_TYPE_NMEA); //Set the UART port to output NMEA only
      myGPS.saveConfiguration(); //Save the current settings to flash and BBR
      Serial.println("GPS serial connected, output set to NMEA");
      myGPS.disableNMEAMessage(UBX_NMEA_GLL, COM_PORT_UART1);
      myGPS.disableNMEAMessage(UBX_NMEA_GSA, COM_PORT_UART1);
      myGPS.disableNMEAMessage(UBX_NMEA_GSV, COM_PORT_UART1);
      myGPS.disableNMEAMessage(UBX_NMEA_VTG, COM_PORT_UART1);
      myGPS.disableNMEAMessage(UBX_NMEA_RMC, COM_PORT_UART1);
      myGPS.enableNMEAMessage(UBX_NMEA_GGA, COM_PORT_UART1);
      Serial.println("Enabled/disabled NMEA sentences");
      break;
    }
    delay(1000);
  } while(1);
}

void loop() {
  if (Serial1.available()) {
    Serial.write(Serial1.read());  // print anything comes in from the GPS
  }
}

I can confirm that after running this code on Meshtastic T-Beam Rev1 T22_V1.1 20191212 ttgo-tbeam-ttn-tracker started to report GPS coordinates.

Thank you so much!

Have you been able to successfully get a GPS lock with ttn-tracker following an execution of the code you link to?

I also notice your code sets and saves UBX mode rather than NMEA:

Hello Kyle

My sketch wakes up the T-beam's powerchip as in the original LilyGO example, but in the loop I used example code that came with the SparkFun library. So I didn't actually change much, just combined the necessary lines from both and greyed out the unnecessary.

It polls the U-blox to see if its UART runs on 9600 or 38400 baud, then sets speed to 38400. I left the line of code setting UBX output (could have left that out, too), then save the config.
GPS UART comes back at 38400, then hard resets, then issues a factory restore which restores NMEA output and 9600 baud.

As a test, it polls the Ublox for the protocol version, then keeps outputting cordinates on the T22-V1.1
On polling the GPS protocol version after u-blox factory restore, the V1.0 t-beam often restarted due to a 'guru meditation error'.
But when I loaded the original sketch from LilyGO https://github.com/LilyGO/TTGO-T-Beam/tree/master/GPS-T22_v1.0-20190612 , all 'unbricked' t-beam GPS'es work fine: within a few seconds started outputting good cordinates, and within 20 seconds the gps LED shows a fix, too.
I also successfully tested Luckynrslevin's https://github.com/luckynrslevin/TTGO-T-Beam-GPS sketch.

I then tried your ttn-tracker script, and get a fix and cordinates on the T-beam screen right away, too.
I'm a Mestastic-addict, but I certainly will test out your mapping app !

IMG_20200825_162726

I don't believe the AXP code is necessary. My example is bare bones and changes the GPS mode to NMEA. Changing baud rate and the resets also appear to be unnecessary.

I don't believe the AXP code is necessary. My example is bare bones and changes the GPS mode to NMEA. Changing baud rate and the resets also appear to be unnecessary.

Indeed, lots of unnecessary stuff. I should have greyed out even more, but I was too much in a hurry to get something working to cheer up the moods.
AXP code needs to wake it up to provide power to ESP32 and GPS, though.

AXP code needs to wake it up to provide power to ESP32 and GPS

The original code I posted works and doesn't have any AXP code.

AXP code needs to wake it up

Indeed you are correct. I suppose my AXP chip was already configured from the ttn-tracker code running and then immediately flashing the test code, without previously unplugging it. I've updated my original code to include minimal AXP code to power the GPS and also the ability to select the board revision so you don't have to mess with pins. I plan to refactor the ttn-tracker code to use this library instead of TinyGPS so this type of reset/reconfiguration will not be necessary.

AXP code needs to wake it up to provide power to ESP32 and GPS

The original code I posted works and doesn't have any AXP code.

Do you implement this code in the ttn-Tracker software?

t0xa commented

Do you implement this code in the ttn-Tracker software?

@schroepfer Are you asking about implementing switch back from UBX protocol to NEMA protocol directly in ttgo-tbeam-ttn-tracker project?

... exactly.

t0xa commented

I don't think it's worth it to implement this. It's not directly related to the hardware/software and it's a feature of Meshtastic. Maintainer will need to document, test and support this code. I think it would be enough to just add "Known issues" section in docs with a reset snippet. It's only my view, it's up to @kizniche to decide.

I haven't been able to get @geeksville's modified fork of SparkFun_Ublox_Arduino_Library to work with my T-Beams. If it were a simple replacement of the TinyGSP library, I may commit to it, but I haven't been able to get the GPS to return coordinates. Additionally, I don't want to add the SparkFun_Ublox_Arduino_Library to this project only to switch to NMEA mode if it's not already in NMEA mode. It's far easier to add a comment in the Readme for the user to run a small sketch if they have an affected device. If anyone can get the above library to work, I'll see about replacing TinyGPS with it.

So this has been fun to work thru - but still not seeing results with lat / longitude hitting the TTN mapper app -have a v1.0 device - ran the v3 fixup for nmea - and in the serial monitor is seeing results ...

image

and in the TTN see the messages passing, but not sure how to validate the payload, I see the following metadata for the message

Payload : AF1C353B4A7500BC0A08
metadata:
{
"time": "2020-09-25T15:37:52.713835288Z",
"frequency": 903.9,
"modulation": "LORA",
"data_rate": "SF10BW125",
"coding_rate": "4/5",
"gateways": [
{
"gtw_id": "eui-58a0cbfffe8024ce",
"timestamp": 684862788,
"time": "2020-09-25T15:37:52.846798896Z",
"channel": 0,
"rssi": -82,
"snr": 11
}
]
}

and a payload, but not seeing results in ttnmapper, I'm moving the device around and didn't see any different results yet.

Did you copy the decoder from step 6 of the Setup in the Readme to your app in TTN?

Did you copy the decoder from step 6 of the Setup in the Readme to your app in TTN?

I did not - let me read again. (Jese you are quick! )

image

Cleared it right up - thank you so much - Added a screenshot for other's.

Hi there,

i am quite new to the LoraWAN topic and i have the follwing problem:
The Display of my T-Beam V1.0 shows the right gps coordinates but using the payload decoder on ttn i get the wrong results.

configuration.h is changed to V10

Any ideas? Thanks in advance,

Maurice aka muckisg

Hi. Did you skip this step?

Hi, i copied the decoder function of course if you mean this step.

Can you show the output?

Here the ttn output:

image

right data should be: lat:51.xxxx , long: 7.xxxx

Another payload output:

image

T-Beam display data is correct but ...

Okay. Please start a new issue, as this is different issue from this one.

OK

We've come to the conclusion that Meshtastic has "broken" the TBeams GPS. We took a know good T-Beam running ttgo-tbeam-ttn-tracker (GPS lock acquired within a few minutes). Then flashed Meshtastic 0.91. That acquired a GPS lock within a few minutes. Then we reflashed ttgo-tbeam-ttn-tracker - now NO GPS.
We loaded up a basic GPS serial comms sketch and theres no output from the GPS serial port. I tied the battery short reset but that doesnt make a difference.
I've filed a bug report on the Meshtastic Github page:
meshtastic/Meshtastic-device#334
Just received a shipment of 6 TBeams from LilyGo (all shipped with Meshtastic) and none of them will acquire a GPS lock.

thanks. same behaviour here ...

Not sure if the GPS reset scripts are working (nothing happens uploading the sketch ... last message from arduino is "Hard resetting via RTS pin ...") ... device stucks after that ...

Do you know that meshtastic is modifying gps settings during run ?
Did you try to reset your gps to factory settings ?

indeed - it 's working fine after a reset of the GPS Chip ... thanks for your help!

To clarify: meshtastic didn't "break" the GPS. The GPS has configurable protocol options that it stores in its own flash, meshtastic just uses a different set of options (Ublox protocol rather than NMEA) than this project and tells the GPS to make those changes.

Hello I've modified a LilyGO sketch with SparkFun libraries to help you out to reset U-blox NEO GPS devices on TTGO T-beam T22- V1.0 and 1.1 This sketch will bring back U-blox GPS N6M & N8M factory settings so that NMEA 9600 over the GPS serial output is enabled. You can download this sketch on my GitHub: https://github.com/eriktheV-king/TTGO_T-beam_GPS-reset It worked fine for my 5 T-beams... good luck !

this works for me. all my TTGO had meshtactics and could not get GPS to lock on TTGO T-Beam Tracker. I uploaded your code for few minutes then uploaded TTGO T-Beam Tracker again and got everything to work! thanks!

Hello,

I have a T-Beam-AXP2101-V1.2 and the gps doesn't works. Meshtastic was already installed on it when i got it

I tried all the sketch above but none of them works for me as they were all written for AXP192.

I'm quite a newbie so i'm unable to correct the code.

Could someone help me please ?

Regards