2

I'm new to the nRF52840 and OpenThread platform and I'm looking for example code building a sensor application with an nRF52840 Micro Dev Kit USB Dongle.

I managed to set up a Raspberry Pi as border router, to build and flash the ot-cli-ftd, and to set up an OpenThread network with the NCP and two other nodes.

What I did not find on the OpenThread or nRF web sites is a "maker-friendly" example application, e.g. combining the OpenThread-CLI and some custom code for reading sensor data via I2C or SPI and sending data via MQTT (or MQTT-SN).

Is there an example how to build such an application for an nRF52840 Dongle?

I understand that I have to be careful to add USB and boot loader support in my firmware images to avoid "bricking" the dongles (they have no JLink interface, so AFAIK the only way to flash them is via the DFU boot loader), so I would prefer to start with some working example.

Christian Gawron
  • 852
  • 1
  • 6
  • 18
  • I have also decided to use OpenThread with the nrf dongle. I find there isn't a great deal of support in the documentation for this, having a single working example would be a great start. I am using the nRF52840DK for debugging with the Segger Studio as well as WireShark to debug the packets. Its been interesting so far, sometimes feel a little out of my depth – peterretief Jun 19 '19 at 13:01

1 Answers1

3

Thank you for your interest in Nordic nRF52840 and OpenThread.

Generally, there are many examples provided in the nRF5 SDK for Thread and Zigbee. nRF52840 Dongle is also known as PCA10059, SDK provides examples that are running on it. I think that the Full Thread Device, Commandline Interface is a good starting point (examples/thread/cli/ftd/usb/). There are quite many other examples, even with MQTT-SN. They do not support the Dongle with the bootloader but having information that I will try to pass below you will be able to achieve such configuration.

You are right that there is a difference in the memory layout.

Dongle with the MBR and the Bootloader - PCA10059 variant: thread_cli_ftd_usb_gcc_nrf52.ld

MEMORY
{
  FLASH (rx) : ORIGIN = 0x1000, LENGTH = 0xdb000
  RAM (rwx) :  ORIGIN = 0x20000008, LENGTH = 0x3fff8
  ot_flash_data (r) : ORIGIN = 0xdc000, LENGTH = 0x4000
}

Development Kit without the MBR and the Bootloader - PCA10056 variant: thread_cli_ftd_usb_gcc_nrf52.ld:

MEMORY
{
  FLASH (rx) : ORIGIN = 0x0, LENGTH = 0xfc000
  RAM (rwx) :  ORIGIN = 0x20000000, LENGTH = 0x40000
  ot_flash_data (r) : ORIGIN = 0xfc000, LENGTH = 0x4000
}

You can find details in the Memory layout section. Please note that the Multiprotocol examples use Softdevice while the Thread-only do not need it and use that space for the application.

There is a way to unbrick the dongle, actually even two of them. One is a cable with a needle connector - TC2050-IDC-NL. The second option is soldering a 10-pin connector at the back of the dongle and using a ribbon cable. Having any of them enables you to connect the programmer and flash the MBR and the Bootloader which are available with the SDK mentioned above.

For future nRF related questions I highly recommend Nordic Devzone where you can get help from engineers working with Nordic Semiconductor.

pszkotak
  • 46
  • 4
  • Thank you, pszkotak! Regarding connecting a JLink interface to the dongle: I understand that this applies to the Dongle from Nordic. Unfortunately, the "nRF52840 Micro Dev Kit USB Dongle" from MakerDiary does not seem to have this interface, so I need to be more careful. Regarding OTA DFU via OpenThread: Do you know whether there is a possibility to do that via IPv6 and a "remote" NCP (instead of a locally connected one)? – Christian Gawron May 14 '19 at 20:59
  • The Dongle you mentioned has SWD interface pins exposed. The only thing there needs to be done is to figure out how to connect SWD of your programmer to them. In some cases, it may be even more convenient as there is no need to buy an extra cable. The only DFU solution I am aware of does not support remote firmware server, but it should be possible to implement it. – pszkotak May 15 '19 at 05:23