Skip to content

Commit

Permalink
Code Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
shaheerafatimakhan committed Apr 4, 2023
1 parent 8019d03 commit a15ff0e
Show file tree
Hide file tree
Showing 726 changed files with 316 additions and 420 deletions.
2 changes: 1 addition & 1 deletion celllocate-wifi-example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

cmake_minimum_required(VERSION 3.20.0)

list(APPEND ZEPHYR_EXTRA_MODULES ${CMAKE_CURRENT_SOURCE_DIR}/../ubxlib_priv)
list(APPEND ZEPHYR_EXTRA_MODULES ${CMAKE_CURRENT_SOURCE_DIR}/../ubxlib)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(celllocate_wifi_example)

Expand Down
26 changes: 17 additions & 9 deletions celllocate-wifi-example/README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
# XPLR-IOT-1-location-example

This project is intended to be used with XPLR-IOT-1 from u-blox to get a location using both Cell ID and Wi-Fi sniffing technology using the u-blox CellLocate service. The project contains the location example for XPLR-IOT-1 and future updates of this application will be uploaded here. It is assumed that XPLR-IOT-1 has a Serial Bootloader that allows firmware on the device to be updated without the need of a debugger/programmer.
This example is intended to be used with XPLR-IOT-1 from u-blox to get a location using both Cell ID and Wi-Fi sniffing technology using the u-blox CellLocate service. The example contains the location example for XPLR-IOT-1 and future updates of this application will be uploaded here. It is assumed that XPLR-IOT-1 has a Serial Bootloader that allows firmware on the device to be updated without the need of a debugger/programmer.

The main function of the code is to collect Cellular or Wi-Fi information and send it to CellLocate service to get back a location in response. The Wi-Fi module can be enabled/disabled in the configuration parameters in the code for the location calculation. The code uses ubxlib library as much as possible to implement the functionality.
The main function of the example is to collect Cellular or Wi-Fi information and send it to CellLocate service to get back a location in response. The Wi-Fi module can be enabled/disabled in the configuration parameters in the code for the location calculation. The example uses ubxlib library as much as possible to implement the functionality, and was tested and compiled with nRF Connect v1.7.0.

The code is compatible with:
The example is compatible with:
- NINA firmware version 5.0.0.
- SARA-R510S-01B release 03.15_ENG1301. Please contact [email protected] to get the firmware.
- Firmware upgrade procedure is available in this guide: https://www.u-blox.com/docs/UBX-21035674

To check the already installed firmware version on your module, use the following command:
- AT+CGMR

**Note:**
For SARA-R5, if the command returns the firmware version like "3.15, A00.01", please be informed that the installed firmware is different from the required firmware version i.e. 03.15_ENG1301.

Prerequisite and notes:
- to access to CellLocate service you need a valid token, that is the alphanumeric string generated by u-blox Thingstream service delivery platform; it is used by the device for service authentication. This guide explains how to generate it
- To access to CellLocate service you need a valid token, that is the alphanumeric string generated by u-blox Thingstream service delivery platform; it is used by the device for service authentication. This guide explains how to generate it
https://developer.thingstream.io/guides/location-services/tokens
- CellLocate service provide by default the estimated location back the XPLR-IOT kit; in addition you can get the estimated position directly to your cloud application using a Cloud to Cloud connection;
https://developer.thingstream.io/guides/location-services/celllocate-getting-started/location-in-the-cloud
Expand All @@ -22,25 +28,27 @@ https://developer.thingstream.io/guides/location-services/celllocate-getting-sta

2. Go to location *XPLR1-IOT-location-example/image_flashing*. The folder with contain a pre-build binary named **celllocate-wifi-example.bin** which can be directly flashed to the device.

3. If some tweaks are done in the firmware, build the code again.
3. If some tweaks are done in the firmware, build the code again. Instructions for building firmware can be found here: https://github.com/u-blox/XPLR-IOT-1-software#building--the-firmware.

4. Building the code will generate a binary file named as **app_update.bin** at the following location:
*XPLR1-IOT-location-example/celllocate-wifi-example/build/zephyr*

