Comments (8)
Hi,
I'm sorry but Ubxlib currently doesn't support any BLE Gatt operations for open-cpu (internal) mode. The only thing available for now is the U-blox service SPS.
The example for the XPLR-IOT1 uses the BLE functionality of the connected Nina W15 and not the host Nora B1.
So I'm afraid the only option for you at this point is to implement this using the Zephyr apis. An example can be found here: https://github.com/junqingzou/Zephyr_NUS_Sample
BR
/Peter Lerup
from ubxlib.
Thanks for posting and sorry you're having trouble with this.
Do you have the debug log output from ubxlib
, as far as it gets, when this is run? I ask because, when it processes the device configuration it picks up from the device tree, it prints out a line beginning with U_PORT_BOARD_CFG
which tells you what it has done.
Thing is, though, the error code U_ERROR_COMMON_NOT_INITIALISED
sounds like it isn't even getting that far. If this is the error code returned by uDeviceOpen()
, it seems more likely that you are missing a conditional compilation flag somehow.
Could you post the output from a clean build so that we can see which files are being pulled in? Specifically, it would good to see the line "UBXLIB_FEATURES will be...
".
from ubxlib.
Hi Rob,
Thanks for your comments and help. I should have been more explicit in my initial message, the U_ERROR_COMMON_NOT_INITIALISED
is raised by the uNetworkInterfaceUp
call, not the uDeviceOpen
one; apologies for that!
Here is the output of a pristine build, which shows gnss
and short_range
features (just like I intended via a local environment variable):
* Executing task: nRF Connect: Build [pristine]: ubxlib_ble/build (active)
Building ubxlib_ble
west build --build-dir /home/mleroy/Documents/nrf_projects/ubxlib_ble/build /home/mleroy/Documents/nrf_projects/ubxlib_ble --pristine --board nrf52dk_nrf52832 --no-sysbuild -- -DNCS_TOOLCHAIN_VERSION=NONE -DCACHED_CONF_FILE=/home/mleroy/Documents/nrf_projects/ubxlib_ble/ubxlib/port/platform/zephyr/default.conf;/home/mleroy/Documents/nrf_projects/ubxlib_ble/prj.conf -DDTC_OVERLAY_FILE=/home/mleroy/Documents/nrf_projects/ubxlib_ble/nrf52dk_nrf52832.overlay
-- west build: generating a build system
Loading Zephyr default modules (Zephyr base).
-- Application: /home/mleroy/Documents/nrf_projects/ubxlib_ble
-- CMake version: 3.20.5
-- Found Python3: /home/mleroy/ncs/toolchains/7795df4459/usr/local/bin/python3.8 (found suitable version "3.8.2", minimum required is "3.8") found components: Interpreter
-- Cache files will be written to: /home/mleroy/.cache/zephyr
-- Zephyr version: 3.4.99 (/home/mleroy/ncs/v2.5.0/zephyr)
-- Found west (found suitable version "1.1.0", minimum required is "0.14.0")
-- Board: nrf52dk_nrf52832
-- Found host-tools: zephyr 0.16.1 (/home/mleroy/ncs/toolchains/7795df4459/opt/zephyr-sdk)
-- Found toolchain: zephyr 0.16.1 (/home/mleroy/ncs/toolchains/7795df4459/opt/zephyr-sdk)
-- Found Dtc: /home/mleroy/ncs/toolchains/7795df4459/usr/bin/dtc (found suitable version "1.4.7", minimum required is "1.4.6")
-- Found BOARD.dts: /home/mleroy/ncs/v2.5.0/zephyr/boards/arm/nrf52dk_nrf52832/nrf52dk_nrf52832.dts
-- Found devicetree overlay: /home/mleroy/Documents/nrf_projects/ubxlib_ble/nrf52dk_nrf52832.overlay
-- Generated zephyr.dts: /home/mleroy/Documents/nrf_projects/ubxlib_ble/build/zephyr/zephyr.dts
-- Generated devicetree_generated.h: /home/mleroy/Documents/nrf_projects/ubxlib_ble/build/zephyr/include/generated/devicetree_generated.h
-- Including generated dts.cmake file: /home/mleroy/Documents/nrf_projects/ubxlib_ble/build/zephyr/dts.cmake
Parsing /home/mleroy/ncs/v2.5.0/zephyr/Kconfig
Loaded configuration '/home/mleroy/ncs/v2.5.0/zephyr/boards/arm/nrf52dk_nrf52832/nrf52dk_nrf52832_defconfig'
Merged configuration '/home/mleroy/Documents/nrf_projects/ubxlib_ble/ubxlib/port/platform/zephyr/default.conf'
Merged configuration '/home/mleroy/Documents/nrf_projects/ubxlib_ble/prj.conf'
Configuration saved to '/home/mleroy/Documents/nrf_projects/ubxlib_ble/build/zephyr/.config'
Kconfig header saved to '/home/mleroy/Documents/nrf_projects/ubxlib_ble/build/zephyr/include/generated/autoconf.h'
-- Found GnuLd: /home/mleroy/ncs/toolchains/7795df4459/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd (found version "2.38")
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- The ASM compiler identification is GNU
-- Found assembler: /home/mleroy/ncs/toolchains/7795df4459/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
UBXLIB_FEATURES will be "gnss;short_range"
CMake Warning at /home/mleroy/ncs/v2.5.0/zephyr/CMakeLists.txt:1958 (message):
__ASSERT() statements are globally ENABLED
-- Configuring done
-- Generating done
-- Build files have been written to: /home/mleroy/Documents/nrf_projects/ubxlib_ble/build
-- west build: building application
[1/360] Preparing syscall dependency handling
[3/360] Generating include/generated/version.h
-- Zephyr version: 3.4.99 (/home/mleroy/ncs/v2.5.0/zephyr), build: v3.4.99-ncs1
[143/360] Building C object CMakeFiles/app.dir/ubxlib/port/platform/zephyr/src/u_port_board_cfg.c.obj
../ubxlib/port/platform/zephyr/src/u_port_board_cfg.c:837:26: warning: 'gpDeviceCfgWifiNetworkListApIpAddress' defined but not used [-Wunused-const-variable=]
837 | static const char *const gpDeviceCfgWifiNetworkListApIpAddress[][2] = {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../ubxlib/port/platform/zephyr/src/u_port_board_cfg.c:826:26: warning: 'gpDeviceCfgWifiNetworkListApPassPhrase' defined but not used [-Wunused-const-variable=]
826 | static const char *const gpDeviceCfgWifiNetworkListApPassPhrase[][2] = {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../ubxlib/port/platform/zephyr/src/u_port_board_cfg.c:815:22: warning: 'gDeviceCfgWifiNetworkListApAuthentication' defined but not used [-Wunused-const-variable=]
815 | static const int32_t gDeviceCfgWifiNetworkListApAuthentication[][2] = {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../ubxlib/port/platform/zephyr/src/u_port_board_cfg.c:804:26: warning: 'gpDeviceCfgWifiNetworkListApSsid' defined but not used [-Wunused-const-variable=]
804 | static const char *const gpDeviceCfgWifiNetworkListApSsid[][2] = {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../ubxlib/port/platform/zephyr/src/u_port_board_cfg.c:793:26: warning: 'gpDeviceCfgWifiNetworkListMode' defined but not used [-Wunused-const-variable=]
793 | static const char *const gpDeviceCfgWifiNetworkListMode[][2] = {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../ubxlib/port/platform/zephyr/src/u_port_board_cfg.c:779:26: warning: 'gpDeviceCfgWifiNetworkListHostName' defined but not used [-Wunused-const-variable=]
779 | static const char *const gpDeviceCfgWifiNetworkListHostName[][2] = {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../ubxlib/port/platform/zephyr/src/u_port_board_cfg.c:768:26: warning: 'gpDeviceCfgWifiNetworkListPassPhrase' defined but not used [-Wunused-const-variable=]
768 | static const char *const gpDeviceCfgWifiNetworkListPassPhrase[][2] = {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../ubxlib/port/platform/zephyr/src/u_port_board_cfg.c:757:22: warning: 'gDeviceCfgWifiNetworkListAuthentication' defined but not used [-Wunused-const-variable=]
757 | static const int32_t gDeviceCfgWifiNetworkListAuthentication[][2] = {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../ubxlib/port/platform/zephyr/src/u_port_board_cfg.c:746:26: warning: 'gpDeviceCfgWifiNetworkListSsid' defined but not used [-Wunused-const-variable=]
746 | static const char *const gpDeviceCfgWifiNetworkListSsid[][2] = {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[360/360] Linking C executable zephyr/zephyr.elf
Memory region Used Size Region Size %age Used
FLASH: 337480 B 512 KB 64.37%
RAM: 55968 B 64 KB 85.40%
IDT_LIST: 0 GB 2 KB 0.00%
* Terminal will be reused by tasks, press any key to close it.
In terms of console output, here it is when I comment the uPortLogOff
call in the main.c
I attached in my previous message:
*** Booting nRF Connect SDK v2.5.0 ***
Initiating the module...
U_PORT_BOARD_CFG: using SHORT-RANGE device "cfg-device-short-range" from the device tree, module-type 0, open-cpu.
Starting BLE...
U_PORT_BOARD_CFG: using BLE network configuration associated with SHORT-RANGE device "cfg-device-short-range" from the device tree, role 2.
* Failed to bring up the network: -2
Thanks again for your help!
from ubxlib.
Thanks for the swift response. Sorry about the warnings, we try to avoid conditional compilation flags inside ubxlib
but it is very much the Zephyr way and so in this particular case we end up with a combinatorial nightmare. Anyway...
As you say, you have UBXLIB_FEATURES
gnss
and short_range
, which seems right. The print from your main.c
"Starting BLE...
" is only emitted if uDeviceOpen()
returned 0, so that's good.
However: the second parameter to uNetworkInterfaceUp() should be the network type, which in this case would be U_NETWORK_TYPE_BLE (as opposed to the other possibility for a Short Range module which would be Wifi); you are calling it with U_BLE_CFG_ROLE_PERIPHERAL
instead, which will turn out to be a value of 2, which corresponds to network type U_NETWORK_TYPE_CELL
; that will indeed come back as not initialised since you don't have cellular in your build...?
from ubxlib.
No worries for the warnings, I know how difficult it is to handle aiming to support everything everywhere 😅
My understanding is that I was passing a network type as the second parameter, as per networkCfg.type
, which was defined as U_NETWORK_TYPE_BLE
in line 139 of my main file above. U_BLE_CFG_ROLE_PERIPHERAL
is in the role
attribute of uNetworkCfgBle_t, not the type
. This code was really just a stripped down version of the XPLR example, but with the device exclusively defined as a BLE peripheral.
Nevertheless, I've replaced the peripheral mention with a central one both in the main and overlay files (and the console properly showing now role 1
), but the failure remains.
I think it is more likely that the error stems from the device tree enclosed in my original message, but the BLE binding seems to be simple enough and I based my overlay file on the NINA-B3 one, specifically the cfg-device-short-range-1
which seems to be a BLE+Wifi chip. Therefore, that's why I am having a hard time figuring out what is causing the failure...
from ubxlib.
Apologies, I was getting role
and type
mixed up, let me look again...
from ubxlib.
Sure, thank you for your prompt reply!
Side note, as I wrote my message above it made me think that I could try adding a dummy Wifi phandle
, i.e. making the overlay file as follows:
/ {
cfg-device-short-range {
compatible = "u-blox,ubxlib-device-short-range";
status = "okay";
module-type = "U_SHORT_RANGE_MODULE_TYPE_INTERNAL";
open-cpu;
network = <&label_cfg_network_ble_peripheral &label_cfg_network_wifi_client_home>;
};
label_cfg_network_wifi_client_home: cfg_network_wifi_client_home {
compatible = "u-blox,ubxlib-network-wifi";
mode = "U_WIFI_MODE_NONE"; // valid according to https://github.com/u-blox/ubxlib/blob/v1.4.0/port/platform/zephyr/dts/bindings/u-blox%2Cubxlib-network-wifi.yaml#L36
};
label_cfg_network_ble_peripheral: cfg-network-ble-peripheral {
compatible = "u-blox,ubxlib-network-ble";
status = "okay";
role = "U_BLE_CFG_ROLE_PERIPHERAL";
};
};
and albeit the build warnings regarding the unused variables are gone, the failure remains.
from ubxlib.
Oh that's a shame, I thought and hoped it could work... So be it, I'll try with an alternative. Thank you both for your help!
from ubxlib.
Related Issues (20)
- esp idf i2c legacy driver issue HOT 5
- rewrite certificates after reboot HOT 2
- best way to combine device-tree interfaces with uDeviceCfg_t in zephyr HOT 3
- example to use token of location thing HOT 6
- Unable to start continuous location! HOT 11
- Compiling & building HOT 4
- Unable to create HTTP instance! HOT 11
- Build for STM32 CUBE HOT 4
- ESP32 Demo HOT 5
- Power consumption after calling uGnssPwrOff HOT 9
- Untethered Dead Reckoning and odometer use with cellular module integration HOT 22
- stm32u5 example hanging HOT 11
- Data Ready PIN HOT 15
- A good practice proposol HOT 2
- Cellular Callback for Signal Changes HOT 2
- Enable debug log HOT 3
- MQTT Clean Session Support for LARA-R6801D Module HOT 5
- Connecting NEO-6M to ESP32 HOT 3
- PlatformIO PackageException HOT 7
- Config baudrate for NEO-F10 GNSS module using uGnssCfgValSet() HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ubxlib.