This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Thread initialization error on pca10059 using multi protocol support for BLE and Thread (works with no problem in pca10056)

Hi,

I have a nrf52840 DK (pca10056) and a nrf52840 Dongle (pca10059).

I am using the following SDK versions:

nRF5_SDK_15.2.0_9412b96

nRF5_SDK_for_Thread_and_Zigbee_2

And the s140_nrf52_6.1.0_softdevice.hex

I am working with the multiprotocol support for BLE and Thread using the following example:

nRF5_SDK_for_Thread_and_Zigbee_2/multiprotocol/ble_thread_dyn_proximity

I have created a gcc project using the example and have been able to successfully flash the pca10056 board and get it to work successfully. I am using nrfutil in the last step to flash the binaries and everything works as expected with BLE and Thread.

Next I have created a copy of the project and then have modified the board definition pre-processor to PCA10059 and then have rebuilt it and flashed it to the pca10059 device (dongle). Unfortunately it does not work. However, I have been debugging it and have been able to narrow it down. If I disable the thread functionality (comment out the thread_instance_init and other thread methods) then the BLE part works flawlessly and I can interact with the dongle from my phone using nrf connect. As soon as I call thread_instance_init, then everything stops working (including BLE). I have pinpointed it to:

  mp_ot_instance = otInstanceInitSingle();

At this point it fails, so it looks like it fails to initiate the thread functionality.

Unfortunately I don't have access to the logs.

I have been using the openthread libraries included with the Nordic SDK and have tried to build them from scratch using the open thread code but the result has been the same.

Can anyone think of a reason why the otInstanceInitSingle() fails? It is working with no issues in the pca10056 board.

Thanks

Manuel

Parents
  • In the last release of our SDK we haven’t provided any example that shows how to run multiprotocol example on the PCA10059.

    The problem you have experienced is due to incorrect linker configuration.

     

    The ble_thread_dyn_proximity uses linker script which does not assume that bootloader is already flashed. The end result is that bootloader and its settings overlap with Thread non-volatile memory section (which is placed also at the end of the FLASH memory).

    Because of that, MPU (Memory Protection Unit) triggers fault state (invalid memory access). For more details about bootloader solution please refer to the following page: https://www.nordicsemi.com/en/DocLib/Content/SDK_Doc/nRF5_SDK/v15-2-0/lib_bootloader

     

    We have prepared a short tutorial on how to modify example to be run on PCA10059 dongle. All in all you need to modify just a few lines.

     

    1. Download nRF5 SDK for Thread and Zigbee 2.0.0
    2. Download openthread_nrf52840_multiprotocol_pca10059.ld linker script (attached) and copy it to the following folder: \external\openthread\linker_scripts\openthread_nrf52840_multiprotocol_pca10059.ld

      Here you can see the diff between the default linker script: (as you see flash length has to be shortened to reserve place for Bootloader).

      $ diff --color openthread_nrf52840_multiprotocol.ld openthread_nrf52840_multiprotocol_pca10059.ld
      <   FLASH (rx) : ORIGIN = 0x26000, LENGTH = 0xda000
      ---
      >   FLASH (rx) : ORIGIN = 0x26000, LENGTH = 0xba000
      9a10,14
      >
      >   uicr_bootloader_start_address (r) : ORIGIN = 0x10001014, LENGTH = 0x4
      >   bootloader_settings_page (r) : ORIGIN = 0x000FF000, LENGTH = 0x1000
      >   uicr_mbr_params_page (r) : ORIGIN = 0x10001018, LENGTH = 0x4
      >   mbr_params_page (r) : ORIGIN = 0x000FE000, LENGTH = 0x1000
    3. Make following changes in the example Makefile (e.g. examples\multiprotocol\ble_thread\ble_thread_dyn_proximity\uart\pca10056\s140\armgcc)  (or usb variant)

      $ diff --color Makefile.old Makefile
      1c1
      < PROJECT_NAME     := ble_thread_dyn_proximity_uart_pca10056_s140
      ---
      > PROJECT_NAME     := ble_thread_dyn_proximity_uart_pca10059_s140
      9c9
      <   LINKER_SCRIPT  := $(SDK_ROOT)/external/openthread/linker_scripts/openthread_nrf52840_multiprotocol.ld
      ---
      >   LINKER_SCRIPT  := $(SDK_ROOT)/external/openthread/linker_scripts/openthread_nrf52840_multiprotocol_pca10059.ld
      252c252
      < CFLAGS += -DBOARD_PCA10056
      ---
      > CFLAGS += -DBOARD_PCA10059
      280c280
      < ASMFLAGS += -DBOARD_PCA10056
      ---
      > ASMFLAGS += -DBOARD_PCA10059
    4. Run make in the armgcc folder.
    5. Open nRF Connect with Programmer application. (https://www.nordicsemi.com/Software-and-Tools/Development-Tools/nRF-Connect-for-desktop)

      (note that the same you could achieve with nrfutil)
    6. Use Add HEX file to add two files
      1. Softdevice: components\softdevice\s140\hex\s140_nrf52_6.1.0_softdevice.hex
      2. Application: examples\multiprotocol\ble_thread\ble_thread_dyn_proximity\uart\pca10056\s140\armgcc\_build\nrf52840_xxaa.hex


        Note that assumption here is that you have dongle with Bootloader and MBR already flashed (stock version). Else if you mess with flash memory then you need to flash Bootloader using JLink programmer. 

              7. Click the Write button. After couple of seconds, your device is flashed and operational.

                   You should see similar memory map as presented below. 

    Red Color – Bootloader

    Yellow Color – Application (with OpenThread)

    Blue Color – SoftDevice

    Orange – MBR (which is incorporated in the SoftDevice)

    Gray – Unused memory

     8.Testing:

      1. Verify that device sends Thread messages by:
        i ) using sniffer e.g. from here (https://github.com/NordicPlayground/nRF-802.15.4-sniffer)
        ii) or connecting Thread Simple CoAP Client
      2. Use nRF Toolbox application (https://itunes.apple.com/us/app/nrf-toolbox/id820906058?mt=8) (https://play.google.com/store/apps/details?id=no.nordicsemi.android.nrftoolbox&hl=en)
        Click to Proximity application and connect to Thread Proximity device. Then push button on the dongle to trigger sound alarm on your mobile phone, or push localization button in the mobile application to toggle LED on dongle.

    Linker script: openthread_nrf52840_multiprotocol_pca10059.ld

  • This worked for me! Now no failure with otInstanceInitSingle() call.

Reply Children
No Data
Related