5. Rename the file from **app_update.bin** to **celllocate-wifi-example.bin** and copy it to the given location:
5. Copy the file **app_update.bin** to the given location:
*XPLR1-IOT-location-example/image_flashing*

6. Go to *XPLR1-IOT-location-example/image_flashing* folder.

7. Connect your XPLR-IOT-1 kit to your system and determine the COM port number for NORA-B1 on Interface 0 of the USB-UART interface.

8. Run *Update_XPLR-IOT-1-Location.bat* file and a pop-up window will appear input your comport as following:
8. Power cycle your XPLR-IOT-1 device while holding button 1 to enter the bootloader mode.

9. Run *Update_XPLR-IOT-1-Location.bat* file and a pop-up window will appear input your comport as following:

![Bat file pop-up](../imgs/bat.PNG?raw=true)

9. Input your comport, your binary file name and press enter. The process will start flashing **celllocate-wifi-example.bin** image file into your kit.
10. Input your comport, your binary file name and press enter. The process will start flashing your image file into your kit.

10. More details about the XPLR-IOT-1 bootloader can be found in the following link: [XPLR-IOT-1](https://github.com/u-blox/XPLR-IOT-1-software/tree/main/tools_and_compiled_images)
11. More details about the XPLR-IOT-1 bootloader can be found in the following link: [XPLR-IOT-1](https://github.com/u-blox/XPLR-IOT-1-software/tree/main/tools_and_compiled_images)


## Configuration for Cellular and Wi-Fi
Expand Down
103 changes: 0 additions & 103 deletions celllocate-wifi-example/nrf5340dk_nrf5340_cpuapp.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -54,59 +54,6 @@
};
};

&i2c1 {
compatible = "nordic,nrf-twim";
status = "okay";
sda-pin = < 35 >;
scl-pin = < 34 >;
clock-frequency = <I2C_BITRATE_STANDARD>;

bme280@76 {
compatible = "bosch,bme280";
reg = <0x76>;
label = "BME280";
};

adxl345@1D {
compatible = "adi,adxl345";
reg = <0x1D>;
label = "ADXL345";
};

lis3mdl@1E {
compatible = "st,lis3mdl-magn";
reg = <0x1E>;
label = "LIS3MDL";
};

fxas21002@20 {
compatible = "nxp,fxas21002";
reg = <0x20>;
label = "FXAS21002";
};

lis2dh@19 {
compatible = "st,lis2dh";
reg = <0x19>;
label = "LIS2DH";
};

ltr303: ltr303@29 {
compatible = "ltr,303als";
reg = <0x29>;
label = "LTR303";
};

bq27421@55 {
compatible = "ti,bq274xx";
label = "BQ274XX";
reg = <0x55>;
design-voltage = <3700>;
design-capacity = <1200>;
taper-current = <45>;
terminate-voltage = <3000>;
};
};

// console uart
&uart0 {
Expand Down Expand Up @@ -138,53 +85,3 @@
hw-flow-control;
};


// Buttons
&button0 {
gpios = <&gpio0 5 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
label = "Push button 1";
};

&button1 {
gpios = <&gpio0 28 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
label = "Push button 2";
};

//PWM for Led control brightness
&pwm0 {
status = "okay";
ch0-pin = <39>;
ch1-pin = <23>;
ch2-pin = <6>;
};

// Leds at PWM channels
/{
pwmleds {
compatible = "pwm-leds";

pwm_led0: pwm_led_0 {
pwms = <&pwm0 39>;
label = "Red Led";
};

pwm_led1: pwm_led_1 {
pwms = <&pwm0 23>;
label = "Green Led";
};

pwm_led2: pwm_led_2 {
pwms = <&pwm0 6>;
label = "Blue Led";
};

};


// aliases{
// red-led0 = &pwm_led0;
// blue-led1 = &pwm_led1;
// red-led2 = &pwm_led2;
// };

};
10 changes: 9 additions & 1 deletion celllocate-wifi-example/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,12 @@ CONFIG_BOOTLOADER_MCUBOOT=y

#Enable shell
CONFIG_SHELL=y
CONFIG_SHELL_STACK_SIZE=4096
CONFIG_SHELL_STACK_SIZE=4096
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
Loading

0 comments on commit a15ff0e

Please sign in to comment.