Git Product home page Git Product logo

u-blox / ubxlib Goto Github PK

View Code? Open in Web Editor NEW
272.0 26.0 78.0 15.9 MB

Portable C libraries which provide APIs to build applications with u-blox products and services. Delivered as add-on to existing microcontroller and RTOS SDKs.

License: Apache License 2.0

C 94.19% C++ 0.44% Makefile 0.29% CMake 0.49% Python 3.82% Go 0.20% Assembly 0.38% Batchfile 0.01% Shell 0.04% Dockerfile 0.10% AGS Script 0.05%
api iot microcontroller library lte lte-m bluetooth ble wifi gnss embedded developer-tools iot-device stm32 u-blox ublox esp32 nrf52 nrf53

ubxlib's Introduction

important message

Note: if you are reading this from a package-file created by a third-party [e.g. PlatformIO] and the links do not work, please try reading it at the original ubxlib Github site instead.

IMPORTANT: port/platform/arduino and port/platform/nrf5sdk are NOW DEPRECATED and will be REMOVED at release 1.5, likely mid 2024: if you wish to continue to use ubxlib with Arduino, please consider moving to the PlatformIO IDE; we will continue to support nRF52/nRF53 through what is now the Nordic standard nRF Connect SDK (i.e. Zephyr 3).

Introduction to ubxlib

This repository contains an add-on to microcontroller and RTOS SDKs for building embedded applications with u-blox products and services. It provides portable C libraries which expose APIs with examples. ubxlib supports u-blox modules with cellular (2G/3G/4G), short-range (Bluetooth and Wi-Fi) and positioning (GNSS) functionality. The ubxlib libraries present high level C APIs for use in customer applications (e.g. connect to a network, open a TCP socket, establish location, etc.) and implements these APIs on selected popular MCUs, also available inside u-blox modules.

The goal of ubxlib is to deliver a single tested solution, with examples, which provides uniform easy-to-use APIs across several u-blox products. Releases of ubxlib are tested automatically for all configurations on multiple boards in a test farm.

ubxlib high level overview

The easiest way to quickly explore ubxlib is to start with a board listed in the test farm. u-blox EVKs (evaluation kits) or application boards can be found here or at major electronics distributors and code examples which run on the u-blox XPLR-IOT-1 platform can be found here. If you've heard enough and want to get started with the XPLR-IOT-1 platform, or maybe with PlatformIO, jump straight to How To Use This Repo below.

ubxlib runs on a host microcontroller and has a peripheral attached. This setup is very common in embedded applications. An example of such a host-peripheral configuration with EVK-NINA-B301 (Bluetooth 5.0) and EVK-R4 (SARA-R4 with 2G/3G/4G) in which the ubxlib host sets up a TCP connection is shown in the following figure. Many other combinations can be achieved, with the supported hosts and peripherals in the tables in the next section.

EVK setup

APIs

The key APIs provided by this repo, and their relationships with each other, are shown in the picture below.

APIs

  • If you wish to bring up a device/network and don't care about the details, use the common device and network APIs, which can bring up cellular, BLE/Wi-Fi or GNSS network(s) at your choosing.
  • If you wish to use a socket over that network, use the common sock API.
  • If you wish to use security, use the common security API.
  • If you wish to contact an MQTT broker over that network, use the common mqtt_client API.
  • If you wish to use HTTP, use the common http_client API.
  • If you wish to get a location fix use the common location API.
  • If you wish to build a geofence that can be used with gnss, wifi and cellular, see the common geofence API.
  • If you wish to take finer control of cellular, ble, wifi or gnss, use the respective control API directly.
  • GNSS may be used via the gnss API.
  • The BLE and Wi-Fi APIs are internally common within u-blox and so they both use the common short_range API.
  • The at_client API is used by the cellular and short range APIs to talk to AT-based u-blox modules.
  • The ubx_protocol API implements the necessary encoding/decoding to talk to u-blox GNSS modules.
  • The port API permits all of the above to run on different hosts; this API is not really intended for customer use - you can use it if you wish but it is quite restricted and is intended only to provide what ubxlib needs in the form that ubxlib needs it.

All APIs are documented with Doxygen compatible comments: simply download the latest Doxygen and either run it from the ubxlib directory at a command prompt or open Doxyfile in the Doxygen GUI and run it to obtain the output.

Supported ubxlib host platforms and APIs

Hosts run ubxlib and interact with an attached periperal. A host platform contains an MCU, toolchain and RTOS/SDK as listed in the table below. Hosts are typically u-blox open CPU (standalone) modules or other MCUs. To use a host you need a development board or an EVK. Currently ubxlib supports and tests the following purchasable boards out-of-the box.

If your MCU is on the list but your board is not:

  • just set the HW pins in the source file of the example to match how your MCU is wired to the u-blox peripheral.

If your MCU is not on the list:

  • if you are using PlatformIO and Zephyr then any MCU that Zephyr supports should work with ubxlib, just follow the instructions here to bring ubxlib into your existing PlatformIO environment,
  • otherwise, to port ubxlib to a new host platform follow the DIY instructions for the port API.
ubxlib hosts NINA-W10 NINA-B40 series
NINA-B30 series
NINA-B1 series
ANNA-B1 series
NORA-B1 series C030 board PC PC
MCU Espressif ESP32 Nordic nRF52 Nordic nRF53 ST-Micro STM32F4 x86/64 (Linux) x86 (Win32)1
Toolchain ESP-IDF
Arduino-ESP32
GCC
nRF Connect
nRF Connect Cube GCC MSVC
RTOS/SDK FreeRTOS FreeRTOS
Zephyr
Zephyr FreeRTOS Posix Windows
APIs provided by host with peripheral attached2 wifi
ble
device
network
sock
ble
device
network
ble
device
network
cell
device
network
sock
location3
TLS security
N/A N/A

