|
| 1 | +======= |
| 2 | +L86-XXX |
| 3 | +======= |
| 4 | + |
| 5 | +.. tags:: experimental |
| 6 | + |
| 7 | +This driver provides support for the L86-XXX family of GNSS modules by |
| 8 | +Quectel via the :doc:`uorb </components/drivers/special/sensors/sensors_uorb>` interface. |
| 9 | +Functionality for this driver was tested using the Quectel L86-M33. |
| 10 | + |
| 11 | +.. warning:: |
| 12 | + This driver only contains preliminary support for a handful of proprietary |
| 13 | + 'PMTK' commands There is no support for the entire suite of commands yet. |
| 14 | + This driver also does not use the standard uORD GNSS upper half driver and |
| 15 | + should eventually be modified such that it does. CONSIDER THIS DRIVER EXPERIMENTAL. |
| 16 | + |
| 17 | +Application Programming Interface |
| 18 | +================================= |
| 19 | + |
| 20 | +To register the device for use, you will need to enable the standard upper half |
| 21 | +serial drivers (``CONFIG_STANDARD_SERIAL``), since the L86-XXX driver requires |
| 22 | +the path to the UART interface the module is connected to. You will also need to |
| 23 | +ensure that the baud rate of the UART interface is set to 9600, which is the default |
| 24 | +baud rate of the L86-XXX series of GNSS modules. |
| 25 | + |
| 26 | +The driver supports changing the default baud rate and update rate of the GNSS module. |
| 27 | +As a result, you will also need to enable serial TERMIOS support (``CONFIG_SERIAL_TERMIOS``). |
| 28 | +The baud rate and update rate of the GNSS module can be configured using the ``L86_XXX_BAUD`` and ``L86_XXX_FIX_INT`` options respectively. |
| 29 | +Note that a faster update rate will require a higher baud rate to support it and the supported baud rates for the L86-XXX series of GNSS modules are: |
| 30 | +* 4800 |
| 31 | +* 9600 |
| 32 | +* 14400 |
| 33 | +* 19200 |
| 34 | +* 38400 |
| 35 | +* 57600 |
| 36 | +* 115200 |
| 37 | +The baud rate and update rates of the module are changed at registration time. |
| 38 | + |
| 39 | +.. code-block:: c |
| 40 | +
|
| 41 | + #if defined(CONFIG_SENSORS_L86_XXX) |
| 42 | + #include <nuttx/sensors/l86xxx.h> |
| 43 | + |
| 44 | + /* Register L86-M33 on USART3 */ |
| 45 | +
|
| 46 | + ret = l86xxx_register("/dev/l86m33", "/dev/ttyS2", 0); |
| 47 | + if (ret < 0) { |
| 48 | + syslog(LOG_ERR, "Failed to register L86-M33: %d\n", ret); |
| 49 | + } |
| 50 | + #endif |
| 51 | +
|
| 52 | +Once the driver is registered, it starts a thread that continuously reads raw output from the specified UART device and |
| 53 | +parses the output according to `NMEA <https://en.wikipedia.org/wiki/NMEA_0183>`_ standards using the |
| 54 | +`minmea <https://github.com/kosma/minmea>`_ library included in NuttX. The driver populates the ``sensor_gnss`` struct |
| 55 | +and pushes it to the appropriate event once all NMEA messages in its sequence have been read. |
| 56 | + |
| 57 | + |
| 58 | +**uORB commands** |
| 59 | +----------------- |
| 60 | +The driver implements the ``orb_activate``, ``orb_set_interval`` and, ``orb_ioctl`` operations to interact with the device. |
| 61 | +The latter is used to send proprietary 'PMTK' commands which are documented further below. |
| 62 | + |
| 63 | +**Activate** |
| 64 | + |
| 65 | +There are 4 modes that the L86-XXX GNSS modules can be in. Those are "Full On Mode", "Standby Mode", "Backup Mode", "Periodic Mode" and, "AlwaysLocateTM Mode". |
| 66 | +Calling ``orb_activate`` with ``enable`` set to false will enter the module into "Standby Mode". |
| 67 | +In "Standby Mode", the module doesn't output any NMEA messages but the internal core and I/O power domain are still active. |
| 68 | + |
| 69 | +The module can be re-enabled by calling ``orb_activate`` with ``enable`` set to true, which will hot start the module OR by |
| 70 | +sending any 'PMTK' command. |
| 71 | + |
| 72 | +**Set interval** |
| 73 | + |
| 74 | +The L86-XXX GNSS modules support interval rates from 1Hz to 10Hz (100ms - 10000ms). When using ``orb_set_interval``, be aware that |
| 75 | +increasing the interval of the module may also require and increase in baud rate. An example of how this is performed can be found in |
| 76 | +source code of this driver in the register function. |
| 77 | + |
| 78 | +Any interval rate outside of the supported range will result in a failed call to this function. |
| 79 | + |
| 80 | +**Control** |
| 81 | + |
| 82 | +The ``orb_ioctl`` interface allows one to send proprietary 'PMTK' commands to the L86-XXX GNSS module. It effectively works |
| 83 | +as a wrapper for the command framework outlined by Quectel. The return value of calls to ``orb_ioctl`` follow this pattern: |
| 84 | + |
| 85 | +* -EINVAL - Invalid packet |
| 86 | +* -ENOSYS - Unsupported packet type |
| 87 | +* -EIO - Valid packet, but action failed |
| 88 | +* 0 - Valid packet, action succeeded |
| 89 | +* Other - Command failed during writing |
| 90 | + |
| 91 | +The supported commands are their arguments are listed below. |
| 92 | + |
| 93 | +``SNIOC_HOT_START`` |
| 94 | +------------------- |
| 95 | +Used to "Hot start" the GNSS module. Normally hot start means the GNSS module was powered down for less |
| 96 | +than 3 hours (RTC must be alive) and its ephemeris is still valid. As there is no need for downloading |
| 97 | +ephemeris, it is the fastest startup method. |
| 98 | + |
| 99 | +.. code-block:: c |
| 100 | +
|
| 101 | + orb_ioctl(sensor, SNIOC_HOT_START); |
| 102 | +
|
| 103 | +``SNIOC_WARM_START`` |
| 104 | +-------------------- |
| 105 | +Used to "Warm start" the GNSS module. Warm start means the GNSS module has approximate information of time, |
| 106 | +position and coarse data on satellite positions, but it needs to download ephemeris until it can get a fix. |
| 107 | + |
| 108 | +.. code-block:: c |
| 109 | +
|
| 110 | + orb_ioctl(sensor, SNIOC_WARM_START); |
| 111 | +
|
| 112 | +``SNIOC_COLD_START`` |
| 113 | +-------------------- |
| 114 | +Used to "Cold start" the GNSS module. Using this message will force the GNSS module to be restarted without |
| 115 | +any prior location information, including time, position, almanacs and ephemeris data. |
| 116 | + |
| 117 | +.. code-block:: c |
| 118 | +
|
| 119 | + orb_ioctl(sensor, SNIOC_COLD_START); |
| 120 | +
|
| 121 | +``SNIOC_FULL_COLD_START`` |
| 122 | +------------------------- |
| 123 | +Used to "Full cold start" the GNSS module. This is effectively the same as a cold restart, but additionally |
| 124 | +clears system and user configurations. In other words, this resets the GNSS module to its factory settings. |
| 125 | +When full-cold started, the GNSS module has no information on its last location. |
| 126 | + |
| 127 | +.. code-block:: c |
| 128 | +
|
| 129 | + orb_ioctl(sensor, SNIOC_FULL_COLD_START); |
| 130 | +
|
| 131 | +``SNIOC_SET_INTERVAL`` |
| 132 | +---------------------- |
| 133 | +Used to modify the position fix interval of the GNSS module. The argument is an integer between 100 and 10000, default value is 1000. |
| 134 | + |
| 135 | +.. code-block:: c |
| 136 | +
|
| 137 | + orb_ioctl(sensor, SNIOC_SET_INTERVAL, 1000); |
| 138 | +
|
| 139 | +``SNIOC_SET_BAUD`` |
| 140 | +------------------ |
| 141 | +.. note:: |
| 142 | + |
| 143 | + This feature requires termios support to be enabled(``CONFIG_SERIAL_TERMIOS``) |
| 144 | + |
| 145 | +Used to modify the baud rate of the GNSS module. The argument is an integer representing a supported baud rate, default value is 9600. |
| 146 | +Upon sending this command, the baud rate of the UART interface used to communicate with the module is also modified. |
| 147 | +Supported baud rates for the L86-XXX series of GNSS modules are: |
| 148 | + |
| 149 | +* 4800 |
| 150 | +* 9600 |
| 151 | +* 14400 |
| 152 | +* 19200 |
| 153 | +* 38400 |
| 154 | +* 57600 |
| 155 | +* 115200 |
| 156 | + |
| 157 | +.. code-block:: c |
| 158 | +
|
| 159 | + orb_ioctl(sensor, SNIOC_SET_BAUD, 9600); |
| 160 | +
|
| 161 | +``SNIOC_SET_OPERATIONAL_MODE`` |
| 162 | +------------------------------ |
| 163 | +Used to set the navigation mode of the GNSS module. The argument is an ``L86XXX_OPERATIONAL_MODE`` enum: |
| 164 | + |
| 165 | +* NORMAL - For general purpose |
| 166 | +* FITNESS - For instances in which low-speed movements (<5 m/s>) will affect calculations |
| 167 | +* AVIATION - For high-dynamic purposes that the large-acceleration movement will have more effect on the position calculation |
| 168 | +* BALLOON - For high-altitude balloon purposes that vertical movement will have more effect on the position calculation |
| 169 | +* STANDBY - Used to enter standby mode for power saving |
| 170 | + |
| 171 | +Default mode is NORMAL |
| 172 | + |
| 173 | +.. code-block:: c |
| 174 | +
|
| 175 | + orb_ioctl(sensor, SNIOC_SET_OPERATIONAL_MODE, NORMAL); |
| 176 | +
|
| 177 | +
|
0 commit comments