Nordic "nRF52840 Dongle" Support

Posted on
of 6
First Prev
/ 6
  • Ok, what do you mean by "flashing does not work" ? If flashing won't work, nothing will work :)
    After flashing Espruino, the dongle shows up as a virtual COM port, nothing special, Windows says the driver is by Microsoft, so you shouldn't need any special driver I think. Or BLE, no driver needed at all.

    So, I'm lazy to type so just use nRF Connect desktop's "Programmer". You can use the command line tools, the GUI is calling that, so the result should be the same...

    1. The hex's SHA1 should be: 57B9580CE13F18498255EFE8BEDF3370FF040ADB­. Re-download if it's different! There is a tiny chance of wrong download...
    2. This will work if your dongle still has the original USB bootloader. If you have completely erased, or uploaded a different bootloader that doesn't work with nrfjprog, you will need an SWD programmer. But the end result should be the same.
    3. Plug-in the dongle, and press the reset button (the one sideways). The red LED should start pulsing.
    4. Launch nRF Connect & programmer. Select the device (top-left). The contents of the dongle's memory should be visible on the left. See the screenshot
    5. Press "Clear files" if you have previously added any file. "Add HEX file" (top-right), select the dongle's hex and hit write. Should take half a minute or so.
    6. Unplug & re-plug the dongle!
    7. Now you should be able to connect to the dongle via BLE or USB. USB feels a bit not-so-perfect: I have to send an extra character sometimes to get the full response from the dongle. Didn't have this issue with BLE tho...

    The programmer's log output should look like this:

    2020-06-26T06:41:00.428Z INFO Using USB SDFU protocol to communicate with target
    2020-06-26T06:41:00.446Z INFO Protocol Version:  1 found
    2020-06-26T06:41:00.447Z INFO Hardware: 52840 found
    2020-06-26T06:41:00.452Z INFO Firmware: Bootloader found
    2020-06-26T06:41:00.452Z INFO Firmware: SoftDevice found
    2020-06-26T06:41:00.453Z INFO Firmware: Application found
    2020-06-26T06:41:17.200Z INFO Parsing HEX file:  C:\dev\espruino\_firmware\nRF52840\espru­ino_2v06.6_nrf52840_dongle.hex
    2020-06-26T06:41:17.201Z INFO File was last modified at  23/06/2020, 18:24:22
    2020-06-26T06:41:17.475Z INFO SoftDevice detected, id 0xA9 (S140 v6.0.0)
    2020-06-26T06:42:36.283Z INFO Does not need to be reloaded:  C:\dev\espruino\_firmware\nRF52840\espru­ino_2v06.6_nrf52840_dongle.hex
    2020-06-26T06:42:36.294Z INFO SdReq for SoftDevice is set as 0x00.
    2020-06-26T06:42:36.296Z INFO Hash is generated by SHA256
    2020-06-26T06:42:36.298Z INFO Hash is generated by SHA256
    2020-06-26T06:42:36.311Z INFO Performing DFU. This may take a few seconds
    2020-06-26T06:42:36.380Z INFO DFU procedure starts. This may take a few seconds.
    2020-06-26T06:42:44.785Z INFO DFU for SoftDevice completed successfully!
    2020-06-26T06:42:44.786Z INFO 1 dfu package(s) left.
    2020-06-26T06:42:44.787Z INFO Waiting for device
    2020-06-26T06:42:44.899Z INFO DFU procedure starts. This may take a few seconds.
    2020-06-26T06:42:59.791Z INFO DFU for Application completed successfully!
    2020-06-26T06:42:59.791Z INFO 0 dfu package(s) left.
    2020-06-26T06:42:59.792Z INFO Waiting for device
    2020-06-26T06:43:04.793Z ERROR Reopen device failed: Timeout while waiting for device  C132E264CC6B to be attached and enumerated
    2020-06-26T06:43:04.793Z INFO Nordic DFU Trigger Interface was not found.Please physically reset device.
    2020-06-26T06:43:04.796Z ERROR Device not found due to failure during DFU
    2020-06-26T06:43:04.810Z INFO Target device closed.

    Small correction, looks like I lost my latest board file, so BTNs and LEDs are the same as on the devkit, and that's not correct. But for example D6.toggle() does toggle the green LED. Just look up the pin numbers in the dongle's user guide.

    2 Attachments

    • 2020-06-26 08_41_49-nRF Connect v3.4.1 - Programmer.png
    • 2020-06-26 08_45_25-Clipboard.png
  • As for bootloader, the one in espruino tree worked for me with Particle Xenon so it is also possible to build the board file with bootloader turned on and then flash it including espruino bootloader and use DFU over ble. I think with generating DFU package it just needed some change to use NRF52840 family for nrfutil when making the zip or bootloader would otherwise not accept it. But SWD is faster anyway (or usb).

    As for usb console prompt, yes it works somehow but I better disconnect USB as it interferes with ble console and it does something strange for me with Xenon at boot/reset time. Not using Xenon with Espruino very much but so far it mostly worked just fine for testing 52840 capabilities, no rough edges. And BTW with 256K of RAM one can hit Espruino limit that you can't allocate variable over 64KB size like e.g. new UInt8Array(240*240*2) for framebuffer (wasteful, I know, but 256KB!).

  • Anyone here used the Particle Debugger for $20.00 USD from Adafruit. It is fairly amazing, drag and drop .bin and .hex boot loading.

    It uses CMSIS-DAP, one of possible SWD implementations, feels better than stlink to me, e.g. can erase locked nrf52 chips, also works over USB HID so need no special usb drivers installed, also have UART included, I like it too. Don't have the one from Particle but there are also CMSIS-DAP implemenations for blue pill boards or STLINK V2 clones ($2 items). Interesting that the photo of Particle Debugger shows GD32F103 chip - clone of STM32F103.

  • @AkosLukacs just wanted to let you know that your intstructions (and sample .py file) were very helpful :)

      VERSION: "2v06.10",
      GIT_COMMIT: "9811e3d",
      BOARD: "NRF52840DONGLE",
      FLASH: 1048576, STORAGE: 40960, RAM: 262144,
      SERIAL: "xxx",
      CONSOLE: "Bluetooth",
      MODULES: "Flash,Storage,hea" ... "etworkJS,neopixel",
      EXPTR: 536885592 }
  • Hi
    Have you news instructions to compile to NRF52840 ?

  • i had tried many times! No works! still uses the SDK 15 ?

  • I see no difference building for nrf52840 dongle than building for any other board, yes SDK15 based build works on dongle.

    after calling ./scripts/ YOURBOARDNAME with SDK15 based board name it sets up SDK15 and build should work.

    BTW as for nrf52840 dongle, there is cheap 'clone' that often sells for $6.65 including shipping­30238972.html , got few of them and for the price it is good 52840 board. It is clone in the sense that button and LEDs pinout is same and same pins are brought out as on the original dongle. Otherwise it looks different and has also plastic case.

    Also any nordic firmware and tools made for nrf52840 dongle works on this one too (connectivity fw, bt sniffer,...)

  • Thanks for your good explanation!!!!
    I forgot to use the
    I will test soon! And write blogs about espruino nina b302! I did a PCB to have access to all gpio
    Thanks again! I will let you know the sucess

  • @fanoush
    u-blox nina B302 running GORDON JAVASCRIPT :)

    1 Attachment

    • Sem título.png
  • Is the scan issue fixed in a new hex? I am also seeing this error.
    BTW, the link for espruino_2v06.6_nrf52840_dongle.hex does not seem to work anymore

  • Just made a built for nrf52840 without USB/LED.

    1 Attachment

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

Nordic "nRF52840 Dongle" Support

Posted by Avatar for Stev @Stev