1: For development/test purposes only.
2: Only SPS API provided for native (on-chip) BLE interface, other APIs for native (on-chip) access, e.g. WiFi support, are a work in progress.

Supported modules as ubxlib peripherals and APIs

Peripherals are u-blox modules which accept commands (e.g. AT-commands) over a serial interface and have no open MCU environment. To run the APIs they need to be attached to a host which runs ubxlib. For example in the test farm combinations of hosts and peripherals are listed.

ubxlib peripherals NINA-B41 series
NINA-B31 series
NINA-B1 series
ANNA-B1
NINA-W13 NINA-W15
NORA-W364
SARA-U2 series LENA-R8 series SARA-R4 series
SARA-R5 series
LARA-R6 series
SARA-R510M8S
SARA-R520M10S
SARA-R422M8S
SARA-R422M10S
M8/M9/M10 series
APIs provided by host with peripheral attached ble
device
network
wifi
device
network
sock
TLS security
mqtt_client
http_client
wifi
ble
device
network
sock
TLS security
mqtt_client
http_client
cell
device
network
sock
location3
TLS security
http_client
cell
device
network
sock
location3
TLS security
mqtt_client
cell
device
network
sock
location3
security5
mqtt_client
http_client
All APIs of
SARA-R4,
SARA-R5 series +
gnss
location
gnss
location

3: Through the u-blox CellLocate mobile network-based location service.
4: Beta support: please add short_range_gen2 to the UBXLIB_FEATURES variable in your make or CMake file when building ubxlib for NORA-W36; NORA-W36 comes with a second generation u-connectExpress, please see the release notes for NORA-W36 for the supported features.
5: Except SARA-R422 (non-S), which supports no form of security, and SARA-R52, which supports only TLS security.

Structure of ubxlib

The APIs for each type of u-blox module can be found in the relevant directory (e.g. cell for cellular modules and ble/wifi for BLE/Wi-Fi modules). The common directory contains APIs and 'helper' modules that are shared by u-blox modules, most importantly the device API, the network API and the sockets API. All APIs are documented in the API header files.

Examples demonstrating the use of the APIs can be found in the example directory. If you are using Zephyr or the u-blox XPLR-IOT-1 platform you will find examples that are very simple to install and use in https://github.com/u-blox/ubxlib_examples_xplr_iot.

Each API includes a test sub-directory containing the tests for that API which you may compile and run if you wish.

Build information for each platform can be found in the platform sub-directory of port; more on this below.

In order for u-blox to support multiple platforms with this code there is also a port API. This is not intended to be a generic porting API, it is simply sufficient to support the APIs we require. If you have not chosen a supported platform you may still be able to use the high level APIs here unchanged by implementing the port API for your platform.

+---example                    <-- examples that introduce the main features 
+---cfg                        <-- global configuration header files
+---common                     <-- APIs that are common across u-blox modules
¦   +---device                 <-- the simple device API for opening cell, short-range (i.e. BLE or Wi-Fi) and GNSS modules
¦   ¦   +---api                <-- all folders, in general, have an API directory
¦   ¦   +---src                    containing public headers, a source directory with
¦   ¦   +---test                   the implementation and a test directory with the tests
¦   +---network                <-- the simple network API for BLE, cell, Wi-Fi and GNSS
¦   +---sock                   <-- the sockets API for cell, Wi-Fi (and in the future BLE)
¦   +---security               <-- common API for u-blox security and TLS security/credential storage
¦   +---mqtt_client            <-- common MQTT client API
¦   +---http_client            <-- common HTTP client API
¦   +---location               <-- common location API, can use GNSS, Cell Locate, Cloud Locate and in the future Wi-Fi/BLE stations, etc.
¦   +---short_range            <-- internal API used by the BLE and Wi-Fi APIs (see below)
¦   +---at_client              <-- internal API used by the BLE, cell and Wi-Fi APIs
¦   +---ubx_protocol           <-- internal API used by the GNSS API
¦   +---geofence               <-- common geofence API that can be used with GNSS, cellular and Wi-Fi-based positioning
¦   +---spartn                 <-- message validation utilities for SPARTN
¦   +---error                  <-- u_error_common.h: error codes common across APIs
¦   +---assert                 <-- assert hook
¦   +---utils                  <-- contains common utilities
¦   ...
+---cell                       <-- API for cellular (if you need more than network provides)
+---wifi                       <-- API for Wi-Fi (if you need more than network provides)
+---ble                        <-- API for BLE
+---gnss                       <-- API for GNSS
+---port                       <-- port API: maps to SDKs and MCU platforms, includes build metadata
    +---api
    +---test
    +---clib
    +---platform               <-- look here for the supported SDKs and MCU platforms
        +---<platform>         <-- e.g. esp-idf
        ¦   +---app            <-- main() for this platform: runs all examples and tests
        ¦   +---src            <-- implementation of the port API for this platform
        ¦   +---mcu            <-- configuration and build metadata for the MCUs supported on this platform
        ¦       +---<mcu>      <-- e.g. esp32
        ¦           +---cfg    <-- platform specific config (pins, OS things, MCU HW blocks)
        ¦           +---runner <-- a build which compiles and links all examples and tests
        +---static_size        <-- a build that measures RAM/flash usage
        +---common             <-- things common to all platforms, most notably...
            +---automation     <-- the internal Python automation scripts that test everything
            ...

How to use this Repo

There are a few possible approaches to adopting ubxlib. If you do not have a fixed environment (MCU, toolchain, RTOS, etc.) then the first two options offer an easy start; if you are constrained in how you must work (i.e. you must use a particular MCU or toolchain or RTOS), or you are happy to dive into the detail from the outset, then the third way is for you.

