Open RomanTheLegend opened 1 year ago
Found it!
Class props take 10 bytes, not 8 thus Class ID gets overwritten.
Easy fix:
unsigned char offsetClassProperties = 10;
It fixed checksum issue, but now data makes no sense - like weird year on incorrect Lat/Lon
Probably another offset somewhere
unsigned char offsetClassProperties = 12;
Because 2 bytes for HeaderClass is needed for proper offset in memory mapping
Now everything looks good
Hello @RomanTheLegend , since the NavPvt was tested with u-blox, it could be that the module you have has a different offset – what GPS module you are using, and what protocol document you are referring to in the first message?
According to UBlox documents:
What I've noticed in reality that 2 bytes of class ID are not taken into account when
UbxGps.h
calculates checksum, thus any NAV-PVT message is never considered validFor example, this packet (without 2 checksum bytes at the end):
The valid checksum would be
CK_A = 0xD9
andCK_B = 0x71
Meanwhile the library expects
CK_A = 0xC0
andCK_B = 0x16
And fails because it gotCK_A = 0x11
If you exclude 2 bytes for class (
[0x01,0x07]
) then calculated checksum matches i.e. a checksum forwould indeed be
CK_A = 0xC0
andCK_B = 0x16
Basically, checksum is calculated for packet size 4 bytes shorter than it actually is (2 bytes for Class ID and 2 bytes for packet size field which is in Int16 Little Endian format -
[0x54,0x00]
)I need a help with fixing this code because without UART debugger playing with byte offsets by printing strings to serial is a nightmare :)