-
-
Notifications
You must be signed in to change notification settings - Fork 206
Start Developing
NOTE
We recomment to enable the
Format On Save
option in VS Code to runastyle
automatically.
NOTE
We do not support other versions than KiCad 8!
You need to download and install the following tools for the build environment:
git clone https://github.com/jakkra/ZSWatch.git
cd ZSWatch
git submodule update --init --recursive
cd app
west init -l .
west update
There are two approaches to deal with Zephyr based projects:
- Using the nRF Connect extension for VSCode (Recommended)
- Using the command line
To be able to build, flash and debug via Visual Studio Code please install nRF Connect for VS Code Extension Pack. Here you can also find a manual on how to deal with the nRF Connect extension.
For full instructions see here, watch the video: https://www.nordicsemi.com/Products/Development-software/nRF-Connect-SDK/GetStarted#infotabs
Don't forget installng the toolchain in the VSCode nRF Conncet Plugin as shown in the video.
- Open the ZSWatch root folder in Visual Studio Code, the nRF Connect plugin will then automatically detect the app and it should show under
Applications
in the plugin. - Under this application press
Create new build configuration
- Select
All boards
and search forzswatch_nrf5340_cpuapp
- Set the field
revision
to4
etc. depending on what version of ZSWatch is used. - Press
Add fragment
and choosedebug.conf
for development otherwise userelease.conf
. - Press
Build Configuration
- You should now see the build, debug etc. buttons.
TIPP
You can use the
Erase and Flash to Board
option of the nRF Connect plugin next to theFlash
option to speed up the programming process. This will decrease the time needed for the flash erase from ~32 s to 0.5 s.
- Set the field
revision
inzswatch_nrf5340_cpuapp@<revision>
to1
or3
depending on what version of ZSWatch is used
NOTE
If your watch is built before Aug. 1 2023 it's revision
1
, otherwise revision3
or higher.
- Replace
release.conf
withdebug.conf
if the build is for development.
Example of building for ZSWatch board:
west build app -p -b zswatch_nrf5340_cpuapp@5 -- -DOVERLAY_CONFIG=boards/release.conf -DBOARD_ROOT=${PWD}/app
west flash
To use the air quality features of the BME688 the Bosch BSEC2 binaries needs to be downloaded, this is optional. By downloading (running below commands) you approve this License.
west config manifest.group-filter +bsec2
west update
To enable the feature build with boards/bsec.conf
by adding it to the "Build Configuration" in VSCode plugin or on command line by appending -DEXTRA_CONF_FILE="boards/bsec.conf"
Many images and icons are placed in external flash and not uploaded when flashing the watch. To upload the image resources into the external flash following needs to be done.
- Open VSCode
-
Ctrl
+shift
+P
- Run task
Upload Raw FS
- Or run
west upload_fs
from command line.
Depending on preference and available hardware, three options can be chosen:
This option applicable if you host computer hardware have build-in bluetooth module and your host machine is Linux. This option does not require any hardware at all sine Zephyr support BlueZ(details) and also can emulate display peripheral.
The Display driver
emulator need to be installed (Learn more about nativ_posix peripherals):
sudo apt-get install pkg-config libsdl2-dev:i386
export PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig
To execute ZSWatch application on native posix fist make sure that you have required version of linux kernel and BlueZ.
Find a HCI index on your host using: sudo hcitool dev
this is needed later. Usually hci0
for internal and hci1
fo external HCI.
To build ZSWatch application for native posix simply run:
cd <ZSWatch path>/app
west build -b native_posix
sudo btmgmt --index <hci index> power off
sudo ./build/zephyr/zephyr.exe --bt-dev=hci<hci_index>
If you want to be able to debug:
sudo gdb -ex=r --args build/zephyr/zephyr.exe --bt-dev=hci<hci index>
or add below in your .vscode/launch.json
. Make sure the path to zephyr.exe
matches your build folder name for native_posix
build.
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug Native Posix",
"type": "gdb",
"request": "launch",
"target": "${workspaceFolder}/build/zephyr/zephyr.exe",
"cwd": "${workspaceRoot}",
"valuesFormatting": "parseText",
"arguments": "--bt-dev=hci0" // Fill in hciX
}
]
}
In case there is no built-in Bluetooth module on the host computer, an external nRF dev kit can be used as a BLE module. In fact, any external BLE module that supports the HCI interface can be used. In doing so, the application will run on the host machine and communicate with BLE controller over hci_usb/hci_uart depending on the hardware you have.
Compile and flash the zephyr/samples/bluetooth/hci_usb application with following additions to prj.conf:
CONFIG_BT_EXT_ADV=y
CONFIG_BT_PER_ADV=y
CONFIG_BT_PER_ADV_SYNC=y
CONFIG_BT_PER_ADV_SYNC_MAX=2
NOTE
If hci_uart is used, a new HCI port must be attached, follow this guide. Alternatively in case of using hci_usb you don't need to attach new HCI port, just physically connect USB to nRF USB port.
Make sure that new hci device appear using:
sudo hcitool dev
Next follow the Preparation to install the Display driver
emulator and the Running ZSWatch app instruction to execute the application.
This is possible, what you need is a nRF5340-DK (or EVK-NORA-B1) and a breakout of the screen I use https://www.waveshare.com/1.28inch-touch-lcd.htm.
You may also add any of the sensors on the ZSWatch, Sparkfun for example have them all:
When using the nRF5340-DK all you need to do is to replace zswatch_nrf5340_cpuapp
with nrf5340dk_nrf5340_cpuapp
as the board in the compiling instructions above. You may also need to tweak the pin assignment in app/boards/nrf5340dk_nrf5340_cpuapp.overlay for your needs.
Visit ZSWatch WebDashboard to connect and view sensor data in a browser that supports Web Bluetooth (Source code).