The Easy Way 1: XPLR IoT

If you would like to explore cellular, positioning, Wi-Fi and BLE, along with a suite of sensors, all at once, you might consider purchasing a u-blox XPLR-IOT-1 platform and using the associated ubxlib examples repo, which allows you to install, build and run Zephyr-based applications.

The Easy Way 2: PlatformIO

ubxlib is supported as a PlatformIO library; if you have a board that either (a) runs Zephyr or (b) contains an ESP32 chip (running ESP-IDF or Arduino), then just follow the instructions here to load ubxlib directly into the PlatformIO Visual Studio Code-based IDE.

The Hard Way: Down in the Detail

This repo uses Git submodules: make sure that once it has been cloned you do something like:

git submodule update --init --recursive

...to obtain the submodules.

The native SDKs for each supported platform are used directly, unchanged, by this code. To use this repo you must first choose your MCU and associated platform. For instance, you might choose an STM32F4 MCU, which is supported via ST's STM32Cube IDE. Instructions for how to install and use each platform can be found in your chosen MCU sub-directory; for an STM32F4 MCU this would be port/platform/stm32cube/mcu/stm32f4.

Having chosen your MCU and installed the platform tools, navigate to the directories below your chosen MCU directory to find the required build information. For instance, you may find a runner directory, which is a generic build that compiles any or all of the examples and tests that can run on a given platform. In that directory you will find detailed information on how to perform the build.

Configuration information for the examples and the tests can be found in the cfg directory of your chosen MCU. Depending on how you have connected your MCU to a u-blox module you may need to override this configuration, e.g. to change which MCU pin is connected to which pin of the u-blox module. The README.md in the runner directory of your chosen MCU will tell you how to override conditional compilation flags in order to do this.

Examples

A number of examples are provided with this repo:

Technology Example
Cellular The sockets example brings up a TCP/UDP socket by using the device, network and sock APIs.
Cellular A TLS-secured version of the sockets example.
Cellular A DTLS-secured version of the sockets example.
Cellular A PPP version of the sockets example that shows how the platform IP stack/applications can use a cellular connection.
Cellular An MQTT/MQTT-SN client using the MQTT/MQTT-SN client API.
Cellular An HTTP client using the HTTP client API.
Cellular CellLocate example.
Cellular The PSK generation example using the security API.
Bluetooth See the BLE examples in the XPLR-IOT-1 ubxlib examples repo.
Wi-Fi The sockets example brings up a TCP/UDP socket by using the device, network and sock APIs.
GNSS location example using a GNSS chip connected directly or via a cellular module.
GNSS cfg_val example configuring an M9 or later GNSS chip with CFGVALXXX messages.
GNSS message example communicating directly with a GNSS chip, messages of your choice.
GNSS decode example decoding messages of your choice, not otherwise provided by ubxlib, from a GNSS chip.
GNSS position example obtaining streamed position directly from a GNSS chip.
GNSS AssistNow example of how to use the u-blox AssistNow service to improve the time to first fix of GNSS.
GNSS geofence example of how to use the comon geofence API with GNSS; note that it can equally be used with cellular (CellLocate) and Wi-Fi (Google, SkyHook and Here).

You may use the code from any of these examples as a basis for your work as follows:

  • Copy the source files for the example that is closest to your intended application to your project directory.
  • Remove all definitions and include files that are related purely to the ubxlib test system; for example you only need to include the ubxlib.h file and you will want the entry point to be something like int main() rather than U_PORT_TEST_FUNCTION(...).
  • Adapt the definitions needed for your example, see the include file u_cfg_app_platform_specific.h for your platform; some examples of definitions that need to be set are:
    • UART/I2C/SPI number and UART/I2C/SPI pins (i.e. for whichever transport is being used) connecting the MCU to the target module,
    • network credentials (e.g. Wi-Fi SSID and password).
  • Copy the make or cmake files from the runner directory of the port (port/platform/) of your chosen MCU and adapt them to your application:
    • point out the ubxlib directory by setting the UBXLIB_BASE variable,
    • remove any definitions related to the ubxlib test environment as you wish,
    • if needed, add the source file(s) of your application to the make/cmake files.
  • Build and flash your adapted example using your IDE of choice or command-line make/cmake.

General information about how to integrate ubxlib into a build system is available in the port directory and platform specific information is available in the platform specific port directory for your chosen MCU.

Where is ubxlib used?

The following table showcases repositories which build applications and use ubxlib.

Description Code repository Radio Technology Modules used Boards used
BLE examples such as: scanning, Serial Port Service (SPS), beacon, angle-of-arrival (AoA). https://github.com/u-blox/ubxlib_examples_xplr_iot BLE NORA-B1 XPLR-IOT-1
Cellular tracker which publishes cellular signal strength parameters and location to an MQTT broker. https://github.com/u-blox/ubxlib_cellular_applications_xplr_iot LTE Cat-M1, GNSS SARA-R5, MAX-M10 XPLR-IOT-1
Location example to get location using both CellLocate and CloudLocate. Calculates location based on cellular, Wi-Fi or GNSS information. https://github.com/u-blox/XPLR-IOT-1-location-example LTE Cat-M1, WiFi, BLE NINA-W1, SARA-R5, MAX-M10 XPLR-IOT-1
High precision GNSS (HPG) solution for evaluation and prototyping with the PointPerfect GNSS augmentation service. https://github.com/u-blox/XPLR-HPG-software GNSS, WiFi, LTE Cat-1 ZED-F9, NEO-D9, NINA-W1, NORA-W1, LARA-R6 XPLR-HPG-1, XPLR-HPG-2
Sensor aggregation. Collect data from sensors and send it to the Thingstream platform using either Wi-Fi or Cellular Network connections. https://github.com/u-blox/XPLR-IOT-1-software WiFi, LTE Cat-M1 NINA-W1, SARA-R5 XPLR-IOT-1
Air Quality Monitor with Sensirion Sensor showing how sensor data be sent to the Thingstream platform via MQTT, and then visualized in a Node-RED dashboard. https://github.com/u-blox/XPLR-IOT-1-Air-Quality-Monitor-Example BLE NORA-B1 XPLR-IOT-1, MikroE HVAC

