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>
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>
Update in-tree device drivers to depend on the reference frame
datums they support.
Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
- 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>