tree: f3fea0ab8ecd31cb13ed47aa2bb1b4f0c1bab68a [path history] [tgz]
  1. include/
  2. src/
  3. boot-nrf52840aa.ld
  4. bsp.yml
  5. nordic_pca10059_debug.sh
  6. nordic_pca10059_no_boot.ld
  7. nrf52840aa.ld
  8. pkg.yml
  9. README.md
  10. split-nordic_pca10059.ld
  11. syscfg.yml
hw/bsp/nordic_pca10059/README.md

PCA10059: NRF52840 USB dongle

Flashing application without debugger

Board comes from factory with Nordic DFU Bootloader that does not recognize images created by newt tool.

Board with Nordic bootloader can be programmed using Nordic's nrfutil.

Here are steps to flash mynewt application:

  1. Flash map of the application must be changed to match what Nordic bootloader expects. Here is example target file with flash map suitable for Nordic bootloader. target file: targets/nordic_pca10059-blehci_nrf52dfu/target.yml
target.app: "@apache-mynewt-nimble/apps/blehci"
target.bsp: "@apache-mynewt-core/hw/bsp/nordic_pca10059"
target.build_profile: debug

bsp.flash_map:
    areas:
        # NRF52 MBR area.
        FLASH_AREA_MBR:
            user_id: 20
            device: 0
            offset: 0x00000000
            size: 4kB
        # NRF52 bootloader ara.
        FLASH_AREA_NRF52_BOOTLOADER:
            user_id: 21
            device: 0
            offset: 0x000E0000
            size: 128kB
        # mynewt image
        FLASH_AREA_IMAGE_0:
            device: 0
            offset: 0x00001000
            size: 396kB

        # User areas.
        FLASH_AREA_REBOOT_LOG:
            user_id: 0
            device: 0
            offset: 0x000C8000
            size: 16kB
        FLASH_AREA_NFFS:
            user_id: 1
            device: 0
            offset: 0x000CC000
            size: 16kB

Example configuration file targets/nordic_pca10059-blehci_nrf52dfu/syscfg.yml:

syscfg.vals:
    # Skip includsion of image header in the build
    INCLUDE_IMAGE_HEADER: 0

    # Configuration for dongle to show up as bluetooth device in host system 
    BLE_TRANSPORT_HS: usb
    USBD_PID: 0xC01A
    USBD_VID: 0xC0CA
    USBD_BTH: 1
    # Optional name of
    USBD_PRODUCT_STRING: '"NimBLE"'
    USBD_BTH_DESCRIPTOR_STRING: '"NimBLE"'

    # Set to 1 if testing on Windows
    BLE_LL_HBD_FAKE_DUAL_MODE: 0

syscfg.vals.BLE_LL_HBD_FAKE_DUAL_MODE:
    USBD_PRODUCT_STRING: '"NimBLE (For Windows)"'
    USBD_BTH_DESCRIPTOR_STRING: '"NimBLE (For Windows)"'
    # Public address is required, it should be provisioned not set this way 
    BLE_LL_PUBLIC_DEV_ADDR: 0x010101010102
    BLE_TRANSPORT_EVT_SIZE: 257

Example target package file targets/nordic_pca10059-blehci_nrf52dfu/pkg.yml:

pkg.name: "targets/nordic_pca10059-blehci_nrf52dfu"
pkg.type: target

FLASH_AREA_MBR and FLASH_AREA_NRF52_BOOTLOADER are here to denote flash area not available to mynewt.

FLASH_AREA_IMAGE_0 must start from 0x1000

  1. Build application with newt tool:
    newt build nordic_pca10059-blehci_nrf52dfu
  1. Create hex file needed by nrfutil:
    cd bin/targets/nordic_pca10059-blehci_nrf52dfu/app/@apache-mynewt-nimble/apps/blehci/
    arm-none-eabi-objcopy -O ihex blehci.elf blehci.hex
  1. Create package zip file for nrfutil:
    nrfutil pkg generate --hw-version 52 --sd-req 0 --application blehci.hex --application-version 1 blehci_nrf52dfu_package.zip
  1. Enter bootloader mode by clicking reset button while user button is held. When Nordic Open DFU Bootloader is activated board red LED starts to blink and serial port is visible in the host system (COMx for Windows or /dev/ttyACMx for Linux).
  2. Flash application package with nrfutil:
    nrfutil dfu usb-serial -p /dev/ttyACM0 --package blehci_nrf52dfu_package.zip