Feature Request and Roadmap

New features can be requested and up-voted here. The comments of this issue also contains an outlook about features of upcoming releases. Also it is the right place to discuss features and their priority.

License

The software in this repository is Apache 2.0 licensed and copyright u-blox with the following exceptions:

In all cases copyright, and our thanks, remain with the original authors.

Disclaimer

  • The software in this repository assumes the module is in a state equal to a factory reset.
  • If you modify the AT command sequences employed by ubxlib please take the time to debug/test those changes as we can't easily support you.

ubxlib's People

Contributors

aarc10 avatar alizaidiubx avatar alonbl avatar andreaslarssonublox avatar antevir avatar brec-u-blox avatar chriskarls avatar chrsag avatar hkro avatar jakkra avatar jan-olegiebel avatar ldab avatar mazgch avatar mekm avatar mtfurlan avatar mudassar-ublox avatar naquino14 avatar nathanmolson avatar pellepl avatar plerup avatar pohakansson avatar qasim-ublox avatar rendermonkey87 avatar rexut avatar rmartinakerberg avatar robmeades avatar rthiyaga avatar sakrubx avatar stephanboner avatar ubmtho avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ubxlib's Issues

Unable to bring up the network!

Hi,

sometimes the connection is not successfully established, so that the module no longer works.

Unfortunately I don't use the following options:
U_CFG_APP_PIN_CELL_ENABLE_POWER
U_CFG_APP_PIN_CELL_RESET
U_CFG_APP_PIN_CELL_VINT

What other option is there to reset the module via software?

Allow to use Hex-Mode instead of binary mode for USOWR

Hey there, while evaluating ubxlib further, I came across one issue that I'd like to discuss.
Socket write calls are currently always using the binary mode, which results in a lot of delays while sending out small packets of data due to the 50ms timing requirement.

To evaluate this, I did a test where I compared the performance of ubxlib with the performance of an alternative, custom written driver and got these results:

  • To send 45 bytes, ubxlib takes about 100ms
  • Our custom driver only takes 14ms for the same amount of data (encoded in hex mode).

Both of these measurements where taken from the first byte of the USOWR command to the last byte of the final result code.

I'm not quite sure why the difference is so large - the modem responds with the @ sign after 14ms. I know that there is a 50ms timing in ubxlib, but the actual data is only getting sent 80ms after the initial USOWR command, which is suprising to me.

Of couse, this difference may also be partially caused by the different RTOS and MCU in the two tests, but even if you'd reduce the number of ubxlib by the unnecessary 30ms delay, we are still looking at a significant slow down here.

Therefore, I'd like to suggest integrating support for hex mode into ubxlib.
This could either be done as a manual option where all subsequent write calls would just use hex mode or some automatic mode decision depending on the payload size could be used - For larger data packets, binary mode may well be beneficial for transfer speeds.
Of course, globally enabling hex mode would also have an impact on all receive calls.

If you're interested in the details of my measurements, I could also provide the logic analyzer traces.

PC as host

Run u-blox modules on a Linux or Windows host with ubxlib

Problem with SARA-R500S-00B which now is critical

Hi,

I'm using Zephyr with porting layer of ubxlib and all the HALs and Drivers.
Currently, I'm working on SARA-R500S-00B bringup.
I had a success and everything was working normal except the shutdown procedure. So basically the cell shutdown method was never returning. Once I did more investigation, I figured that the modem never send a message to ACK the request. Now the problem has become worse. Right after we finish initialization and try to see if the modem is alive, as soon as we send the first command, we start to get response of 07E and it never stops. This is very likely to not be ublox related, but I was wondering if a team had any similar experiences.
Our HW platform currently is Ublox.
Thank you

Disable certain features at compile time

We are considering using ubxlib with a cellular modem and will not need WiFi or BLE features.
Unfortunately, there are some calls to the BLE layer in the common library, specifically in the network component.
The socket layer will presumably have the same issue with WiFi once that is implemented.

Do you intend to add compile time options to disable support for certain device classes or devices? That would allow us to reduce the amount of flash memory required for ubxlib.

Error when establishing the mqtt connection

Hello @RobMeades .

I use an ESP32 with the ESP-IDF library and try again to establish a connection to the mqtt service.
And I get the following error message as shown in the picture.
But what I noticed is that if I use an earlier version of ubxlib, is the error not ther
assert
e?

Can you switch the codes from ESP-IDF to ESP32 libraries in Arduino IDE?

Hi There,

Thank you so much for your codes for ESP32 MCU in ESP-IDF, I have lots of ESP camera boards and a Hologram Nova that has Sara-R410 and I want to connect ESP32 to it.
But the problem is all of my previous application codings are in Arduino IDE as most ESP32 codes are written in Arduino IDE!
So would you please modify your code so that we be able to use ubxlib library in Arduino IDE platform instead of IDF, like what Sparkfun people did?

Thank you so much!

no network service

Hi everyone.
I recently got "no network service" during registration.
No network

Any plans for NINA-B2?

Hi,
I have been waiting for this official repo to come true and now it's here! Great!
However, i don't see any plans for the NINA-B2, is it intentional?

