Not able to get values other than UTC from gGPS

gps
dgps
go

#1

I’m in the process of writing code to interface to the dGPS device as part of the ev3go project which provides Go language interfaces to ev3dev platforms including the BrickPi.

I have managed to get data from the device, but so far I am only being returned the UTC value, no matter what command I send. The code I have is not yet committed to the main branch, but lives here while I’m working on it.

The main code for interacting with the I²C is here

func (d *GPS) tx(request byte) ([]byte, error) {
	time.Sleep(200 * time.Millisecond)
	c := dGPS_CommandLookup[request]
	d.send[0] = c.sendSize
	d.send[2] = request
	for i := range &d.recv {
		d.recv[i] = 0
	}
	err := d.dev.Tx(dGPS_I2C_addr, d.send[:c.sendSize], d.recv[:c.recvSize])
	if err != nil {
		return nil, err
	}
	return d.recv[:c.recvSize], nil
}

where the request parameter is the I²C command (note that the sent message is pre-prepared with 3 in byte 1 as per the diagram on the manual page).

This is example output from a test program:

$ ./gps -port in3
GPS-X response: [8 67 99]
satellite link ok=false
satellites in view: 82044
satellite HDOP=82044
satellite time=2017-09-28 08:20:44 +0000 UTC
82044° 82044° 82044m 320cm/s 1°
82047m 1° 1°

Below is a complete log of the I²C transactions of a run of this program.

Can someone suggest why I am only see the UTC values being returned?

Also, as an aside, what is the meaning of the 3 bytes returned when an Extended Firmware request is made?

robot@ev3dev:~$ ./gps -port in3
Tx
	before: [{Addr:3 Flags:write Length:4 Buf:[4 3 13 1]} {Addr:3 Flags:read Length:3 Buf:[0 0 0]}]
	after:  [{Addr:3 Flags:write Length:4 Buf:[4 3 13 1]} {Addr:3 Flags:read Length:3 Buf:[8 67 99]}]
GPS-X response: [8 67 99]
Tx
	before: [{Addr:3 Flags:write Length:3 Buf:[3 3 1]} {Addr:3 Flags:read Length:1 Buf:[0]}]
	after:  [{Addr:3 Flags:write Length:3 Buf:[3 3 1]} {Addr:3 Flags:read Length:1 Buf:[0]}]
satellite link ok=false
Tx
	before: [{Addr:3 Flags:write Length:3 Buf:[3 3 16]} {Addr:3 Flags:read Length:4 Buf:[0 0 0 0]}]
	after:  [{Addr:3 Flags:write Length:3 Buf:[3 3 16]} {Addr:3 Flags:read Length:4 Buf:[0 3 103 176]}]
satellites in view: 223152
Tx
	before: [{Addr:3 Flags:write Length:3 Buf:[3 3 15]} {Addr:3 Flags:read Length:4 Buf:[0 0 0 0]}]
	after:  [{Addr:3 Flags:write Length:3 Buf:[3 3 15]} {Addr:3 Flags:read Length:4 Buf:[0 3 103 177]}]
satellite HDOP=223153
Tx
	before: [{Addr:3 Flags:write Length:3 Buf:[3 3 0]} {Addr:3 Flags:read Length:4 Buf:[0 0 0 0]}]
	after:  [{Addr:3 Flags:write Length:3 Buf:[3 3 0]} {Addr:3 Flags:read Length:4 Buf:[0 3 103 178]}]
satellite time=2017-09-28 22:31:54 +0000 UTC
Tx
	before: [{Addr:3 Flags:write Length:3 Buf:[3 3 2]} {Addr:3 Flags:read Length:4 Buf:[0 0 0 0]}]
	after:  [{Addr:3 Flags:write Length:3 Buf:[3 3 2]} {Addr:3 Flags:read Length:4 Buf:[0 3 103 179]}]
Tx
	before: [{Addr:3 Flags:write Length:3 Buf:[3 3 4]} {Addr:3 Flags:read Length:4 Buf:[0 0 0 0]}]
	after:  [{Addr:3 Flags:write Length:3 Buf:[3 3 4]} {Addr:3 Flags:read Length:4 Buf:[0 3 103 180]}]
Tx
	before: [{Addr:3 Flags:write Length:3 Buf:[3 3 14]} {Addr:3 Flags:read Length:4 Buf:[0 0 0 0]}]
	after:  [{Addr:3 Flags:write Length:3 Buf:[3 3 14]} {Addr:3 Flags:read Length:4 Buf:[0 3 103 181]}]
Tx
	before: [{Addr:3 Flags:write Length:3 Buf:[3 3 6]} {Addr:3 Flags:read Length:3 Buf:[0 0 0]}]
	after:  [{Addr:3 Flags:write Length:3 Buf:[3 3 6]} {Addr:3 Flags:read Length:3 Buf:[0 3 103]}]
Tx
	before: [{Addr:3 Flags:write Length:3 Buf:[3 3 7]} {Addr:3 Flags:read Length:2 Buf:[0 0]}]
	after:  [{Addr:3 Flags:write Length:3 Buf:[3 3 7]} {Addr:3 Flags:read Length:2 Buf:[0 3]}]
223155° 223156° 223157m 871cm/s 3°
Tx
	before: [{Addr:3 Flags:write Length:7 Buf:[7 3 11 0 0 0 0]}]
	after:  [{Addr:3 Flags:write Length:7 Buf:[7 3 11 0 0 0 0]}]
Tx
	before: [{Addr:3 Flags:write Length:7 Buf:[7 3 12 0 0 0 0]}]
	after:  [{Addr:3 Flags:write Length:7 Buf:[7 3 12 0 0 0 0]}]
Tx
	before: [{Addr:3 Flags:write Length:3 Buf:[3 3 8]} {Addr:3 Flags:read Length:4 Buf:[0 0 0 0]}]
	after:  [{Addr:3 Flags:write Length:3 Buf:[3 3 8]} {Addr:3 Flags:read Length:4 Buf:[0 3 103 226]}]
Tx
	before: [{Addr:3 Flags:write Length:3 Buf:[3 3 9]} {Addr:3 Flags:read Length:2 Buf:[0 0]}]
	after:  [{Addr:3 Flags:write Length:3 Buf:[3 3 9]} {Addr:3 Flags:read Length:2 Buf:[0 3]}]
Tx
	before: [{Addr:3 Flags:write Length:3 Buf:[3 3 10]} {Addr:3 Flags:read Length:2 Buf:[0 0]}]
	after:  [{Addr:3 Flags:write Length:3 Buf:[3 3 10]} {Addr:3 Flags:read Length:2 Buf:[0 3]}]
223202m 3° 3°

#2

I have resolved this. The problem was due to a misunderstanding of the documentation, I was sending the first 2 bytes of the wire protocol as part of the message, hence doubling some bytes and causing the default behaviour, which is to return UTC.


#3

Hi @dan-kortschak,

I see and I’m glad the issue is now solved.
With this said, I’ll leave this thread open in case there are other issues.

Thank you!


#4

Sure. It’s worth leaving around since others may find similar problems; I think the documentation on that page could be improved a fair bit.