Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DSM GPS telemetry not working #3290

Closed
1 task done
lionelkeeping opened this issue Mar 2, 2023 · 35 comments · Fixed by #3366
Closed
1 task done

DSM GPS telemetry not working #3290

lionelkeeping opened this issue Mar 2, 2023 · 35 comments · Fixed by #3366
Labels
bug 🪲 Something isn't working
Milestone

Comments

@lionelkeeping
Copy link

Is there an existing issue for this problem?

  • I have searched the existing issues

What part of EdgeTX is the focus of this bug?

Transmitter firmware

Current Behavior

The telemetry from the Spektrum SPMA95871 GPS sensor attached to the AR637TA smart receiver is not understood by EdgeTX. The sensor is recognized and new items are added to the telemetry data in the transmitter (SAT, Gspd and Date) but the data is incorrect. SAT is a number about 162 (saw 9 and 320 once but generally between 162 - 167). Gspd is zero but when I move the plane, the number jumps around erratically and is not a realistic speed. Date flashes numbers but they are not dates. The GPS also overloads the maximum of 40 telemetry slots.

Expected Behavior

I expected the radio to show me GPS positions, ground speed, and heading as it would on a Spektrum radio. I could then show this on the telemetry screens.

Steps To Reproduce

  1. Connect the GPS to the SBUS on the receiver
  2. Power up the transmitter
  3. Power up the receiver
  4. In Telemetry screen, select Discover new
  5. Radio will overload the telemetry slots
  6. Shut down the radio and restart to stop the overload
  7. Examine the Gspd, Sat, and Date Telemetry lines.

Version

Other (Please specify below)

Transmitter

Radiomaster Zorro

Anything else?

EdgeTX 2.8.1
4in1 firmware 1.3.3.20 AETR

@lionelkeeping lionelkeeping added bug 🪲 Something isn't working triage Bug report awaiting review / sorting labels Mar 2, 2023
@frankiearzu
Copy link
Contributor

frankiearzu commented Mar 3, 2023

I saw someone reporting this in Facebook. Don't have the sensor to test, but have been in that part of the code recently. Can you log the sensor data you are seeing and add it to this ticket. Here is how to setup telementry data log: https://www.youtube.com/watch?v=SsbnONkErbc.

From the comments in the code, looks like was not tested with the real sensor. Also the documentation from Spektrum.
The message to sensor mapping seems wrong acording to this documentation. (Byte 0 is after the sID field). Just to start, seems that the code is only processing deviceID IC2_GPS2 (0x17), The latiture/longitude comes in 0x16

Number of Satelites seems that is mapped OK, should show only 2 digits.
GpsD (Speed) seems to be mapped OK.
GpsDateTime probably needs to be conveted to BCD (uint32bcd)

I dont see anywhere we are processing latitute/longitute IC2_GPS (0x16).

GPSCapture

GPSCapture

@lionelkeeping
Copy link
Author

lionelkeeping commented Mar 3, 2023 via email

@frankiearzu
Copy link
Contributor

Lionel,
Im in a work trip in Germany for next week, so will not be able to work in this until then.. I added a feature on the DSM telemetry firmware (for 2.9.0 and already in nightly build) who exposes the RAW Spektrum telementry data to LUA scripts. What i can do when i return is create a small LUA script to record your GPS RAW sensor data into a file. In that way, you can send me the file and I can see what your sensor is sending. After that will be much easier to correct the firmware code. The feature was intended to support TextGen LUA scripts (example, to program AVIAN ESCs), but can also be used to capture other sensor telemetry messages RAW data
.

@lionelkeeping
Copy link
Author

lionelkeeping commented Mar 4, 2023 via email

@frankiearzu
Copy link
Contributor

frankiearzu commented Mar 14, 2023

Hi Lionel,
Created a DSM RAW telemetry capture tool to see what are you getting from your GPS. Just move the Lua script to your /SCRIPTS/TOOLS directory. (unzip the attached ZIP file in your computer, and copy the .lua script).

After you run it, you will have a menu to capture some telemetry streams for GPS:
We want to capture GPS STAT (16), GPS LOC (17) and maybe GPS Binary (26).
Quality of Serivce (7F) always work for Spektrum RX.

Run Quality of Service first for a little just to make sure your have the proper firmware.. if it is not capturing any lines, you don't have the right firmware (see firmware description at the end of this message).

The log is written to: /LOGS/dsm_raw_tel.txt. Is completly text so you can view it with Notepad or any other text editor.
The log file looks like:

---------Capturing I2C_ID 7F
7F 00 00 08 FF FF FF FF FF FF 00 00 00 00 02 99 20 AA

It will continue adding to the log until you delete the file.. if you want a clean capture, just delete the file and capture again.