get no connection to the network

I have the SARA-R412M 02B module, more precisely "LTE IoT 6 click" in connection with the ESP32 MCU. In the beginning everything worked great. Later I used a new SIM card, which was recognized in the system but did not get a connection to the network.
Then I exchanged the SIM card again, initially the card worked again, but after several attempts to dial in, I can no longer get a connection with this card either.
failed.txt
successful.txt

Does anyone have an idea why this might be?

invalid heap address used in zephyr uNetworkInit()

I was using lib 0.9.1 OK; but just rebased to master latest commit bb05f55; as I wanted to pick up some changes to the AT client.

Here is description as sent to Rob....

Progressed OK with 0.9.1 and the SMS related stuff; coded to use your at partial string write; for assembling the actual sms modem command; have already switched modem to sms text mode via other sequences. Then saw this API was not in your latest 0.9.1 release; so I have tried to move to your latest commit on master and this breaks my build.

Break is in initialisation code where uPortQueueCreate() is called; faulting in the k_msq_alloc_init() heap allocation. Working back from this checking where heap stuff is init'ed I see you have some kind of kludge in u_port_os.c and have called k_thread_system_pool_assign().

The heap that is trying to be used later is (0xAAAAAAAA random unitialised).

But what if that initialisation is not called from z_main_thread; which in my case it is not. In my test harness I am calling your init functions from my debug console shell. You added kludge for main thread; but is this zephyr bug you mention the same for all threads; the current thread resource_pool is for me not initialised (0xAAAAAAAA).

Just looking if I can just cherry pick your changes for the uAtClientWritePartialString(); but if I can then I will probably only be bitten by the same issue later.

Any suggestions to progress?
heapCrash

wrong ICCID

Hi, everyone,

I am trying to query the ICCID with the "uCellInfoGetIccidStr" function. But I get one character at the end of the number too many. what could be the problem?
bytesRead = uCellInfoGetIccidStr(networkHandle, ICCID_buffer, sizeof(ICCID_buffer));

here is the representation of the portal of my provider
image

and here what the modem outputs
image

HTTP API

Integrate HTTP features into the API.

Concatenate a string for a message

To send a message, I would like to put it together from several parts in advance.
On the one hand I have a file where I saved certain sensor values and on the other hand I would like to add the ICCID and the transmission power of the antenna.

Do you perhaps have an example of how I best concatenate a string?

this is what i use so far
image
image
image

Unable to connect to MQTT broker

the following structure is ...
iot device: ESP32 with sara-r412m 02b
network connection is established via the provider 1nce.com.
There is a vpn tunnel between 1nce and my server.
the vpn ip address of the server is used in the iot device.

I have another device based on pycom fipy. There a connection to the mqtt is successfully established by itself. Therefore I rule out an error on my server side.
mqtt_connection_failed.txt

Testing lte-cfg example with ESP32 Feather and Sparkfun LTE shield

Hi there,

In our prototyping with SARAR410 modules, we have very good progress in soldering these boards, but I am still having issues with the software. So going back to the basics, I am running your lte-cfg example on ESP-IDF 4.2, using ESP32 feather board connected to Sparkfun shield(as a break-out board for SARA R410M_02B-01) with a hologram Simcard. ESP32 is connected to SARA shield Serial port with four pins; GND, V_REF(3.3 from ESP32 reaches Sparkfun shield level shifter), and of course RX and TX pins.

The ESP-IDF prompt, for example 9 (lte-cfg) starts printing;
U_CELL: initialising with enable power pin not connected, PWR_ON pin not connected and VInt pin not connected.
AT
...
And In the end, the errors I get in the prompt terminal are;

Added network with handle -7.
This module does not support setting an MNO profile.
unable to read bandmask!
Bringing up the network...
Unable to bring up the network!
Done.
D:/UBLOX/ubxlib/example/cell/lte_cfg/lte_cfg_main.c:455:exampleCellLteCfg:FAIL:Function [example]. Expression Evaluated To FALSE
Test ran in 6645ms

I am not sure why it is not able to read bandmask or MNO profile is not supported on R410M_02B.

My simcard, hologram, is MNO agnostic but reading about MNO settings in AT command datasheet for the United States, I set the MNO to 2 or 5 for AT&T and TMobile respectively and APN to "phone" or "hologram" or a few other values mentioned for Tmobile in u_cell_apn_db.h like "fast.tmobile.com" , but I get the same error. Any suggestions?

Things I modify in ubxlib library files;

