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

How to flash Thingy 52 with custom firmware on osx

Hi,

I've just got my hands on this amazing little thing call Thingy 52. I have played around with the default app but now I'm struggling with flashing a custom firmware.

So far I manage to perform the following steps:

  • Downloaded Thingy 52 SDK 2.1.0
  • Followed the README to setup the SDK.
  • Successfully compiled project\pca20020_s132 with GCC.
  • Installed nrfutil.
  • Generated own public and private keys.
  • Manage to compile the bootloader (project/bootloader_secure)

Next step would be to flash the custom bootloader onto the Thingy 52. Unfortunately the documentation does not mention how this can be done only states that this needs to be done.

I consulted this blog post about secure DFU and there's a segment about Update softdevice and bootloader.

The drawback is that I'm using OSX and Keil and nRF Go is not available (to my knowledge) meaning that I'm stuck with the command line tools.(?)

So how can I flash a custom bootloader onto Thingy 52 and then create my own firmware DFU package to flash onto Thingy 52 using OSX?

Any help is highly appreciated!

Thanks

  • Hello Kristian,

    The Thingy52 does not have a programming chip. Do you have an external programmer? An nRF5x DK would also work.

    You will need to use the P9 connector on the thingy as described in this case.

    You can use the command line tools. If you type "nrfjprog -h" you will see a list of  all commands. Typically, you would want to erase your Thingy52 first, by writing "nrfjprog -e". Depending on your command line tools version, you might have to add the nRF family like this: "nrfjprog -f NRF52 -e".

    Program your thingy using the following command:

    "nrfjprog --program [path to .hex file] --verify"

    Once you have programmed the bootloader you can use nRF Connect to upload your applications.

    BR,

    Edvin

  • I do have a nRF52 DK chip. I will buy a SWD cable and try that right away. Thanks!

  • Hello Edvin, 

    I've manage using a SWD cable along with a nRF52 DK to flash the bootloader using your suggestions. Next step (according to the docs) is to flash the soft device. I downloaded S132 v4.0.2 and flash that onto the board using:

    nrfjprog --program s132_nrf52_4.0.2_softdevice.hex -f nrf52 --chiperase

    I've also manage to create a DFU package using:

    nrfutil pkg generate --application nrf52832_xxaa_s132.hex --application-version 0 --hw-version 52 --sd-req 0x98 --key-file private-key.pem myApp.zip

    However when trying to perform an OTA-DFU using nRFConnect on a mobile I can't find the Thingy device while scanning. Is the bootloader really flashed? Do I need to create bootloader settings and flash them as well?

    Thanks in advance.

  • Hello Kristian,

    You need to install a bootloader to the Thingy first. It is not included in the Softdevice. You have created your own private and public key, right?

    I have not done this with the Thingy before, but I think it works quite similar to the regular bootloader examples.

    Please check this blog post written by Nordic on bootloaders.

    I assume that you have installed "nrfutil", since you have a private key (which you use to generate your package).

    What you need to do, as it says in the blog, is to exchange dfu_public_key.c with your own public key. The key that you use here should mach your private key (which is also explained in the blog post). After you have flashed the softdevice, flash the bootloader located in Thingy_SDK\project\bootloader_secure\pca20020\arm5_no_packs\secure_dfu_ble_s132_pca20020 (if you use Keil) after you have changed the public key, and compiled.

    After this, power cycle your Thingy:52, and it should blink green. Then you can find it with nRF Connect, and upload the DFU package that you generated with your private key.

    I actually tested it just now, and the thingy bootloader: bootloader_secure works just as the one referred to in the blog post.

    Best regards,

    Edvin

  • I've actually did all the steps you mentioned apart from the order. I flashed the bootloader first followed by the softdevice (as the docs said). Now when i flashed the softdevice first followed by the bootloader I get a flashing green light.

    Thanks!

Related