Can't program XIAO nrf52840 Sense using NRF connect SDK in vscode


TL;DR:

Place pm_static_xiao_ble_nrf52840.yml file in the app root:

adafruit_boot:
  address: 0xf4000
  end_address: 0x100000
  region: flash_primary
  size: 0xc000
app:
  address: 0x27000
  end_address: 0xec000
  region: flash_primary
  size: 0xc5000
sd_partition:
  address: 0x0
  end_address: 0x27000
  region: flash_primary
  size: 0x27000
storage:
  address: 0xec000
  end_address: 0xf4000
  region: flash_primary
  size: 0x8000
sram_primary:
  address: 0x20000000
  end_address: 0x20040000
  region: sram_primary
  size: 0x40000

For sense variant, name the file pm_static_xiao_ble_nrf52840_sense.yml.


Sample build/flash commands for blinky while in c:\ncs\v3.0.2 directory after starting the terminal with nrfutil sdk-manager toolchain launch --ncs-version v3.0.2 --terminal:

west build --sysbuild -p -b xiao_ble zephyr/samples/basic/blinky
west flash -r uf2

If you are not using sysbuild (--no-sysbuild), everything should work out of the box with the current SDK, and the partition information will be provided automatically for the default bootloader (from zephyr\dts\common\nordic\nrf52840_partition_uf2_sdv7.dtsi).

Sample commands to build/flash blinky without any changes using recent SDK versions (3.x):

west build --no-sysbuild -p -b xiao_ble zephyr/samples/basic/blinky
west flash -r uf2

Why _nrf52840 suffix is needed for pm_static.yml

I just found that the SOC qualifier is required for the static partition file name even if it’s not present in the board YAML file identifier.

For example, zephyr\boards\seeed\xiao_ble\xiao_ble.yaml:

identifier: xiao_ble
name: XIAO BLE

For the sense variant in zephyr\boards\seeed\xiao_ble\xiao_ble_nrf52840_sense.yaml:

identifier: xiao_ble/nrf52840/sense
name: XIAO BLE Sense

For the sense, the static partition file should be placed in the app root directory and named as follows:

pm_static_xiao_ble_nrf52840_sense.yml

But for the regular xiao_ble, the file must be named:

pm_static_xiao_ble_nrf52840.yml

Then it’s picked up during the sysbuild:

-- Found partition manager static configuration : C:/ncs/v3.0.2/zephyr/samples/basic/blinky/pm_static_xiao_ble_nrf52840.yml

This requirement is probably coming from the zephyr\boards\seeed\xiao_ble\board.yml file, socs property:

board:
  name: xiao_ble
  full_name: XIAO BLE (Sense)
  vendor: seeed
  socs:
  - name: nrf52840
    variants:
    - name: 'sense'
4 Likes