define MY_MNO_PROFILE 2 //i.e. AT&T, I tried 0 and 5 too
define U_CFG_TEST_CELL_MODULE_TYPE U_CELL_MODULE_TYPE_SARA_R410M_02B
ifdef U_CFG_TEST_CELL_MODULE_TYPE
static const uNetworkConfigurationCell_t gConfigCell = {U_NETWORK_TYPE_CELL,
U_CFG_TEST_CELL_MODULE_TYPE,
NULL, /* SIM pin /
"phone", /
APN: NULL to accept default.
240,

define U_CFG_APP_CELL_UART 1
define U_CFG_APP_PIN_CELL_TXD 17
define U_CFG_APP_PIN_CELL_RXD 16

Btw, in the Hologram Dashboard website, sometimes it says the Simcard was connected so the late connection is probably related to MNO, RAT, and CATM1 settings...
Also, my goal is to send camera photos with this board, so I need to set it to CAT_M1 instead of NB_IOT, right?
I will try this @RobMeades comment that might accelerate the connection if it is delayed by NB_IOT;
#25 (comment)

Thanks,
Mohsen

AssistNow Online Support

Hey, I'm using the SARA-R510M8S and wanted to know if there was any way I could use AssistNow Online to assist the GPS chip? I've got CellLocate working but I'd like to get continual information from the GPS chip (or if there's another way to jump-start the GPS chip and just keep it on from there, please let me know).

Thanks!

Unable Establish ST-LINK between STM32CubeIDE and u-blox C030-R510M8S

Hi, Rob,

I have completed the ubxlib build (issue: #3), but unable to run it on C030-R510M8S application development board. I have installed the USB ST-Link driver (https://www.st.com/content/st_com/en/products/development-tools/software-development-tools/stm32-software-development-tools/stm32-utilities/stsw-link009.html) but did not help. I believe you have the same board, how did configure/install the ST-LINK? Please assists, thanks.

I have provided multiple screenshots for your reference:
ST-LINK_Drivers
DeviceManager
ST-LINK_Cofiguration
ST-LINK_NotDetected
ST-LINK_Upgrade

Regards,
Chin

Feature voting and roadmap

Bring in and up-vote your favorite features!

  • Follow this LINK where all the features are sorted by popularity
  • Open an issue describing the feature you'd like to be implemented first, admins will label it as feature
  • Add a 👍 reaction to the feature description (the first message in the issue)

Here in this issue:

  • Feel free to ask questions and discuss any features and their priority in this issue
  • Contributors will post updates and outlook for upcoming ubxlib releases

C++ wrappers?

Is there potential for there to be separate C++ classes for easier organizing of code?

Means to know all AT responses have been received

We are using an ANNA-B112 module with u-connectXpress for BLE. We are talking to the ANNA-B112 over uart using the ublxlib (https://github.com/u-blox/ubxlib) at_client, registering callbacks through uAtClientSetUrcHandler.

The problem we are encountering is that when we issue AT commands like AT+UBTGDCS to discover all of the characteristics for a given service, there are multiple responses followed by an OK.

For example this is what the command and responses look like using extended data mode to discover all the characteristics:

---><00><17><00>DAT+UBTGDCS=0,7,65535<0D>U

<---<00>6<00>E<0D><0A>+UBTGDCS:0,8,28,9,245468008B8511E48FBD0002A5D5C51BU

<---<00>8<00>E<0D><0A>+UBTGDCS:0,11,28,12,245468108B8511E48FBD0002A5D5C51BU

<---<00>8<00>E<0D><0A>+UBTGDCS:0,14,20,15,245468118B8511E48FBD0002A5D5C51BU<00>8<00>E<0D><0A>+

<---UBTGDCS:0,17,02,18,245468028B8511E48FBD0002A5D5C51BU<00>8<00>E<0D><0A>+

<---UBTGDCS:0,19,02,20,245468038B8511E48FBD0002A5D5C51BU<00>8<00>E<0D><0A>+

<---UBTGDCS:0,21,02,22,245468048B8511E48FBD0002A5D5C51BU<00><08><00>E<0D><0A>O

<---K<0D><0A>U

At the end of each response “U”, a callback from the at_client occurs as it should.

However, it appears there is no way to know when all of the characteristics have been received (When “OK” is received), and the module doesn’t respond to any further commands until it is has finished sending all responses.

Is there a mechanism that we are missing in the at_client to know when all responses have been received, or would we have to just know there are 6 characteristics to be discovered?

PSM and eDRX

Integrate power saving features into the API.

Module configuration "extended errors"

Hi
Shouldn't be AT+CMEE=1 (numeric) instead of AT+CMEE=2 (verbose) in the module configuration?
Otherwise uAtClientDeviceErrorGet() returns a struct where member "code" cannot be assigned correctly and always has the value 0. On the other hand, verbose mode is of course more helpful for debugging.

missing gpioConfig.pullMode assignment for VINT pin?

hello. I think there is a possible issue with a missing pull mode assignment for the VINT pin in "u_cell.c". If "pinEnablePower" is use the pull mode is set to "U_PORT_GPIO_PULL_MODE_NONE". If "pinEnablePower" is not used the VINT input pin will be set to "U_PORT_GPIO_PULL_MODE_PULL_UP". depending on the hardware this will lead to a misinterpretation of the input. But maybe I'm wrong.

GNSS API

Offer a very simple location API, providing a means to establish position using any u-blox module, potentially in conjunction with cloud services.

LWM2M / CoAP

Hello
Are there plans for a LWM2M and Coap client?

Support UART Break Condition

Many MCU UARTs can detect a 'break condition' where the Rx line is held low for longer than a frame period. https://en.wikipedia.org/wiki/Universal_asynchronous_receiver-transmitter#Break_condition

Our cellular modules will perform this break condition when going into PSM and shutting down.

I believe ESP32, nRF52 and STM32 MCUs support a break interrupt. We should investigate how we could use this break condition to detect PSM and power down states, for when V_INT monitoring is not possible, or +UPSMR: 1 URC is not implemented.

1.0 Zephyr support

I was very pleasantly surprised to discover this repo today; as a long time user of U-Blox products I've always wanted to see official drivers (and they're open source to boot!) I was also excited to see a Zephyr port. Are there any plans to upstream as an official driver for Zephyr? Lot's of folks in the Zephyr community are interested in U-Blox modems but it would be great to get the broad support this project offers.

uSockGetHostByName() fails if we use stubs for wifi.

Hello all
We are using cell sockets to resolve the address of a host. However, with the current master branch this fails. The reason seems to be in uWifiSockInit() line 474 in u_sock.c. This function is also called when only cell sockets are used. In this case the call fails with error code -5.

If I comment out the line, everything works as before.
Is there any other way I can work around this problem?

Cellular: Add some helper functions to set the bands to scan.

Setting the bands to scan on for cellular modules can be a pain, what with the 2^ nonsense....
Having a simple API for this would make it easy for customers.

Something like celEnableBands(x) and celDisableBands(y), with parameters that can extend, like celEnableBands(x, y, z, a, b, c);

Probably need a celClearBands() function to, to start fresh.
Topic for discussion.

config settings for ESP and ublox cellular communication

Hi Rob,

So recently, I was able to upload runner to Adafruit ESP32 feather board successfully;
https://github.com/u-blox/ubxlib/tree/master/port/platform/esp-idf/mcu/esp32/runner

And I connected its GPIO16 and GPIO17 as RX and TX to Sarar4 breakout board(Sparkfun shield);
https://learn.sparkfun.com/tutorials/lte-cat-m1nb-iot-shield-hookup-guide/all

I get the following error when running ExampleSockets(first choice);
idf.py -p COM5 -D TEST_COMPONENTS="ubxlib_runner" flash monitor

Running ExampleSocket... by clicking "1"
Added network with handle -5
Bringing up the network...
Unable to bring up network!
Done.

I modified the server part in example >sockets> main.c to the following;

// Echo server URL and port number
#define MY_SERVER_NAME "www.google.com"
#define MY_SERVER_PORT 80

Also, how can I register operator and APN in this example?

Here is how I was able to set APN and operator in Sparkfun;
https://github.com/sparkfun/SparkFun_LTE_Shield_Arduino_Library/blob/master/examples/00_Register_Operator/00_Register_Operator.ino

Details:
Btw, I tested Sparkfun and hologram Simcard; Hardware works, and I was able to run their Arduino codes, like sending SMS or registering AT&T network...; These are easy Arduino examples you might like to include in your Arduino Platform...;
https://github.com/sparkfun/SparkFun_LTE_Shield_Arduino_Library/tree/master/examples

Then I disconnected the Arduino board from Sparkfun lte shield and connected 4 pins RX,TX,VCC, and ground from ESP32 feather to the late shield and I run the runner in IDF, which did not work as I explained.

My u_cfg_app_platform_specific.h configuration in folder ...ubxlib\port\platform\esp-idf\mcu\esp32\cfg:

what I did is just connect rx and tx as gpio 16 and 17 from ESP feather board uart2 to sparkfun lte shield;
define U_CFG_APP_PIN_CELL_TXD 17
define U_CFG_APP_PIN_CELL_RXD 16

Also, it looks like below, I set "cell uart" to 1, but I guess I should set it to -1 like other pins, too? not sure what it does...
define U_CFG_APP_CELL_UART 1

Thanks,
MoZen

[GNSS Module] Streaming Position Processing

The GNSS module provides a mechanism to poll the GNSS for its current location and to get a call back when the that location has been received. However it does not seem to support a mechanism to process and store points if they are being sent by the GNSS not as a response to a poll. This would be a helpful feature!

Speed up module power on.

Hi

its not a bug but a possible improvement in the module power up sequence.

I think it is not necessary to check if the module is alive if the Vint pin is assigned and returns a OFF_STATE.
Otherwise moduleIsAlive() will run into a timeout in any case. This delays the power on by 5 seconds in the case of the SARA-R510.

This has an influence especially if the module is not switched on permanently and changes to PSM between transmissions.

here the mentioned condition:

if (((pInstance->pinVInt >= 0) &&
(uPortGpioGet(pInstance->pinVInt) == U_CELL_VINT_PIN_ON_STATE)) ||
(moduleIsAlive(pInstance, 1) == 0)) {

Streaming GNSS, offloading processing to Sara

Hi Rob/Andreas,

I am using Sara with GNSS; I see your GNSS library code does not use the in built features of the SARA with regards to off-loading work from our CPU to the Sara; I think the Sara supports commands where you just say give me a GNSS location every x seconds; this is done with just a single AT command; after which Sara just starts streaming results as and when.

Looking at the 0.9.1 libraries it looks like various mutex's are created and a task spawned to go and get the GNSS. Are you looking at a feature to use the Sara to do the work for us rather that push the work onto our host processor?

All the best,
Owain

STM32 Project only builds Unity

So far as I can tell, importing the STM32 project only seems to grab the Unity project, following the procedures from the previous directory.

What I did (which I think matches the guides) was to:

  1. Grab the build package for STM32F series as linked, version 1.25
  2. Create a directory and clone ubxlib into it
  3. Copy the build package into the same folder, renaming it STM32Cube_FW_F4
  4. Open STM32CubeIde, using the same directory as ubxlib and tools as the workspace. Then import the runner project (only project available)
  5. Click "RUN"

This then fails since Unity isn't installed. Examining the sources, only the Unity running is included in the project as a "main" file.

image

U_CELL_NET: unable to disconnect.

What could be the reason for the fact that the connection is unable to disconnect?

U_CELL_MQTT: trying to disconnect...
AT+UMQTTC=0

+UMQTTC: 0,1

OK
Taking down network...
AT+COPS?

+COPS: 0,0,"262 01 1nce.net",9

OK
AT+CFUN=4

OK
AT+CREG?

+CREG: 2,3

OK
0: Deny
AT+CGREG?

+CGREG: 2,4

OK
0: OoC
AT+CEREG?

+CEREG: 4,5,"DAD9","10","22A9B06",B,,,"00000000","01100000"

OK
0: RegR
AT+CREG?

+CREG: 2,3

OK
0: Deny
AT+CGREG?

+CGREG: 2,4

OK
0: OoC
AT+CEREG?

+CEREG: 4,5,"DAD9","10","22A9B06",B,,,"00000000","01100000"

OK
0: RegR
AT+CREG?

+CREG: 2,3

OK
0: Deny
AT+CGREG?

+CGREG: 2,4

OK
0: OoC
AT+CEREG?

+CEREG: 4,5,"DAD9","10","22A9B06",B,,,"00000000","01100000"

OK
0: RegR
AT+CREG?

+CREG: 2,3

OK
0: Deny
AT+CGREG?

+CGREG: 2,4

OK
0: OoC
AT+CEREG?

+CEREG: 4,5,"DAD9","10","22A9B06",B,,,"00000000","01100000"

OK
0: RegR
AT+CREG?

+CREG: 2,3

OK
0: Deny
AT+CGREG?

+CGREG: 2,4

OK
0: OoC
AT+CEREG?

+CEREG: 4,5,"DAD9","10","22A9B06",B,,,"00000000","01100000"

OK
0: RegR
AT+CREG?

+CREG: 2,3

OK
0: Deny
AT+CGREG?

+CGREG: 2,4

OK
0: OoC
AT+CEREG?

+CEREG: 4,5,"DAD9","10","22A9B06",B,,,"00000000","01100000"

OK
0: RegR
AT+CREG?

+CREG: 2,3

OK
0: Deny
AT+CGREG?

+CGREG: 2,4

OK
0: OoC
AT+CEREG?

+CEREG: 4,5,"DAD9","10","22A9B06",B,,,"00000000","01100000"

OK
0: RegR
AT+CREG?

+CREG: 2,3

OK
0: Deny
AT+CGREG?

+CGREG: 2,4

OK
0: OoC
AT+CEREG?

+CEREG: 4,5,"DAD9","10","22A9B06",B,,,"00000000","01100000"

OK
0: RegR
AT+CREG?

+CREG: 2,3

OK
0: Deny
AT+CGREG?

+CGREG: 2,4

OK
0: OoC
AT+CEREG?

+CEREG: 4,5,"DAD9","10","22A9B06",B,,,"00000000","01100000"

OK
0: RegR
AT+CREG?

+CREG: 2,3

OK
0: Deny
AT+CGREG?

+CGREG: 2,4

OK
0: OoC
AT+CEREG?

+CEREG: 4,5,"DAD9","10","22A9B06",B,,,"00000000","01100000"

OK
0: RegR
U_CELL_NET: unable to disconnect.

SARA-R510S-01B NB1 support

Hi

Shouldn't U_CELL_NET_RAT_NB1 be added to the SARA_R5 RATs since the 01B version supports it?
Or a new module type for the SARA-R510S-01B version?

regards

Direct link mode support

I have had in mind a cellular API for a long time and it has been a real pleasure to find this library. Thank you very much for your amazing work.

Are you planning to include the "direct link" mode in the library?

In order to obtain the maximum throughput of the modem, I was thinking myself in migrating from AT commands to write/read to "direct link" mode. It's a pity because I would also like to migrate to your lib implementation. Is there a reason it is not implemented?

CME Error: memory full when using MQTT

So I've just gotten started using the MQTT client on the ESP32 with the SARA-R510M8S and I seem to be running into 'memory full' issues on the radio. This causes incoming messages to be delayed, and sometimes causes outgoing messages to fail. For reference, I'm using MQTT over TLS to try to connect to AWS IoT.

I'm not doing anything else with the radio (I was calling uGnssPosGet over and over in another thread to get a constant position, which is my end goal, but even commenting that out and just triggering this publish to occur over the command line with dummy data still causes this issue).

Any thoughts on what might be the issue / what might fix it? Some logs are below.
Memory full on receive:

AT+UMQTTC=9,1,0,"$aws/things/sara-tracker/shadow/update",100
>{"state":{"reported":{"gnss":{"latitude":12.345600,"longitude":-23.448000}}},"clientToken":"000001"}
OK

+UUMQTTC: 9,1

+UUMQTTC: 6,1
The broker says there are 1 message(s) unread.
I (51955) SHADOW: Published!

AT+UMQTTC=6,1

+CME ERROR: memory full
AT+UMQTTER

+UMQTTER: 13,0

OK
U_CELL_MQTT: error codes 13, 0.
AT+UMQTTC=6,1

+CME ERROR: memory full
AT+UMQTTER

+UMQTTER: 13,0

OK
U_CELL_MQTT: error codes 13, 0.
AT+UMQTTC=6,1

+CME ERROR: memory full
AT+UMQTTER

+UMQTTER: 13,0

OK
U_CELL_MQTT: error codes 13, 0.
AT+UMQTTC=6,1

+UMQTTC: 6,1,286,47,"$aws/things/sara-tracker/shadow/update/accepted",239,"{"state":{"reported":{"gnss":{"latitude":12.3456,"longitude":-23.448}}},"metadata":{"reported":{"gnss":{"latitude":{"timestamp":1639522422},"longitude":{"timestamp":1639522422}}}},"version":44,"timestamp":1639522422,"clientToken":"000001"}"

OK
I (54455) SHADOW: Got message from topic $aws/things/sara-tracker/shadow/update/accepted: {"state":{"reported":{"gnss":{"latitude":12.3456,"longitude":-23.448}}},"metadata":{"reported":{"gnss":{"latitude":{"timestamp":1639522422},"longitude":{"timestamp":1639522422}}}},"version":44,"timestamp":1639522422,"clientToken":"000001"}

Memory full on send:

AT+UMQTTC=9,1,0,"$aws/things/sara-tracker/shadow/update",100
+CME ERROR: memory full
AT+UMQTTER

+UMQTTER: 13,0

OK
U_CELL_MQTT: error codes 13, 0.
W (170145) SHADOW: Unable to publish our message "{"state":{"reported":{"gnss":{"latitude":12.345600,"longitude":-23.448000}}},"clientToken":"000006"}"!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.