You will need one of the latest nightly builds of EdgeTX or you can download a 2.8.1+TextGen that i compiled for myself here:
https://github.com/frankiearzu/DSMTools/tree/main/EdgeTx_Firmware
I have been using that for flying, but you can easilly rollback the firmaware back and forth between official 2.8.0, 2.8.1 and my version (show as 2.8.1-TextGen-selfbuild in the system info). The mechanism to capture this telemetry is the same that i am using to capture TextGen telemetry (ex, to program AVIAN ESC from your TX).

Once you have a good capture, zip the file and send it here.


DSM_Capture_Tel.zip

@lionelkeeping
Copy link
Author

lionelkeeping commented Mar 14, 2023 via email

@lionelkeeping
Copy link
Author

lionelkeeping commented Mar 14, 2023 via email

@frankiearzu
Copy link
Contributor

Thank you Lionel,
Thats what i was expecting.. in the QoS, we are not displaying the quality of the signal, but how many messages has we received, so its expected to only increase.
I see data for message ID=0x16, that is GPS_LOG from the documetation. Looks like no data on 26 (GPS_Binary), and i don't see any capture for message id=0x17 that is GPS_Status.. but i think the file here is truncated.

I have what i need to start, thank you, will check data agains the documentation and code.

Thank you,
Frankie

@frankiearzu
Copy link
Contributor

frankiearzu commented Mar 14, 2023

Lionel,
The file was truncated... can you try caputing message 0x17.. 16 and 17 are the two messages that GPS generates. Ones is location, the other status. Delete the file in your radio so that we start from an empty file.

Frankie

@lionelkeeping
Copy link
Author

lionelkeeping commented Mar 14, 2023 via email

@frankiearzu
Copy link
Contributor

trying to make sence of the data..
Where are you located?? and aproximate what altitude?

This is the data of one of the messages, but just like that, it does not a valid coordinate.
Altitute-Low = 17 00 = -170.0m or 17m
Latitude = 96 73 12 28 = 96.731228 or 28.127396
Longitude= 08 72 09 82 = 08.720982 or 82.090872
Course= 86 08 = 860.8 or 088.6
HDOP = 13
GPSFlags = B9 = 1100 1001 = North, WEST, GPS_FIX_VALID, Negative Altitude

@frankiearzu
Copy link
Contributor

No, there should be an option in the menus to capture 16,17, 26 and 7F. Let me try with a smaller screen.. i did my test on a TX16s. Maybe is hiding the menu option for 17

@lionelkeeping
Copy link
Author

lionelkeeping commented Mar 14, 2023 via email

@lionelkeeping
Copy link
Author

lionelkeeping commented Mar 14, 2023 via email

@frankiearzu
Copy link
Contributor

frankiearzu commented Mar 14, 2023

Great!!, now i know how the data is encoded.
Let me modify the scrip to show the GPS coordinates in the screen for the messages.
Will also check the code in EdgeTx to see if it is processing the messages correctly. I almost can guess that the problem is that is reading the numbers from left->right, and should be right->left.

@frankiearzu
Copy link
Contributor

I see why is not capuring the GPS_Status(0x17),, typo inside my script.. both menu options are capturing only message 16 (GPS_LOG)
Attached is new version of the screen. this will properly capture message 17 (GPS_Status).

That will give us the date and number of satelites.

DSM_Capture_Tel.zip

@lionelkeeping
Copy link
Author

lionelkeeping commented Mar 15, 2023 via email

@frankiearzu
Copy link
Contributor

Based on what i learned today.. created a version of the firware from 2.8.1 with the GPSFix.

Tested on the TX16 and my FrSky QX7.. at least everything works as before. but i really can't test if the code that i added to fix the GPS will work, since i don't have a sensor. Give it a try, but don't fly with it... just use it in the ground just to play safe.
You will need to discover sensors.
Added "Sats" (number of Sat) ,"Date"(really is only time in HHMMSS), "GAlt" (Altitude),"GSpd", "GPS" (Latitude, Longitude)

Edgetx-Zorro-2.8.1-GPSFix.bin

@lionelkeeping
Copy link
Author

lionelkeeping commented Mar 15, 2023 via email

@lionelkeeping
Copy link
Author

lionelkeeping commented Mar 15, 2023 via email

@lionelkeeping
Copy link
Author

lionelkeeping commented Mar 15, 2023 via email

@pfeerick
Copy link
Member

Github does not accept email attachments. You might want to consider a service such as https://wetransfer.com if you want to send large files.

@lionelkeeping
Copy link
Author

lionelkeeping commented Mar 16, 2023 via email

@frankiearzu
Copy link
Contributor

frankiearzu commented Mar 17, 2023

Lionel!
I think i got it working!!! Found a trick to put your capture data into my firmware code.
There was a big bug in some of the original code on how to process some BCD values. That's why we were getting crazy values.

New firmware here: (GPSFix4)
https://github.com/frankiearzu/DSMTools/tree/main/EdgeTx_Firmware

Sensors: GAlt, GPS (LAT/LOG), HDG, GSpd, Date (Only Time), Sats
Also have the Flight Mode comming from the SAFE/AS3X data.

