guild icon
Toit
#Error on ublox-gnss-driver - ver 1.1.1
Thread channel in help
diego.ar
diego.ar 05/20/2023 07:41 PM
hi guys, im trying to use GPS functionality on a toit program, the ESP32 board im using has a NEO-6M (ublox) chip...

Checking the packages list, i could find the ublox-gnss-driver.. after installing and trying to run sample code, i get the following error:

<pkg:ublox-gnss-driver>\driver.toit:58:15: error: Type mismatch. Expected 'Task'. Got 'Task'
runner
= task::
^~~~
Compilation failed.

Im running the code using the latest jag version...
Version: v1.9.22
SDK version: v2.0.0-alpha.83
Build date: 2023-05-19T15:01:27Z

Firmware updated accordingly


Looking forward to your comments, regards
bitphlipphar
bitphlipphar 05/20/2023 08:40 PM
Thanks for reporting this. Will take a look on Monday!
bitphlipphar
bitphlipphar 05/20/2023 08:41 PM
Which version of the ublox-gnss-driver package are you using?
bitphlipphar
bitphlipphar 05/20/2023 08:43 PM
I feel like it just might be us not releasing the package: https://github.com/toitware/ublox-gnss-driver/compare/v1.1.1...main.
bitphlipphar
bitphlipphar 05/21/2023 06:02 AM
@diego.ar Oh, I see the version in the post title now. Thanks. Just pushed v1.1.2 with the latest bits from the main branch. We check for these issues on every commit to the Toit SDK (https://github.com/toitlang/toit/blob/master/external/CMakeLists.txt), but if we forget to push a new release of a package it doesn't help much :🙂:
diego.ar
diego.ar 05/22/2023 03:46 AM
@bitphlipphar thank you for the response, i just updated the pkg to version 1.1.2 and its working properly, great to have this fix...
diego.ar
diego.ar 05/22/2023 03:51 AM
btw, i ask one more thing, since the ublox-gnss-driver package has a i2c.toit file sample, but on the board im testing the GPS i need to use spi

i tweaked the sample as follows, but the code is getting stucked at the driver.location --blocking lines.. am i wrong on anything??
thanks in advance


// Copyright (C) 2021 Toitware ApS. All rights reserved.
// Use of this source code is governed by a MIT-style license that can be found
// in the LICENSE file.

import gpio
import serial
import spi

import ublox_gnss

// SDA ::= gpio.Pin 12
// SCL ::= gpio.Pin 34

main:
spi := spi.Bus
--mosi=gpio.Pin 12 // MOSI
--miso=gpio.Pin 34 // MISO
--clock=gpio.Pin 5 // Clock

device := spi.device
//--cs=gpio.Pin 18
--frequency=100_000
//--address_bits=ublox_gnss.I2C_ADDRESS

driver := ublox_gnss.Driver
ublox_gnss.Reader device
ublox_gnss.Writer device

print "getting location"

driver.location --blocking
print "Took: $(driver.time_to_first_fix)"

while true:
location := driver.location --blocking
print "Location: $location ($(max location.horizontal_accuracy location.vertical_accuracy))"

driver.close
diego.ar
diego.ar 05/22/2023 03:51 AM
error stack..

**
Decoding by jag, device has version <2.0.0-alpha.83>
**
EXCEPTION error.
Connection closed
0: tcperror <sdk>/net/modules/tcp.toit:208:3
1: TcpSocket_.ensurestate <sdk>/net/modules/tcp.toit:75:14
2: TcpSocket.read <sdk>/net/modules/tcp.toit:156:16
3: BufferedReader.more <sdk>/reader.toit:82:22
4: BufferedReader.ensure
<sdk>/reader.toit:69:14
5: BufferedReader.can_ensure <sdk>/reader.toit:109:5
6: Connection.read_request <pkg:pkg-http>/connection.toit:138:20
7: Server.runconnection.<block> <pkg:pkg-http>/server.toit:115:30
8: Task_.withdeadline.<block> <sdk>/core/task.toit:203:16
9: Task_.withdeadline <sdk>/core/task.toit:197:3
10: with_timeout <sdk>/core/utils.toit:181:24
11: with_timeout <sdk>/core/utils.toit:164:12
12: Server.runconnection <pkg:pkg-http>/server.toit:114:7
13: Server.listen.<block>.<lambda>.<block>.<block> <pkg:pkg-http>/server.toit:82:26
14: catch.<block> <sdk>/core/exceptions.toit:124:10
15: catch <sdk>/core/exceptions.toit:122:1
16: catch <sdk>/core/exceptions.toit:97:10
17: Server.listen.<block>.<lambda>.<block> <pkg:pkg-http>/server.toit:81:18
18: Server.listen.<block>.<lambda> <pkg:pkg-http>/server.toit:78:38
19: Server.listen.<block> <pkg:pkg-http>/server.toit:98:37
20: Server.listen <pkg:pkg-http>/server.toit:54:3
21: serve_incoming_requests /home/runner/work/jaguar/jaguar/src/jaguar.toit:401:10
22: run.<block>.<lambda> /home/runner/work/jaguar/jaguar/src/jaguar.toit:199:10
23: Task.group.<lambda>.<block> <sdk>/core/task.toit:113:45
24: Task.group.<lambda> <sdk>/core/task.toit:110:26
**
bitphlipphar
bitphlipphar 05/22/2023 04:21 AM
I think that error is unrelated to your GNSS code, but if you're not getting any locations printed before or after the stack trace then clearly something isn't working out.
bitphlipphar
bitphlipphar 05/22/2023 04:23 AM
I will have to take a look at the driver to figure out if more tweaks are necessary for I2C -> SPI conversion.
diego.ar
diego.ar 05/22/2023 01:40 PM
@bitphlipphar im not getting up to now any locations printed, the message "getting location" does appear on the monitor screen
from the board documentation i can see
ESP32 RX - NEO-6M TX = 34
ESP32 TX - NEO-6M RX = 12
Max freq 10KHz
diego.ar
diego.ar 05/30/2023 02:17 PM
hey guys... @bitphlipphar @floitsch i need to move forward on this.. any news/comments?? anything i can do on my side to go on? i could try to get a GPS device that i can use it on a I2C basis.. thanks in advance
diego.arOPdiego.ar
hey guys... @bitphlipphar @floitsch i need to move forward on this.. any news/comments?? anything i can do on my side to go on? i could try to get a GPS device ...
floitsch
floitsch 05/30/2023 02:20 PM
Kasper has already left the office today. I hope he can have a look later today, but if not I will remind him tomorrow.
diego.ar
diego.ar 05/30/2023 02:24 PM
thank you @floitsch looking forward to this tomorrow, regards
bitphlipphar
bitphlipphar 05/31/2023 09:19 AM
Hi @diego.ar! It is a little bit hard to debug this without access to the right module, but maybe what we're lacking here is configuring the module to use SPI using a UBX message (UBX-CFG-PRT). I suggest adding some low-level logging in the ublox gnss driver, so we can see if we get any UBX messages over SPI.
floitsch
floitsch 05/31/2023 11:48 AM
Talked a bit with Kasper about this.
So it looks like the driver just doesn't get any response. This could have multiple reasons: wrong pins, wrong speed, wrong module, bad code ...
Do you have a link to the module you are using?
diego.ar
diego.ar 06/01/2023 08:24 PM
hey @bitphlipphar @floitsch great to read from you... im running the code on a TTGO T-BEAM board, to be more specific (im attaching an image with the pinout specification) the board is ESP32 based, and has a Lora SX1276 chip and for GPS it holds a ublox NEO-6M, on the board i can see it's a NEO-6M-0-001, let me know if this information is enough(edited)
diego.ar
diego.ar 06/01/2023 08:24 PM
diego.ar
diego.ar 06/01/2023 08:37 PM
on the toit code, im including ublox-gnss-driver v1.1.2... you can see the code on this same post, i just copied and adapted the i2.toit sample that is included on the ublox-gnss driver(edited)
floitsch
floitsch 06/01/2023 09:02 PM
@diego.ar to me this looks like the NEO-6M is connected with a serial port.
floitsch
floitsch 06/01/2023 09:03 PM
However. I'm also seeing an AXP192, and after a bit of googling, this looks like it's a power-management unit.
Looking further, it seems like lilygo's github example first configures the AXP before it communicates with the GPS module.
floitsch
floitsch 06/01/2023 09:04 PM
The AXP is also used in the m5stack-core2, so there exists already a package for it: https://pkg.toit.io/package/github.com%2Ftoitware%[email protected]
floitsch
floitsch 06/01/2023 09:05 PM
Unfortunately, the package isn't super intuitive (and I don't see a good way to make it much easier).
You have to know how to configure the chip. I think the best approach is to copy the correct values from the lilygo example.
axp.setPowerOutPut(AXP192_LDO2, AXP202_ON); axp.setPowerOutPut(AXP192_LDO3, AXP202_ON); axp.setPowerOutPut(AXP192_DCDC2, AXP202_ON); axp.setPowerOutPut(AXP192_EXTEN, AXP202_ON); axp.setPowerOutPut(AXP192_DCDC1, AXP202_ON);
floitsch
floitsch 06/01/2023 09:06 PM
We can definitely help you with that part.
diego.ar
diego.ar 06/01/2023 09:06 PM
ok @floitsch i'll give it a try...
floitsch
floitsch 06/01/2023 09:06 PM
@erikcorry wrote the package and used it for the m5stack-core2.
floitsch
floitsch 06/01/2023 09:06 PM
And I also had a look at some point.
floitsch
floitsch 06/01/2023 09:06 PM
So getting these 5 lines translated to Toit shouldn't be too hard.
floitsch
floitsch 06/01/2023 09:08 PM
Just for reference: here is the code for the m5stack core2: https://github.com/toitware/toit-m5stack-core2/blob/main/src/m5stack_core2.toit#L90
Contribute to toitware/toit-m5stack-core2 development by creating an account on GitHub.
diego.ar
diego.ar 06/01/2023 09:09 PM
ok... let me get both packages and see how to configure the values for the AXP
diego.ar
diego.ar 06/01/2023 09:09 PM
ill do this now..
👍1
floitsch
floitsch 06/01/2023 09:11 PM
The first line (axp.setPowerOutPut(AXP192_LDO2, AXP202_ON); is almost certainly equivalent to https://github.com/toitware/toit-m5stack-core2/blob/main/src/m5stack_core2.toit#L223
Contribute to toitware/toit-m5stack-core2 development by creating an account on GitHub.
floitsch
floitsch 06/01/2023 09:11 PM
And the next line the same 5 lines later.
diego.ar
diego.ar 06/01/2023 09:11 PM
sure...
floitsch
floitsch 06/01/2023 09:12 PM
actually. All the lines are just turning the power on. So it should be just the equivalent Toit functions.
diego.ar
diego.ar 06/01/2023 09:12 PM
ok..
floitsch
floitsch 06/01/2023 09:13 PM
I will make myself some food now (so maybe slow to respond), but I will check in a bit later again.
diego.ar
diego.ar 06/01/2023 09:13 PM
sure thank you very much for the support..
diego.ar
diego.ar 06/01/2023 09:14 PM
ill keep posting
Oliver M
Oliver M 06/01/2023 09:18 PM
I use GPS on the T-Beam. Quite straight forward. But I think you have to power it up first; i can have a look at my code if you need details.
diego.ar
diego.ar 06/01/2023 09:38 PM
hey @Oliver M ... sure great would be very useful(edited)
diego.ar
diego.ar 06/01/2023 09:39 PM
i just copied a i2c_scan.toit code that comes with the m5stack-core2 driver and im starting to test..(edited)
floitsch
floitsch 06/01/2023 10:15 PM
@Oliver M thanks for jumping in.
I'm off for today, but it looks like there is progress.
I will also look at the office if we have that board. (Unlikely, but you never know). And if not, I might order one.
diego.ar
diego.ar 06/01/2023 10:18 PM
// axp.setPowerOutPut(AXP192_LDO2, AXP202_ON);
// axp.setPowerOutPut(AXP192_LDO3, AXP202_ON);
// axp.setPowerOutPut(AXP192_DCDC2, AXP202_ON);
// axp.setPowerOutPut(AXP192_EXTEN, AXP202_ON);
// axp.setPowerOutPut(AXP192_DCDC1, AXP202_ON);

POWER_OUTPUT_LDO2
POWER_OUTPUT_LDO3
POWER_OUTPUT_DC_DC2
POWER_OUTPUT_EXTEN
POWER_OUTPUT_DC_DC1
diego.ar
diego.ar 06/01/2023 10:19 PM
@floitsch i have the constants out of the axp192 module.. i need to implement the set power output on now for the 5 lines... ill check on the @Oliver M code...
floitsch
floitsch 06/01/2023 10:20 PM
You should be able to import the package (similar to what the core2 code does). Basically install the package and then import it.
But obviously also works if you just copy the constants.
diego.ar
diego.ar 06/01/2023 10:21 PM
i installed the package already yes..
floitsch
floitsch 06/01/2023 10:21 PM
The core2 code has functions for turning the power on. You can copy it from there.
diego.ar
diego.ar 06/01/2023 10:21 PM
jag pkg install github.com/toitware/toit-axp192
floitsch
floitsch 06/01/2023 10:22 PM
Looks good
diego.ar
diego.ar 06/01/2023 10:22 PM
great ill check... regards @floitsch
diego.ar
diego.ar 06/01/2023 10:22 PM
have good night
👍1
diego.ar
diego.ar 06/02/2023 03:07 AM
the code is not working yet.. after adding some adjusts, i reached the following:

// Copyright (C) 2021 Toitware ApS. All rights reserved.
// Use of this source code is governed by a MIT-style license that can be found
// in the LICENSE file.

import gpio
import serial
import spi

import ublox_gnss
import axp192 show *

main:
spi := spi.Bus
--mosi=gpio.Pin 12 // MOSI
--miso=gpio.Pin 34 // MISO
--clock=gpio.Pin 5 // Clock

device := spi.device
--frequency=100_000
--address_bits=ublox_gnss.I2C_ADDRESS

driver := ublox_gnss.Driver
ublox_gnss.Reader device
ublox_gnss.Writer device

print "axp192 setup"

set_bits device POWER_OUTPUT_CONTROL_REGISTER POWER_OUTPUT_LDO2
set_bits device POWER_OUTPUT_CONTROL_REGISTER POWER_OUTPUT_LDO3
set_bits device POWER_OUTPUT_CONTROL_REGISTER POWER_OUTPUT_DC_DC2
set_bits device POWER_OUTPUT_CONTROL_REGISTER POWER_OUTPUT_EXTEN
set_bits device POWER_OUTPUT_CONTROL_REGISTER POWER_OUTPUT_DC_DC1

print "getting location"

driver.location --blocking
print "Took: $(driver.time_to_first_fix)"

while true:
location := driver.location --blocking
print "Location: $location ($(max location.horizontal_accuracy location.vertical_accuracy))"

driver.close
diego.ar
diego.ar 06/02/2023 03:08 AM
this the program output..

[jaguar] INFO: program 7b3102e4-7193-675a-9383-81043cb7ab78 started
axp192 setup
getting location

**
Decoding by jag, device has version <2.0.0-alpha.83>
**
EXCEPTION error.
Connection closed
0: tcperror <sdk>/net/modules/tcp.toit:208:3
1: TcpSocket_.ensurestate <sdk>/net/modules/tcp.toit:75:14
....
diego.ar
diego.ar 06/02/2023 03:11 AM
i may have an issue with the ttgo tbeam module, since it should turn a red led on when gps module works, but no red led is on now on the module... i have only a light blue led on that means the battery is charging this turns on when i plug the USB cable to the computer
bitphlipphar
bitphlipphar 06/02/2023 06:48 AM
@diego.ar You probably want to power up the module using the AXP192 before you instantiate the driver. The call to ublox_gnss.Driver will try to communicate with the module and tell it to start sending NAV packets if I am not mistaken.
bitphlipphar
bitphlipphar 06/02/2023 06:48 AM
print "axp192 setup" set_bits device POWER_OUTPUT_CONTROL_REGISTER POWER_OUTPUT_LDO2 set_bits device POWER_OUTPUT_CONTROL_REGISTER POWER_OUTPUT_LDO3 set_bits device POWER_OUTPUT_CONTROL_REGISTER POWER_OUTPUT_DC_DC2 set_bits device POWER_OUTPUT_CONTROL_REGISTER POWER_OUTPUT_EXTEN set_bits device POWER_OUTPUT_CONTROL_REGISTER POWER_OUTPUT_DC_DC1 print "creating driver" driver := ublox_gnss.Driver ublox_gnss.Reader device ublox_gnss.Writer device print "getting location" driver.location --blocking
floitsch
floitsch 06/02/2023 07:12 AM
@diego.ar The AXP192 is on an i2c bus, not spi.
This board uses three protocols/buses:
- i2c to communicate with the AXP192.
- spi to communicate with the LORA module.
- serial to communicate with the NEO GPS.

So you need to start by creating an i2c bus and device for the AXP192.
From memory:
import i2c import uart import gpio import ublox_gnss import axp192 show * main: i2c_bus := i2c.Bus --scl=(gpio.Pin 22) --sda=(gpio.Pin 21) axp_device := i2c_bus.device 0x34 set_bits axp_device POWER_OUPUT_CONTROL_REGISTER POWER_OUTPUT_LDO2 ... // Set the other power bits. axp_device.close i2c_bus.close // Communicate with the NEO over serial port. neo_uart := uart.Port --rx=(gpio.Pin 34) --tx=(gpio.Pin 12) --baud_rate=9600 neo := ublox_gnss.Driver neo_uart neo_uart print "getting location" neo.location --blocking print "Took: $(neo.time_to_first_fix)" while true: location := driver.location --blocking print "Location: $location" sleep --ms=500 neo.close
floitsch
floitsch 06/02/2023 07:13 AM
Again: this is from memory and untested. There might be some missing/wrong things, but it should give you the idea.
diego.ar
diego.ar 06/02/2023 01:35 PM
hi @bitphlipphar @floitsch thanks for the update ill give it a try later today after 7pm (GMT-3 my timezone)..
diego.ar
diego.ar 06/02/2023 11:50 PM
this the code status now..

import i2c
import uart
import gpio
import ublox_gnss
import axp192 show *

main:
i2c_bus := i2c.Bus
--scl=(gpio.Pin 22)
--sda=(gpio.Pin 21)
--frequency=400_000

axp_device := i2c_bus.device 0x34

set_bits axp_device POWER_OUTPUT_CONTROL_REGISTER POWER_OUTPUT_LDO2
set_bits axp_device POWER_OUTPUT_CONTROL_REGISTER POWER_OUTPUT_LDO3
set_bits axp_device POWER_OUTPUT_CONTROL_REGISTER POWER_OUTPUT_DC_DC2
set_bits axp_device POWER_OUTPUT_CONTROL_REGISTER POWER_OUTPUT_EXTEN
set_bits axp_device POWER_OUTPUT_CONTROL_REGISTER POWER_OUTPUT_DC_DC1

// Communicate with the NEO over serial port
neo_uart := uart.Port
--rx=(gpio.Pin 34)
--tx=(gpio.Pin 12)
--baud_rate=9600

neo := ublox_gnss.Driver neo_uart neo_uart

print "getting location"
neo.location --blocking
print "Took: $(neo.time_to_first_fix)"

while true:
location := neo.location --blocking
print "Location: $location"
sleep --ms=500

axp_device.close
i2c_bus.close
neo.close
diego.ar
diego.ar 06/02/2023 11:51 PM
this is not working yet..
diego.ar
diego.ar 06/02/2023 11:54 PM
i have been checking here https://github.com/Xinyuan-LilyGO/LilyGo-LoRa-Series/tree/master/examples/GPS/UBlox_BasicNMEARead where a basic NMEA read is available for arduino... i can see there are many settings that should be considered to setup the board, i will read this in detail and see what's missing, shouldn't be much more code just add the right configs... also i could not make the OLED screen work on this board (always coding on toit), the proper AXP192 config shall solve both situations (GPS and OLED).... thks(edited)
Oliver M
Oliver M 06/03/2023 10:51 AM
I’ll be back at my ESP tomorrow evening, will then be able to send you my code.
diego.ar
diego.ar 06/03/2023 03:43 PM
looking forward to this @Oliver M thks
diego.ar
diego.ar 06/03/2023 05:41 PM
in the meantime i keep going..
diego.ar
diego.ar 06/03/2023 05:41 PM
location = null
read = PGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.9930
$GPGSV,3,1,10,01,,,18,09,,,20,11,,,18,12,,,19
7B
$GPGSV,3,2,1
location = null
read = PGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.9930
$GPGSV,2,1,07,01,,,14,09,,,20,11,,,15,13,,,14
71
$GPGSV,2,2,0
location = null
read = PGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.9930
$GPGSV,2,1,05,01,,,11,09,,,17,14,,,09,16,,,21
79
$GPGSV,2,2,0
location = null
read = PGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.9930
$GPGSV,1,1,04,01,,,09,14,,,08,16,,,20,29,,,20
74
$GPGLL,,,,,,
location = null
read = PGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.9930
$GPGSV,1,1,03,01,,,08,16,,,18,29,,,20
74
$GPGLL,,,,,,V,N*64
diego.ar
diego.ar 06/03/2023 05:41 PM
import i2c
import uart
import gpio
import ublox_gnss
import axp192 show *

main:
i2c_bus := i2c.Bus
--scl=(gpio.Pin 22)
--sda=(gpio.Pin 21)
--frequency=400_000

axp_device := i2c_bus.device 0x34

set_bits axp_device POWER_OUTPUT_CONTROL_REGISTER POWER_OUTPUT_LDO2
set_bits axp_device POWER_OUTPUT_CONTROL_REGISTER POWER_OUTPUT_LDO3
set_bits axp_device POWER_OUTPUT_CONTROL_REGISTER POWER_OUTPUT_DC_DC2
set_bits axp_device POWER_OUTPUT_CONTROL_REGISTER POWER_OUTPUT_EXTEN
set_bits axp_device POWER_OUTPUT_CONTROL_REGISTER POWER_OUTPUT_DC_DC1

// Communicate with the NEO over serial port
neo_uart := uart.Port
--rx=(gpio.Pin 34)
--tx=(gpio.Pin 12)
--baud_rate=9600
--data_bits=8
--parity=uart.Port.PARITY_DISABLED
--stop_bits=uart.Port.STOP_BITS_1

neo := ublox_gnss.Driver neo_uart neo_uart

sleep --ms=1500

print neo.location

r/string := neo_uart.read.to_string_non_throwing
l := neo.location

while true:
r = neo_uart.read.to_string_non_throwing
print "read = " + r

l = neo.location
print "location = $l"
sleep --ms=500


axp_device.close
i2c_bus.close
neo.close
diego.ar
diego.ar 06/03/2023 05:42 PM
the uart read is throwing data, the problem seems to be with the gnss driver
bitphlipphar
bitphlipphar 06/03/2023 08:14 PM
Looks like you are getting NMEA-encoded readings over the UART? The driver tries to read UBX packets. Maybe the NEO needs to be configured as per my previous message?
diego.ar
diego.ar 06/04/2023 12:29 AM
yes, the reading is getting NMEA-encoded messages. Ok i understand what the gnss driver expects, so according to what i can see on ublox PDF, i should compose a CFG-PRT to configure outProtoMask to force UBX format messages.. the sequence starts with 0xB5 0x62 0x06 0x00 .. as i can see on the doc... ill do some testing, thks(edited)
diego.ar
diego.ar 06/06/2023 04:45 AM
hey guys, i could configure the ublox and i see only UBX messages now when reading from uart.. nevertheless the driver.location --blocking is no yet responding.. any clue? thks...

[jaguar] INFO: program 61a53f34-1ff3-c5a3-2fbb-64c01bdf2727 started
configure ublox
ublox response - Length = 20
#[0xb5, 0x62, 0x05, 0x01, 0x02, 0x00, 0x06, 0x01, 0x0f, 0x38, 0xb5, 0x62, 0x05, 0x00, 0x02, 0x00, 0x06, 0x01, 0x0e, 0x33]
Location
null
UBX INFO - Length = 24
#[0xb5, 0x62, 0x01, 0x03, 0x10, 0x00, 0x00, 0x47, 0x44, 0x0b, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcb, 0xdd]
#[0x65, 0x00, 0x03, 0xae]
Location
null
UBX INFO - Length = 24
#[0xb5, 0x62, 0x01, 0x03, 0x10, 0x00, 0xd0, 0x4e, 0x44, 0x0b, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9b, 0xe5]
#[0x65, 0x00, 0xb2, 0x6f]
Location
null
UBX INFO - Length = 24
#[0xb5, 0x62, 0x01, 0x03, 0x10, 0x00, 0xa0, 0x56, 0x44, 0x0b, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6b, 0xed]
#[0x65, 0x00, 0x62, 0x3f]
Location
null
(edited)
bitphlipphar
bitphlipphar 06/06/2023 04:47 AM
Can you share your setup code? I'm curious to see where you configure using UBX CFG-PRT.
diego.ar
diego.ar 06/06/2023 04:47 AM
sure...
bitphlipphar
bitphlipphar 06/06/2023 04:47 AM
It feels like you're making good progress!
bitphlipphar
bitphlipphar 06/06/2023 04:47 AM
I hope we can get the locations through soon :🙂:
diego.ar
diego.ar 06/06/2023 04:48 AM
yes indeed.. i spent many hours over the code... had to check the fletcher algorithm on a spreadsheet to be sure i was calculating right the checksum...
diego.ar
diego.ar 06/06/2023 04:50 AM
diego.ar
diego.ar 06/06/2023 04:51 AM
also... thanks for all the support.. couldnt make it without your help!
diego.ar
diego.ar 06/06/2023 04:51 AM
sorry is a protoype.. i need to add comments, etc
bitphlipphar
bitphlipphar 06/06/2023 04:53 AM
Of course. I wonder if https://github.com/toitware/ubx-message/blob/main/src/ubx_message.toit could be useful for you?
Contribute to toitware/ubx-message development by creating an account on GitHub.
bitphlipphar
bitphlipphar 06/06/2023 04:53 AM
You'll probably need to extend the Message class to add a CfgPrt specialization.
bitphlipphar
bitphlipphar 06/06/2023 04:54 AM
But at least it might give you some help with the checksums, etc.
diego.ar
diego.ar 06/06/2023 04:55 AM
sure great, thks @bitphlipphar .. late here ill try tomorrow and let you know
bitphlipphar
bitphlipphar 06/06/2023 04:56 AM
I'll take a look at your code in a bit and see if anything pops out. You don't really need to use the ubx_message package, but it might be more convenient.(edited)
diego.ar
diego.ar 06/06/2023 04:56 AM
ok great!
bitphlipphar
bitphlipphar 06/06/2023 07:22 AM
So overall, we need to get to a point where there is only one reader/writer on the UART at the same time. As far as I can tell, the driver will try to configure, read, and write, so your loop with the call to neo_uart.read is likely to conflict with this. The driver already has a loop that tries to read from the UART: https://github.com/toitware/ublox-gnss-driver/blob/main/src/driver.toit#L60. It might be better to try to add a bit of debugging logging where the UBX message has been read: https://github.com/toitware/ublox-gnss-driver/blob/main/src/driver.toit#L162.
Contribute to toitware/ublox-gnss-driver development by creating an account on GitHub.
bitphlipphar
bitphlipphar 06/06/2023 07:28 AM
You can try to change it to something like this:
e := catch: message := ubx_message.Message.from_reader reader_ print "Received message = $message" return message
diego.arOPdiego.ar
looking forward to this @Oliver M thks
Oliver M
Oliver M 06/06/2023 05:49 PM
Sorry, am only now back; do you still need this, or have you got it running yet?
diego.ar
diego.ar 06/06/2023 11:33 PM
hey @Oliver M no problem at all, if you post your code it will sure be useful.. thks
diego.ar
diego.ar 06/07/2023 12:03 AM
hey @bitphlipphar ... i added the lines you suggested, here is the output im getting

[jaguar] INFO: program f31ea098-4970-fa3a-07a1-9213a48cf581 started
configure ublox
time to first fix: 0s
signal_quality: 0.0
satellites_in_view: 0
known_satellites: 0
Location 1: null
Received message = UBX-NAV-STATUS
Received message = UBX-ACK-0x01
Received message = UBX-ACK-0x00
Received message = UBX-ACK-0x00
Received message = UBX-NAV-STATUS
Received message = UBX-NAV-STATUS
Received message = UBX-NAV-STATUS
Location 2: null
Received message = UBX-NAV-STATUS
Received message = UBX-NAV-STATUS
Received message = UBX-NAV-STATUS
Location 3: null
Received message = UBX-NAV-STATUS
Received message = UBX-NAV-STATUS
Received message = UBX-NAV-STATUS
Location 4: null
Received message = UBX-NAV-STATUS
Received message = UBX-NAV-STATUS
Received message = UBX-NAV-STATUS
diego.ar
diego.ar 06/07/2023 12:05 AM
i added a print of the diagnostics object time to first fix, etc.. the location is getting null
the message := ubx_message.Message.fromreader reader is getting the right UBX-NAV-STATUS message
diego.ar
diego.ar 06/07/2023 12:08 AM
also if i add a --blocking to the .location method the code waits there.. i presume the monitor.Latch is failing at https://github.com/toitware/ublox-gnss-driver/blob/main/src/driver.toit#L51
diego.ar
diego.ar 06/07/2023 12:10 AM
diego.ar
diego.ar 06/07/2023 12:27 AM
oh... i realize the problem is im not getting UBX-NAV-PVT messages.. just UBX-NAV-STATUS... im checking ublox documentation
bitphlipphar
bitphlipphar 06/07/2023 03:34 AM
It might be useful to see if you can get some signal strength/quality numbers out. Not sure what NAV-STATUS contains. I remember we once had huge issues getting a fix because of antenna issues.
diego.ar
diego.ar 06/07/2023 04:27 AM
ok thks @bitphlipphar ill try to get the signal strength/quality numbers, perhaps it's an antenna issue (im indoor)
i can see here https://portal.u-blox.com/s/question/0D52p00008HKDqxCAH/neo-6m-issue-with-navpvt-not-acknowledged that UBX-NAV-PVT is not supported by the u-Blox 6 Protocol Specification

i think...
- may be use NAV-POSLLH, if this the case ill have to configure the polling rate (CFG-MSG)
- switch to NMEA and just retrieve the lat/long positions from there

ill keep doing
(edited)
bitphlipphar
bitphlipphar 06/07/2023 04:29 AM
I think you're getting really close!
diego.ar
diego.ar 06/07/2023 04:31 AM
i hope so :😅:
bitphlipphar
bitphlipphar 06/07/2023 04:52 AM
I took a quick look and I think it should be relatively straightforward to ask for NAV-POSLLH packets every second. You're right that we just wait (forever) on the latch operation, if the location is never set because you don't get any NAV-PVT packets.
bitphlipphar
bitphlipphar 06/07/2023 04:53 AM
You're not getting any NAV-SAT packets either, right?
diego.ar
diego.ar 06/07/2023 02:05 PM
ok great @bitphlipphar.. no, im not getting NAV-SAT messages either; it seems NAV-PVT is supported starting on ublox 7 and NAV-SAT on ublox 8, NAV-POSLLH should be a good way to go
diego.ar
diego.ar 06/08/2023 03:19 AM
almost there... NAV-POSLLH configured properly, added a class NavPosLLH extends Message at ubs_message.toit
need to parse the payload as expected i think and it should work

configure ublox
Received message = UBX-ACK-0x01
Received message = UBX-ACK-0x01
Received message = UBX-ACK-0x00
Received message = UBX-ACK-0x00
Received message = UBX-NAV-STATUS
Received message = UBX-NAV-POSLLH
Received message = UBX-NAV-STATUS
Received message = UBX-NAV-POSLLH
Received message = UBX-NAV-STATUS
Received message = UBX-NAV-POSLLH
Received message = UBX-NAV-STATUS
🎉1
bitphlipphar
bitphlipphar 06/08/2023 03:22 AM
:💥:
diego.ar
diego.ar 06/09/2023 02:57 AM
hey.. up and running :😀: !
NAV-POSLLH message is parsing ok, also outdoor solved signal issues..

[jaguar] INFO: program 4d45da00-6e1d-c71e-7561-1fb94096dafd started
configure ublox
Location 1: null
Location 2: 34.5........S, 58.4.........W
Location 3: 34.5........S, 58.4.........W
Location 4: 34.5........S, 58.4.........W
....

one comment/question, on the NAV-PVT message UTC time and date is available on the payload, NAV-POSLLH does not hold this information only a itow field (GPS millisecond time of week)... i forced a Time.now instead on the GnssLocation, as stated below:

process_navposllh message/ubxmessage.NavPosLLH:
location
= GnssLocation
Location message.lat / COORDINATE_FACTOR message.lon / COORDINATE_FACTOR
message.height_msl.to_float / METER_TO_MILLIMETER
Time.now
message.horizontal_acc.to_float / METER_TO_MILLIMETER
message.vertical_acc.to_float / METER_TOMILLIMETER
waiters := waiters

waiters = []
waiters.do: it.set location


this is not accurate.. any suggestions? i see there is a different UBX message NAV-TIMEUTC that could be used... thank you
bitphlipphar
bitphlipphar 06/09/2023 07:54 AM
I think you need to combine NAV-TIMEUTC and the time-of-week timing in the NAV-POSLLH for this to be accurate. So maybe you should poll for NAV-TIMEUTC first and store that. I think it contains the time-of-week too, so you can compute the beginning of the week time that you can add to all subsequent time-of-week timestamps that arrive in NAV-POSLLH packets. You'll need to keep track of the last time-of-week value received to see when it wraps around (the new value is smaller than the previously received value) and at that point you should increase the beginning of the week time by a week. Pretty handwavy :🙂:(edited)
👍1
floitsch
floitsch 06/22/2023 06:41 AM
@diego.ar We got a TTGO T-BEAM delivered yesterday evening.
If you still need help let us know, and I will try to play with it.
(edited)
diego.ar
diego.ar 07/10/2023 07:22 PM
hello @floitsch thanks for your message, sorry for the late reply i just get it
i have a couple of ttgo tbeam boards up and running, oled, gps, lora and also a bme280 device, all toit based..
something that could be useul is a library to connect to lorawan, if any of this is available pls let me know
regards
🤩1
diego.arOPdiego.ar
hello @floitsch thanks for your message, sorry for the late reply i just get it i have a couple of ttgo tbeam boards up and running, oled, gps, lora and also a bme280 d...
floitsch
floitsch 07/10/2023 07:23 PM
Nice.
Great to hear.
I think the biggest missing package is Lora. If you have time to write one that would be great.
I'm offering to review it.
diego.ar
diego.ar 07/10/2023 07:30 PM
great sure.. let me share with you the code as i have it right now (lora sender and lora receiver), i made a small tweak on the RFM95 based code you sent, to adapt the bus to the ttgo tbeam
diego.ar
diego.ar 07/10/2023 07:31 PM
building a lora package is a nice challenge, also add lorawan features i think will be nice
floitsch
floitsch 07/10/2023 07:31 PM
Hopefully we can integrate the rfm changes too.
diego.ar
diego.ar 07/10/2023 07:31 PM
sure
diego.ar
diego.ar 07/10/2023 07:32 PM
diego.arOPdiego.ar
building a lora package is a nice challenge, also add lorawan features i think will be nice
floitsch
floitsch 07/10/2023 07:32 PM
Hopefully it sounds more daunting than it actually is :🙂:
And I will obviously try to help.

And saying that already now: if it gets too much don't hesitate to abandon it. It should be fun to do :🙂:
diego.ar
diego.ar 07/10/2023 07:32 PM
the code is really basic now... just used to test
floitsch
floitsch 07/10/2023 07:33 PM
Will have a look. Probably tomorrow.
diego.ar
diego.ar 07/10/2023 07:34 PM
sure no problem.. just let me know
let me do some research on lorawan also, to evaluate the best way to add these features to the code
👍1
120 messages in total