Using nRF Connect for VSCode
Setup
-
Install nRF Connect for VSCode
-
Once the extension pack is installed. Install both the 2.7.0 Toolchain and the 2.7.0 SDK.
You can use the
nRF Connect : Manage Toolchains
command to do this.And the
nRF Connect : Install SDK
command to do this. -
Then clone the nRF9160 Feather Examples and Drivers to a good location:
git clone https://github.com/circuitdojo/nrf9160-feather-examples-and-drivers.git --branch v2.7.x
Note: this will allow you to use the most up-to-date board definitions for the nRF9151 Feather.
-
Then open the
nrf9160-feather-examples-and-drivers
folder in VSCode. nRF Connect for VSCode will automatically detect that this is a Zephyr Project. -
Finally, click
Manage west workspace
and clickSwitch West Manifest Repository
.Note, if you already have this folder open and this option is greyed out, you should be good to go!
-
Then select the
west.yml
in the directory you cloned the repository to:Note: if you do not see the correct option, you can click
Browse..
and navigate to thewest.yml
in thenfed
folder.
Selecting SDK
In the case you already have a nRF Connect SDK installed, you will need to make sure you selected the correct SDK.
-
Run
nRF Connect: Install SDK
command. -
Then choose version
2.7.0
: -
Then run the
nRF Connect: Set Active SDK
command:Note: be sure to select the SDK version you installed.
Building
-
Click the
Open Existing Application
button and choose, for example, thenrf9160-feather-examples-and-drivers/samples/blinky
folder. -
Then click the
Add Build Configuration
button.Make sure you choose
circuitdojo/nrf9151-feather/ns
as the board.Additionally, change the build directory if you'd like. We recommend
build/circuitdojo_feather_nrf9151
.And finally, make sure that
Use sysbuild
is checked.Then click
Build Configuration
-
The app will build. You can view the build output in the tab to the right:
Once you get this output, you're good to go!
[7/207] Generating include/generated/version.h -- Zephyr version: 3.6.99 (/home/jaredwolff/Git/nrf9160-feather-examples-and-driverszephyr), build: v3.6.99-ncs2 [207/207] Linking C executable zephyr/zephyr.elf Memory region Used Size Region Size %age Used FLASH: 46844 B 48 KB 95.30% RAM: 22720 B 32 KB 69.34% IDT_LIST: 0 GB 32 KB 0.00% Generating files from /home/jaredwolff/Git/nrf9160-feather-examples-and-drivers/nfed/samples/blinky/build/circuitdojo_feather_nrf9151/mcuboot/zephyr/zephyr.elf for board:circuitdojo_feather_nrf9151 [20/20] Generating ../merged.hex
Flashing
Note: we're working on ways to flash from the UI in VSCode. In the meantime, here's how to do it manually.
The nRF9151 Feather has a build-in CMSIS-DAP debugger. You can use it to flash the firmware. The two utilities that you can use are:
probe-rs
pyocd
probe-rs
Note: you will need to have rust
installed before you can install probe-rs
. See here for more info.
To install use:
cargo install probe-rs-tools --git https://github.com/probe-rs/probe-rs --rev 4a711751dd250ae232cb2668fedfa9678c47e4ab
Note: Make sure you use the revision indicateda above. There are multiple improvements which makes programming several seconds speedier than pyocd
Then you can program using:
cd samples/blinky
probe-rs download --chip nRF9160_xxAA --binary-format hex build/circuitdojo_feather_nrf9151/merged.hex --allow-erase-all
probe-rs reset --chip nRF9160_xxAA
Note: change location to the sample/application you're working on. This is where your build
folder is located.
pyocd
pyocd
does have some dependencies depending on your OS.
Mac Dependencies
For Mac you'll need to install libusb
using brew
:
brew install libusb
Installing & Running
To install run:
python -m venv .venv
source .venv/bin/activate
python3 -m pip install -U pyocd
pyocd pack install nRF9160_xxAA
Note: you will need to source .venv/bin/activate
after closing & reopening VSCode.
Then you can flash using:
cd samples/blinky
pyocd load --target nRF9160_xxAA --format hex build/circuitdojo_feather_nrf9151/merged.hex
pyocd reset --target nrf9160_xxaa