Skip to content

Commit

Permalink
Sensor Aggregation Use Case v0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
ubx-dich committed Jul 22, 2022
1 parent 7b69a7b commit e47b540
Show file tree
Hide file tree
Showing 44 changed files with 87,630 additions and 39 deletions.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ target_include_directories(app PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/ublox_mod
target_include_directories(app PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/ublox_modules/cell)
target_include_directories(app PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/ublox_modules/wifi)
target_include_directories(app PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/ublox_modules/position)
target_include_directories(app PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/ublox_modules/ble)
target_include_directories(app PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/ublox_modules/nfc)
target_include_directories(app PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/sensors)
target_include_directories(app PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/data_handle)
target_include_directories(app PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/buttons_leds)
Expand All @@ -37,6 +39,8 @@ FILE(GLOB ublox_modules_sources src/ublox_modules/*.c)
FILE(GLOB ublox_modules_cell_sources src/ublox_modules/cell/*.c)
FILE(GLOB ublox_modules_wifi_sources src/ublox_modules/wifi/*.c)
FILE(GLOB ublox_modules_position_sources src/ublox_modules/position/*.c)
FILE(GLOB ublox_modules_ble_sources src/ublox_modules/ble/*.c)
FILE(GLOB ublox_modules_nfc_sources src/ublox_modules/nfc/*.c)
FILE(GLOB data_handle_sources src/data_handle/*.c)
FILE(GLOB buttons_leds_sources src/buttons_leds/*.c)
FILE(GLOB system_sources src/system/*.c)
Expand All @@ -49,6 +53,8 @@ target_sources(app PRIVATE ${ublox_modules_sources})
target_sources(app PRIVATE ${ublox_modules_cell_sources})
target_sources(app PRIVATE ${ublox_modules_wifi_sources})
target_sources(app PRIVATE ${ublox_modules_position_sources})
target_sources(app PRIVATE ${ublox_modules_ble_sources})
target_sources(app PRIVATE ${ublox_modules_nfc_sources})
target_sources(app PRIVATE ${data_handle_sources})
target_sources(app PRIVATE ${buttons_leds_sources})
target_sources(app PRIVATE ${system_sources})
Expand Down
40 changes: 31 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# XPLR-IOT-1-software
This project is intented to be used with the XPLR-IOT-1 device from u-blox. Sensor Aggregation use case v0.2 is compatible with XPLR-IOT-1-00 (PCB Rev B version). More information about XPLR-IOT-1 hardware etc. can be found in the following link: [XPLR-IOT-1 quick start guide](https://developer.thingstream.io/guides/iot-communication-as-a-service/hardware/xplr-iot-1-quick-start-guide)
This project is intented to be used with the XPLR-IOT-1 device from u-blox. Sensor Aggregation use case v0.3 is compatible with XPLR-IOT-1-00 (PCB Rev B version). More information about XPLR-IOT-1 hardware etc. can be found in the following link: [XPLR-IOT-1 quick start guide](https://developer.thingstream.io/guides/iot-communication-as-a-service/hardware/xplr-iot-1-quick-start-guide)

XPLR-IOT-1 comes pre-flashed with the Sensor Aggregation Firmware (v0.2) along with a Serial Bootloader that allows firmware on the device to be updated without the need of a debugger/programmer.
XPLR-IOT-1 comes pre-flashed with the Sensor Aggregation Firmware (v0.3) along with a Serial Bootloader that allows firmware on the device to be updated without the need of a debugger/programmer.

This project contains the Sensor Aggregation Use Case example for XPLR-IOT-1 and future updates of this application will be uploaded here.

Expand Down Expand Up @@ -31,7 +31,12 @@ The main features of the application are:
* 5. Allow handling of [ublox modules](./src/ublox_modules) via s-center, m-center, u-center by configuring their UARTs properly. Power up/down u-blox modules.
* 6. Control Log messages

The messages sent to Thingstream are compatible with pre-built flows which allow the use of user-hosted dashboard examples using Node Red
The messages sent to Thingstream are compatible with pre-built flows which allow the use of user-hosted dashboard examples using Node Red.

Secondary features of the application:
* XPLR-IOT-1 can be scanned by an NFC-enabled device (mobile phone/tablet). Details [here](./src/ublox_modules/nfc/).
* XPLR-IOT-1 imeplements BLE functionality for testing purposes. Details [here](./src/ublox_modules/ble/).


More information on the functionality is provided in Readmes at the respective [source code](./src) folders

Expand All @@ -41,6 +46,8 @@ The XPLR-IOT-1 comes pre-programmed with the Sensor Aggregation firmware along w

The example is build using **nRF Connect SDK version 1.7.0** and is advised to use this version to build the project in this repository.

Compiled images of the project can be found in the [tools_and_compiled_images](./tools_and_compiled_images/) folder.

### Building the firmware
The firmware is based on Nordic’s nRF Connect SDK in a Zephyr RTOS environment. To be able to build it nRF Connect SDK should be installed in your PC (this will also install some necessary tools such as west).

Expand Down Expand Up @@ -72,21 +79,34 @@ XPLR-IOT-1 can be programmed using a J-Link debugger. There are various options

![vscode_flash should be here.](/readme_images/vscode_flash.png "VS Code Flash")

2. If you have [nrfjprog tools](https://www.nordicsemi.com/Products/Development-tools/nRF-Command-Line-Tools) installed, you can use commands in a command line to program the device:
2. If you have [nrfjprog tools](https://www.nordicsemi.com/Products/Development-tools/nRF-Command-Line-Tools) installed, you can use commands in a command line to program the device (in case only App Core is used):
```
nrfjprog --eraseall
nrfjprog --program zephyr.hex --coprocessor CP_APPLICATION (where **zephyr.hex** is the appropriate hex file and also contains the filepath if necessary)
nrfjprog –reset
```
3. The device can be programmed using [Nordic’s nRF Connect for Desktop](https://www.nordicsemi.com/Products/Development-tools/nRF-Connect-for-desktop) and more specifically the *Programmer app*. The device should be reset after programming.
3. If Net Core is also used (like in this application), the procedure is a bit more complex:
```
nrfjprog --recover --coprocessor CP_NETWORK
nrfjprog --eraseall --coprocessor CP_NETWORK
nrfjprog --eraseall --coprocessor CP_APPLICATION
nrfjprog --recover --coprocessor CP_NETWORK
nrfjprog --program net_core.hex --coprocessor CP_NETWORK
nrfjprog --program app_core.hex --coprocessor CP_APPLICATION
nrfjprog --reset
```

![nrf connect programmer should be here.](/readme_images/nrfConnect_programmer.png "nrf connect programmer")
4. The device can be programmed using [Nordic’s nRF Connect for Desktop](https://www.nordicsemi.com/Products/Development-tools/nRF-Connect-for-desktop) and more specifically the *Programmer app*. The device should be reset after programming.

> **NOTE:** Some early units have a misalignment between the SWD connector, J11, and the end panel. If a misalignment is observed, open the case, and move the end-panel so the opening is centered around J11 prior to connecting an SWD cable.
![nrf connect programmer should be here.](/readme_images/nrfConnect_programmer.png "nrf connect programmer")

### Programming the firmware using the Serial Bootloader
XPLR-IOT-1 comes pre-flashed with a Serial Bootloader. This allows the device to be updated without the need of a programmer/debugger. If you erase the device, you need to re-program the bootloader in order to be able to use it (see [here](./compile_options/bootloader_inclusion))

To easily update the device using pre-compiled images, you can run the batch file in the [tools_and_compiled_images](./tools_and_compiled_images/) folder, following the instructions given in the same folder.

##### If you don't want to run the batch script:

In order to update the device using the Serial Bootloader it must be compiled using option 2 [compile an updateable image](./compile_options/updateable_image) from compile options.

- In order to update the firmware:
Expand All @@ -101,15 +121,17 @@ The Serial Interface to be used is interface 0. Please find the correct COM port
![usbhub.png should be here.](./readme_images/usbhub.png "usbhub.png")


In order to send the necessary command for update you need newtmgr.exe (find it in the [tools](./tools) folder):
In order to send the necessary commands for update you need newtmgr.exe (find it in the [tools_and_compiled_images](./tools_and_compiled_images/) folder):
```
newtmgr.exe --conntype serial --connstring "COM8,baud=115200" image upload signed_by_b0_app.bin
newtmgr.exe --conntype serial --connstring "COM8,baud=115200" image upload app_update.bin
```
Then reset the device or use the command:
```
nrfjprog --reset
```
**Side Note:** This application currently makes use of the APPLICATION core of NORA-B1 in XPLR-IOT-1. If you want to program the NET core also, you can use a similar command like the one provided here (using the appropriate file). In this case when you have NET core and APPLICATION core updates, please program the NET core first, then the APPLICATION core using two separate commands, and then reset the device.
**Side Note:** This application currently uses both the APPLICATION and NET core of NORA-B1 in XPLR-IOT-1. In this case, please program the NET core first, then the APPLICATION core using two separate commands as described above, and then reset the device. If only the application core is used (e.g. you do not use BLE) then the first command to update the net core is not needed.
About the file names used in the commands above, see [here](./compile_options/updateable_image/). Off course the filenames can be anything.


## Disclaimer
Expand Down
12 changes: 12 additions & 0 deletions Release Notes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
v0.3 -- 20/07/2022
- Added BLE basic functionality for Testing with NUS service.
- Added NFC basic functionality for testing.
- Added Serial Com Selection command for NINA-W156 module
- Bug Fix: SARA-R5 remains always on. Proper Handling of SARA pins
- Bug Fix: NINA-W156 proper handling of pins.
- Bug Fix: Fixed an issue in BME280 set_period command



v0.2
- Initial Release of Sensor Aggregation Use Case
6 changes: 3 additions & 3 deletions compile_options/Readme.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Compile options description
This folder contains three sub-folders with the necessary files and scripts to modify the project for three build scenarios. The scripts only work in Windows, however they perform simple copy/overwrite/delete file functions, so it is easy to modify the project in other operating systems as well. Bash scripts which perform the same operations will be added soon. More information is given within each folder:
1. Build the project as a simple image [(simple hex)](./simple_hex). This is the simplest form of build and contains nothing but the application firmware alone. This image can be used to program the device directly, using a J-Link debugger. It does not contain a bootloader. It cannot be used with a bootloader to update the device.
1. Build the project as a simple image [(simple hex)](./simple_hex). This is the simplest form of build and contains nothing but the application firmware alone. After compilation the device can be programmed directly, using a J-Link debugger. It does not contain a bootloader. It cannot be used with a bootloader to update the device.

1. Build an [updateable image](./updateable_image). This image can be used to update the firmware of the device using the Serial Bootloader. If programmed alone to a device without the bootloader it won’t be able to start.

1. Build an image that contains both the bootloader and the Sensor Aggregation application firmware [(bootloader inclusion)](./bootloader_inclusion). This image can be programmed in the device using a JLink debugger. After that the device can be updated using the Serial Bootloader with updateable images.

XPLR-IOT-1 comes with a Serial Bootloader pre-programmed, so **if you do not have a J-Link**, please choose option 2, and update the device using the Serial Bootloader. Instruction on using the bootloader can be found [here](../Readme.md) and more detailed instructions can be found [here](./bootloader_inclusion).
XPLR-IOT-1 comes with a Serial Bootloader pre-programmed, so **if you do not have a J-Link**, please choose option 2, and update the device using the Serial Bootloader. Instructions on using the bootloader can be found [here](../Readme.md) and more detailed instructions can be found [here](./bootloader_inclusion).

**If you have a J-Link** you can use option 1 to program the application firmware, or option 2 if you want to include a Serial Bootloader along with the application.
**If you have a J-Link** you can use option 1 to program the application firmware, or option 2 if you want to include a Serial Bootloader along with the application.
6 changes: 5 additions & 1 deletion compile_options/bootloader_inclusion/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ The script file in this folder:

Just run the script and build the project.

This allows the build of an application image that also contains the bootloader. After you build the project you can navigate to your build folder, and find the **build/zephyr/merged_domains.hex** file created. This is the hex file you can use to program your device with a J-Link programmer.
This allows the build of an application image that also contains the bootloader. After you build the project you can navigate to your build folder, and find the **build/zephyr/merged_domains.hex** file created. This is the hex file you can use to program your device with a J-Link programmer via the nRF Connect-> Programmer application.

**Note**: If you want to use nrfjprog commands, instead of the nRF Connect -> Programmer application, different files are needed from the build folder, since you need to program each core separately.

The compiled image from this build configuration can be found [here](./tools_and_compiled_images/hex_files/SensorAggregation_v0.3_Bootloader_MergedCores.hex)

## Bootloader Information

Expand Down
31 changes: 28 additions & 3 deletions compile_options/bootloader_inclusion/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ CONFIG_SHELL_CMDS=n
CONFIG_KERNEL_SHELL=n
CONFIG_DEVICE_SHELL=n
CONFIG_DEVMEM_SHELL=n
CONFIG_FLASH_SHELL=n
CONFIG_PWM_SHELL=n
CONFIG_CLOCK_CONTROL_NRF_SHELL=n
CONFIG_I2C_SHELL=n
#cool sensor reading for dedicated sensor but some peripheral
Expand All @@ -66,9 +68,20 @@ CONFIG_FILE_SYSTEM=y
CONFIG_FILE_SYSTEM_LITTLEFS=y


# --- NFC Configuration ------
CONFIG_NFC_T2T_NRFXLIB=y
CONFIG_NFC_NDEF=y
CONFIG_NFC_NDEF_MSG=y
CONFIG_NFC_NDEF_RECORD=y
CONFIG_NFC_NDEF_URI_MSG=y
CONFIG_NFC_NDEF_URI_REC=y



###########################################
# --- used by ubxlib ---


CONFIG_DEBUG=y
CONFIG_MINIMAL_LIBC=n
# This is the memory used by the porting layer
Expand Down Expand Up @@ -125,11 +138,23 @@ CONFIG_OPENOCD_SUPPORT=y




###########################################
# --- Build Bootloader Configuration ---
# --- Bluetooth ---

CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEVICE_NAME="XPLR_IOT_1"
CONFIG_BT_DEVICE_APPEARANCE=833
CONFIG_BT_MAX_CONN=1
CONFIG_BT_MAX_PAIRED=1

# Enable the NUS service
CONFIG_BT_NUS=y



###########################################
# --- Build Bootloader Configuration ---

# Enabling MCUBoot bootloader
CONFIG_MCUMGR=y
Expand All @@ -156,4 +181,4 @@ CONFIG_LOG=y
CONFIG_FLASH_NOP_DEVICE=y

CONFIG_MCUMGR_GRP_ZEPHYR_BASIC=y
CONFIG_MCUMGR_GRP_BASIC_CMD_STORAGE_ERASE=y
CONFIG_MCUMGR_GRP_BASIC_CMD_STORAGE_ERASE=y
6 changes: 5 additions & 1 deletion compile_options/simple_hex/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,8 @@ The script file in this folder:

Just run the script and build the project.

This allows the build of a simple application image. After you build the project you can navigate to your build folder, and find the *build/zephyr/zephyr.hex* file created. This is the hex file you can use to program your device with the application.
This allows the build of a simple application image. After you build the project you can navigate to your build folder, and find the *build/zephyr/merged_domains.hex* file created. This is the hex file you can use to program your device with the application, using a J-Link and the nRF Connect -> Programmer application.

**Note**: If you want to use nrfjprog commands, instead of the nRF Connect -> Programmer application, different files are needed from the build folder, since you need to program each core separately.

The compiled image from this build configuration can be found [here](./tools_and_compiled_images/hex_files/SensorAggregation_v0.3_MergedCores.hex).
27 changes: 26 additions & 1 deletion compile_options/simple_hex/prj.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# --- Zephyr configuration ---
CONFIG_MAX_THREAD_BYTES=4
CONFIG_MAX_THREAD_BYTES=5

# --- Sensor configuration ---
CONFIG_SENSOR=y
Expand Down Expand Up @@ -65,6 +65,16 @@ CONFIG_FILE_SYSTEM=y
CONFIG_FILE_SYSTEM_LITTLEFS=y


# --- NFC Configuration ------
CONFIG_NFC_T2T_NRFXLIB=y
CONFIG_NFC_NDEF=y
CONFIG_NFC_NDEF_MSG=y
CONFIG_NFC_NDEF_RECORD=y
CONFIG_NFC_NDEF_URI_MSG=y
CONFIG_NFC_NDEF_URI_REC=y



###########################################
# --- used by ubxlib ---

Expand Down Expand Up @@ -122,3 +132,18 @@ CONFIG_LOG_BACKEND_UART=n

# Enable debug thread info
CONFIG_OPENOCD_SUPPORT=y



###########################################
# --- Bluetooth ---

CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEVICE_NAME="XPLR_IOT_1"
CONFIG_BT_DEVICE_APPEARANCE=833
CONFIG_BT_MAX_CONN=1
CONFIG_BT_MAX_PAIRED=1

# Enable the NUS service
CONFIG_BT_NUS=y
6 changes: 5 additions & 1 deletion compile_options/updateable_image/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@ The script file in this folder:

Just run the script and build the project.

This allows the build of an updateable application image. After you build the project you can navigate to your build folder, and find the **build/zephyr/app_update.bin** file created. This is the bin file you can use to update your device's firmware using the serial bootloader.
This allows the build of an updateable application image. After you build the project you can navigate to your build folder, and find the:
* **build/hci_rpmsg/zephyr/signed_by_b0_app.bin** file created. This file contains the updateable image for the Net Core of NORA-B1.
* **build/zephyr/app_update.bin** file created. This file contains the updateable image for the Application Core of NORA-B1.

In order to use them **FIRST update the Net Core and THEN the Application Core** using the newtmgr.exe tool in [tools_and_compiled_images](./tools_and_compiled_images/) folder (check the batch script file in that folder to see how you can update your device. The bin files in that folder are the same mentioned here, they are just renamed).
25 changes: 25 additions & 0 deletions compile_options/updateable_image/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,16 @@ CONFIG_FILE_SYSTEM=y
CONFIG_FILE_SYSTEM_LITTLEFS=y


# --- NFC Configuration ------
CONFIG_NFC_T2T_NRFXLIB=y
CONFIG_NFC_NDEF=y
CONFIG_NFC_NDEF_MSG=y
CONFIG_NFC_NDEF_RECORD=y
CONFIG_NFC_NDEF_URI_MSG=y
CONFIG_NFC_NDEF_URI_REC=y



###########################################
# --- used by ubxlib ---

Expand Down Expand Up @@ -125,3 +135,18 @@ CONFIG_LOG_BACKEND_UART=n

# Enable debug thread info
CONFIG_OPENOCD_SUPPORT=y



###########################################
# --- Bluetooth ---

CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEVICE_NAME="XPLR_IOT_1"
CONFIG_BT_DEVICE_APPEARANCE=833
CONFIG_BT_MAX_CONN=1
CONFIG_BT_MAX_PAIRED=1

# Enable the NUS service
CONFIG_BT_NUS=y
27 changes: 26 additions & 1 deletion prj.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# --- Zephyr configuration ---
CONFIG_MAX_THREAD_BYTES=4
CONFIG_MAX_THREAD_BYTES=5

# --- Sensor configuration ---
CONFIG_SENSOR=y
Expand Down Expand Up @@ -65,6 +65,16 @@ CONFIG_FILE_SYSTEM=y
CONFIG_FILE_SYSTEM_LITTLEFS=y


# --- NFC Configuration ------
CONFIG_NFC_T2T_NRFXLIB=y
CONFIG_NFC_NDEF=y
CONFIG_NFC_NDEF_MSG=y
CONFIG_NFC_NDEF_RECORD=y
CONFIG_NFC_NDEF_URI_MSG=y
CONFIG_NFC_NDEF_URI_REC=y



###########################################
# --- used by ubxlib ---

Expand Down Expand Up @@ -122,3 +132,18 @@ CONFIG_LOG_BACKEND_UART=n

# Enable debug thread info
CONFIG_OPENOCD_SUPPORT=y



###########################################
# --- Bluetooth ---

CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEVICE_NAME="XPLR_IOT_1"
CONFIG_BT_DEVICE_APPEARANCE=833
CONFIG_BT_MAX_CONN=1
CONFIG_BT_MAX_PAIRED=1

# Enable the NUS service
CONFIG_BT_NUS=y
Binary file added readme_images/NUS_rx_console_output.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added readme_images/NrfConnectDisconnect.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added readme_images/NrfConnectNUS_RxSelect.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added readme_images/NrfConnectScanConnect.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added readme_images/NrfConnectSendMessage.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit e47b540

Please sign in to comment.