The LAT/LON, need to validate the seconds. The RAW data comes: RAW data 28o 12' 7154", LON: -82 09' 8040"
Dont know what the secons 7154 means exactly.. Can seconds be greater than 60??

Approximate location on Google Maps
=> 28.211904534030246, -82.16285935418495
= 28 deg 12.71 min, -82 deg 9.77 min

screen-GPS
screen-FM

frankiearzu added a commit to frankiearzu/edgetx that referenced this issue Mar 17, 2023
* Fix GPS Telemetry problem.

* Added FlightMode for some RX   (AS3X and ALPHA6-BLADE)
frankiearzu added a commit to frankiearzu/edgetx that referenced this issue Mar 17, 2023
Fix small problems.
@lionelkeeping
Copy link
Author

Frankie, I can confirm your new firmware accurately provides the precise GPS position, both in DD MM.mmmm format and in DD MM SS.ss format dependent on the radio setting of NMEA or DMS. The GPS seems to be very accurate, showing a position within a few feet of the actual location, though altitude varies widely which seems to be normal for a GPS anyway. See attached screenshots of my Zorro telemetry screen and of the data screen provided from the TELEMETRY page of the Zorro. Thank you for your work on this!

screen-2023-03-19-120512
screen-2023-03-19-120638
screen-2023-03-19-122938
screen-2023-03-19-122940

@Neutral67fr
Copy link

I can confirm the issue is solved, I can now get the correct data from the SPMA95871 Spektrum GPS. There is a little offset in altitude but it's something quite common between different GPS units due to lower accuracy for altitude.
Its not visible in the screenshot but I also get a correct Sat count (13 to 16 at the moment).
Thanks Francisco for your valuable work!
screen-2023-03-20-213402

pfeerick added a commit that referenced this issue Mar 23, 2023
* #3290 Fix for GSP

* Fix GPS Telemetry problem.

* Added FlightMode for some RX   (AS3X and ALPHA6-BLADE)

* #3290

Fix small problems.

* Add adjustment for TimeZone

Add adjustment for TimeZone

* chore: Mostly formatting, unused code removal

---------

Co-authored-by: Peter Feerick <peter.feerick@gmail.com>
@pfeerick pfeerick removed the triage Bug report awaiting review / sorting label Mar 23, 2023
@pfeerick pfeerick added this to the 2.9 milestone Mar 23, 2023
@pfeerick pfeerick linked a pull request Mar 23, 2023 that will close this issue
@TEH-ArcGIS
Copy link

Frankie, thanks to you and lionelkeeping! I’ve bumped into a similar situation. I can capture GPS reading using a spektrum nx10 and a spektrum rx ar630. When I bind to the RadioMaster, it doesn’t pickup any GPS values. I have a skyid. I was on edgetx 2.10.2. I went back to edgetx 2.9.4 to see if that made a difference. It doesn’t…. Just no luck in getting gps values. Just not having luck trouble shooting this issue.

@frankiearzu
Copy link
Contributor

frankiearzu commented Jul 7, 2024

With the SkyId, it sends GPS data on the regular GPS telemetry data channel, and the User/DRONE-ID on a separate message (message 27xx, you probably will see some sensors with this names 2700, etc).

Are you geting telemetry for other sensors? the AR630 should give you gyro info as well as safe info (all the 05xx sensors for RAW). Sensors like FM, GyrX/Y/Z???

@TEH-ArcGIS
Copy link

TEH-ArcGIS commented Jul 8, 2024 via email

@qsiguy
Copy link

qsiguy commented Jul 29, 2024

Been a couple months since I used my SkyID but I have encountered the same issue. No longer getting GPS data from the SkyID. I assumed it was due to the recent Spektrum 3.x firmware update but based on the post above from 3 weeks ago it was apparently an issue prior to that.

@TEH-ArcGIS
Copy link

TEH-ArcGIS commented Jul 29, 2024 via email

@qsiguy
Copy link

qsiguy commented Jul 29, 2024

Sounds like we've attempted about the same things to narrow it down. My NX6 works with the SkyID as well. I reverted back to 2.9.4 no luck, then reverted back to 2.9.3 also with no luck. Only thing I cannot "undo" is the 1.1 firmware update to the SkyID. I wish I could get it back to 1.0 to test that as that is the only variable I cannot retry.

On the DSM Smart RX Lua "RemoteID" do your values jump around? Mine to now, they previously did not.

@TEH-ArcGIS
Copy link

TEH-ArcGIS commented Jul 29, 2024 via email

@frankiearzu
Copy link
Contributor

Looking into it.. don't have SKYID module, but what we can tell from a capture done by @qsiguy, is that the RX is not sending the original GPS data.. I guess they move it to another message. Probably lets open a new ticket to track this.. This ticket was closed long time ago.

@frankiearzu
Copy link
Contributor

Move the conversation to #5350 as a new bug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🪲 Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants