Commit Graph

43 Commits

Author SHA1 Message Date
Jordan Yates d97cc46bdd gnss: rename u-blox M10 driver to M8
The driver in tree is for u-blox M8 devices, not M10. The M10 series
devices (from Protocol Version 23.01) use a different, non backwards
compatible interface for configuring the modem behaviour.

Of the two boards tested in the original PR, the "VMU RT1170" is
explicitly listed as having a u-blox NEO-M8N modem, while I have
been unable to find any information online about the "FMURT6" board.

Leaving the naming as-is will cause problems when M10 drivers are
contributed.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-08-26 17:27:12 -04:00
Joakim Andersson 0efbbcb7fd drivers: gnss: Handle malloc returning NULL pointer
Handle malloc returning NULL pointer, set err and return from function.

Signed-off-by: Joakim Andersson <joerchan@gmail.com>
2024-08-02 03:29:18 -04:00
Joakim Andersson 76907ff399 drivers: gnss: Do not re-assign err from helper function
Do not re-assign err from helper function, this just causes loss of
information from the helper function.
Only possible err returned is -EINVAL, so not a functional change.

Signed-off-by: Joakim Andersson <joerchan@gmail.com>
2024-08-02 03:29:18 -04:00
Bjarki Arge Andreasen 279f241e2f drivers: gnss: update drivers to select reference frame
Update in-tree device drivers to depend on the reference frame
datums they support.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2024-07-31 10:07:19 +02:00
Bjarki Arge Andreasen b9fbc4f936 drivers: gnss: add choice for GNSS reference frame datum
Add choice symbol for reference frame datum from which GNSS will
produce navigation data. All in-tree device drivers use WGS84 by
default, for now, this is the only available option until support
for other datums are added.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2024-07-31 10:07:19 +02:00
Bjarki Arge Andreasen 372c7183ef modem: pipe: Add explicit timeout to sync APIs
The modem pipe APIs include synchronous calls to open/close,
which internally use a fixed timeout of 10 seconds. The timeout
should be configurable through the APIs, anywhere from K_NO_WAIT
to K_FOREVER.

This commit adds timeout parameters to the open/close APIs, and
updates in-tree usage of the open/close APIs to explicitly
provide the previously implicit timeout of 10 seconds.

Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
2024-07-29 14:14:42 +02:00
Jordan Yates 5f3ff52b6b gnss: gnss_u_blox_protocol: fix typos
Fix several typos in define names.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-07-29 14:12:53 +02:00
Andreas Klinger dda519d48c drivers: gnss: remove dangerous loop
When ubx_m10_ubx_cfg_rst is returning something negative there is a loop
in the code which in turn can easily turn into an endless loop if the
function is never returning something positive or zero.

Signed-off-by: Andreas Klinger <ak@it-klinger.de>
2024-07-27 15:17:52 +03:00
Andreas Klinger a1eb11bb59 drivers: gnss: remove sleep during init
It's not allowed to sleep during initialization of driver as called by
bg_thread_main --> z_sys_init_run_level(INIT_LEVEL_POST_KERNEL)
               --> do_device_init  -->  ubx_m10_init

There is no thread_base.timeout struct setup so far.

Signed-off-by: Andreas Klinger <ak@it-klinger.de>
2024-07-27 15:17:52 +03:00
Andreas Klinger 7c8033f8d8 drivers: gnss: cleanup function returning
Cleanup more returns and gotos as they are redundant.

Signed-off-by: Andreas Klinger <ak@it-klinger.de>
2024-07-27 15:17:52 +03:00
Andreas Klinger f89f2ae46c drivers: gnss: clean up labels
Clean up labels no longer needed.

Signed-off-by: Andreas Klinger <ak@it-klinger.de>
2024-07-27 15:17:52 +03:00
Andreas Klinger 8d8fe9d169 drivers: gnss: fix setting of baudrate
ubx_m10_init_pipe is calling modem_backend_uart_init which in turn is
memsetting the backend data structure and thus also overwrites the work
queue function pointer in it.

Remove call to ubx_m10_init_pipe as data structures are already set up.

Tested with u-blox NEO M9N.

Signed-off-by: Andreas Klinger <ak@it-klinger.de>
2024-07-27 15:17:52 +03:00
Andreas Klinger ac4878e9d0 drivers: gnss: gnss_u_blox_m10: fix compiler warning
Fix warning on implicit declaration of function 'malloc' when compiling
gnss_u_blox_m10.c.

Signed-off-by: Andreas Klinger <ak@it-klinger.de>
2024-07-01 09:14:12 +02:00
Pisit Sawangvonganan 9a0283d5e2 drivers: gnss: make `gnss_xxx_config` and `gnss_driver_api` as `const`
This change marks each instance of the `gnss_xxx_config` and
`gnss_driver_api` as `const`.

By using `const`, we ensure immutability, leading to usage of only
`.rodata` and a reduction in the `.data` area.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-06-12 12:47:34 -04:00
Bjarki Arge Andreasen 51bcc5d20d drivers: gnss: LCX6G use modem chat runtime API
Update the Quectel LCX6G device driver to use the modem chat
runtime API to modify the dynamic pair chat script.

This change makes the driver safer and more readible by
ensuring safe modification of the members of the modem chat
structures.

Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
2024-05-28 10:02:06 +02:00
Bjarki Arge Andreasen 3769648793 drivers: gnss: Add emulated GNSS device driver
The emulated GNSS driver behaves like a GNSS, implementing
device pm and the GNSS APIs, using only kernel features (
zephyr work queue and uptime) making it buildable on all
zephyr targets.

The purpose of this device driver is to tailor and validate
the gnss api test suite.

Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
2024-05-09 15:45:34 +02:00
Jeronimo Agullo 7ae9a16ca6 drivers: gnss: Air530z: Add new driver
Intial driver adding intial script to receive only GGA, RMC and GSV
NMEA messages, configuring fix rate, setting enabled system and adding
power management with the module on-off pin.

Signed-off-by: Jeronimo Agullo <jeronimoagullo97@gmail.com>
2024-05-06 22:50:30 +01:00
Bjarki Arge Andreasen 15fa7f79da drivers: gnss: gnss_publish: Use sem for locking
The gnss_publish incorrectly uses a spinlock for mutual
exclusion when publishing data and satellites. Update it to
use a binary semaphore.

Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
2024-05-02 22:44:19 +01:00
Bjarki Arge Andreasen 2ff1ed7804 drivers: gnss: gnss_lcx6g: replace spinlock with sem
Use semaphore instead of spinlock for mutual exclusion. The
spinlock is improperly used for mutual exclusion, leading to
timeouts and other unintended behavior as ISRs are disabled.

Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
2024-05-02 22:43:11 +01:00
Tomi Fontanilles b4c8d47536 drivers: gnss: nmea_generic: some fixes/improvements
- Configure a UART TX buffer; the backend would otherwise assert in
its configuration or (if the asserts are off) miserably fail when
trying to send anything to the GNSS modem.
- Fine tune the UART RX buffer size and make it depend on whether
satellite data is received.
- Remove unused k_spinlock.
- Make declaration of Kconfig items dependent on GNSS_NMEA_GENERIC
conditional.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2024-04-24 15:00:10 -04:00
Tomi Fontanilles 21efdc23c9 drivers: gnss: nmea_generic: implement basic power management
As of now only the resume action is supported, and doesn't perform
any power action on the GNSS modem.
It allows to initialize the GNSS driver later than it would otherwise
be.

Also, the driver now runs a modem-specific chat script on resumption.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2024-04-24 15:00:10 -04:00
Tomi Fontanilles a986905df5 modem: chat: implement helper defines/structs
Those helpers allow to define some typical kinds of chat matches and
scripts with more ease/less boilerplate.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2024-04-24 15:00:10 -04:00
Chris LaFlash 9c492f4a9b drivers: gnss: Use correct GGA Elevation field
Switching from using Geoid seperation to Elevation MSL field.

Signed-off-by: Chris LaFlash <chris-github@laflash.com>
2024-04-23 19:46:42 -04:00
Rob Newberry 3114ccf568 GNSS: Increase size of hdop
The valid range of hdop (horizontal diffusion of precision) goes
from 0-100000, but because we are using a uint16_t, we truncate
anything above UINT16_MAX.

This fix changes the size of the hdop member to a uint32_t, which
allows us to capture valid (but admittedly very poor) readings.

Signed-off-by: Rob Newberry <rob@zenomoto.com>
2024-04-09 11:05:38 +02:00
Mayank Mahajan 3d81167eaf ADD: GNSS Driver for U-BLOX M10 & Support for UBX Messages
MODEM_UBX: Adds Support for UBX Messages in Modem Subsystem.

GNSS API Supported: get_supported_systems, set_fix_rate, get_fix_rate,
	set_enabled_systems, get_enabled_systems, set_navigation_mode,
	get_navigation_mode.

Boards Tested: MIMXRT1062_FMURT6, VMU_RT1170.

Note: Partial support for U-BLOX Messages is provided as of now.

Signed-off-by: Sumit Batra <sumit.batra@nxp.com>
Signed-off-by: Mayank Mahajan <mayankmahajan.x@nxp.com>
2024-03-26 09:28:36 +00:00
Bjarki Arge Andreasen 98d95851c6 drivers: gnss: lcx7g: Add Kconfigs for configurable buffers
Added Kconfigs to define the size of:
- UART backend receive buffer
- UART backend transmit buffer
- Satellites array size

and increased the UART RX buffer size a default to 256 as 128
is just on the edge of to small at a baudrate of 115200.

Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
2024-01-29 10:58:58 +00:00
Bjarki Arge Andreasen 41240f9fb1 drivers: gnss: lcx7g: Close pipe on suspend
The pipe should be closed when suspended, both to save ressources
and to flush it. Without flushing the pipe, the driver may fail
to either resume or suspend the GNSS as the chat module starts
processing old data, which can contain acks to commands, breaking
the scripts.

Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
2024-01-29 10:58:58 +00:00
Bjarki Arge Andreasen 59b9a86f30 drivers: gnss: lcx7g: Refactor power management
The implementation of power management did not account for
being on a power domain when initializing, and handling being
powered on and off at runtime.

The GNSS requires time to start up, which it always does when
powered on, before accepting commands. It also requires time
after resuming and suspending before accepting commands.

This commit implements this timeout, and improves logging to
make the power management more transparent, and removes some
redundant parenthesis for better readability.

Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
2024-01-29 10:58:58 +00:00
Bjarki Arge Andreasen a9ffd91294 drivers: gnss: lcx6g: Remove left over from testing
The k_msleep() removed with this has no utility.

Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
2024-01-29 10:58:58 +00:00
Bjarki Arge Andreasen 27b0d4e3fe modem: chat: remove receive and transmit timeouts
Remove receive and transmit timeouts which are no
longer useful as the RECEIVE_READY and
TRANSMIT_IDLE events will be used to efficiently
manage timeouts between transmit/receive calls.

Then update the the in-tree drivers using the
modem_chat module to omit the process timeout
parameter.

Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
2024-01-25 11:22:42 +01:00
Pisit Sawangvonganan 78faf5eb8e drivers: gnss: quectel_lcx6g: fix compilation error when CONFIG_PM_DEVICE=y
Fixes a compilation error in quectel_lcx6g driver when CONFIG_PM_DEVICE=y.
Corrects the function call in quectel_lcx6g_suspend from
'modem_chat_run_script_run' to 'modem_chat_run_script'.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-01-22 14:08:58 +00:00
Bjarki Arge Andreasen 1bc8490c6c drivers: gnss: match: Change RMC/GGA sync from timeout to UTC
Change the synchronization of RMC and GGA NMEA messages from a
timeout to matching their UTC timestamps.

Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
2024-01-18 10:55:17 +01:00
Fabio Baltieri f9ab050306 drivers: gnss: move gnss_publish.h in include/
Move gnss_publish.h in include/ so that out of tree drivers and tests
can use it.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-11-29 14:30:40 +00:00
Fabio Baltieri 96b9bd4720 drivers: gnss: use absolute values for signed fractionals
Printing fractionals currently put the sign on integer values on the
fractional part, for example:

longitude : -6.-207483333

Run an extra abs to get rid of the sign there for latitude, longitude
and altitude, compute the sign separately so it works for numbers
between -1 and 0 as well.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-11-29 14:30:40 +00:00
Fabio Baltieri d14066b061 drivers: gnss: add a generic NMEA GNSS driver
Add a generic NMEA GNSS driver.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-11-28 15:33:28 +01:00
MD Peace 5fee1b17d5 drivers: gnss: Fix typo in __ASSERT statement
str is being checking the __ASSERT where nano should be being checked

Signed-off-by: MD Peace <michael@whgsolutions.team>
2023-11-15 08:46:37 +00:00
Bjarki Arge Andreasen b60eb1881b drivers: gnss: Add GNSS driver for Quectel LCX6G
This commit adds a GNSS driver for the Quectel LCX6G
series of GNSS modems (LC26G, LC76G, LC86G). It is
based on the modem subsystem, and the GNSS utilities
added in the two previous commits.

Signed-off-by: Bjarki Arge Andreasen <bjarkix123@gmail.com>
2023-10-30 11:43:19 -04:00
Bjarki Arge Andreasen 2b14e5d84a drivers: gnss: Add nmea0183 match utilities
This commit adds generic matches and handlers for the RMC,
GGA and GSV messages to be implemented as part of all
NMEA0183 based GNSS modems.

NMEA0183 based GNSS modems must place the
struct gnss_nmea0183_match_data struct as the first struct
in their data struct. Their data struct shall then be set
as the user_data for the modem_chat instance.

Lastly, the gnss_nmea0183_match callbacks must be included
in the unsolicited matches for the modem_chat instance.

The GNSS modems will initialize the NMEA0183 match instance
using gnss_nmea0183_match_init.

Signed-off-by: Bjarki Arge Andreasen <bjarkix123@gmail.com>
2023-10-30 11:43:19 -04:00
Bjarki Arge Andreasen d8bb7c87cf drivers: gnss: Add parsing utils for NMEA0183
This commit adds utilites to parse the RMC and GGA
NMEA0183 messages, which contain all data which shall be
published using the struct gnss_data.

It also adds a test suite for the added utilities.

Signed-off-by: Bjarki Arge Andreasen <bjarkix123@gmail.com>
2023-10-30 11:43:19 -04:00
Bjarki Arge Andreasen 4cfea4a520 drivers: gnss: Add GNSS parsing utilities
This commit adds parsing utilites for common string
representations of values contained in GNSS messages.

These utilites both parse and validate the integrity of
the data.

Unit tests are also added to validate the parsing
utilities.

Signed-off-by: Bjarki Arge Andreasen <bjarkix123@gmail.com>
2023-10-30 11:43:19 -04:00
Bjarki Arge Andreasen 03d2671ddd drivers: gnss: Add GNSS dump to log feature
This commit adds dumping of GNSS data and satellites to
the log if CONFIG_GNSS_DUMP_TO_LOG is selected

Signed-off-by: Bjarki Arge Andreasen <bjarkix123@gmail.com>
2023-10-30 11:43:19 -04:00
Bjarki Arge Andreasen 2a81c22489 drivers: gnss: Add gnss_dump library
This commit adds a library which dumps the contents of the
gnss structures gnss_info, navigation_data, gnss_time and
gnss_satellite as a string.

Signed-off-by: Bjarki Arge Andreasen <bjarkix123@gmail.com>
2023-10-30 11:43:19 -04:00
Bjarki Arge Andreasen 28f5f2d1ed drivers: Add GNSS API public header
This commit adds the public header for the GNSS API, along
with the initial GNSS Kconfig file and an entry in the
common linker file for registered GNSS data callbacks.

A very naive implementation of the GNSS data callback is
provided as well in drivers/gnss/gnss_publish.c

Signed-off-by: Bjarki Arge Andreasen <bjarkix123@gmail.com>
2023-10-30 11:43:19 -04:00