Nordic "nRF52840 Dongle" Support

Posted on
Page
of 6
/ 6
Last Next
  • Hey,

    just received a few of those "original" nRF Dongles today. Is there already support for those?

    -Stev

  • I'm afraid not. I've been looking into support for the nRF52840DK but realistically to work properly it needs to be running with SDK15, and I haven't managed to get that going at the moment.

    They look like great little devices though, and extremely cheap too.

  • They look like great little devices though, and extremely cheap too.

    Well, I guess all the Nordic chips ask for this kind of cheap generic board designs, this one from Nordic themselves, so that will not go away. Still enough market for specific power/battery designs and special form factors as well as sensor/display combos.

    Now that the 52s with this chip got USB support, too, I hoped to get Espruino's USB HID support running, though I haven't verified that they will support that via the dongle's USB contact pads...

  • but realistically to work properly it needs to be running with SDK15

    From the SDK downloads page it seems that the SDK from 12.2.0 up support the nRF52840.

    So the keyword were "realistically" and "properly"?

  • I hoped to get Espruino's USB HID support running

    That's probably going to be a whole other chunk of work I'm afraid. You'll basically be starting from scratch as all of Espruino's USB HID code is STM32 specific.

    So the keyword were "realistically" and "properly"?

    As I understand it, USB only really became properly supported in 15 (I believe it was pretty flaky before). I did have a build for nRF52840 on SDK14 but USB never worked.

    But I could be wrong - you're welcome to give it a try yourself.

  • 15’s release notes say something about production quality, also for USB, so lets hope they mean it.

    For the HID part, I totally forgot about the STM specific implementation. Still, the 52840’s integrated USB is a pretty cool thing and makes that dongle so interesting.

    I had a look at the HID examples yesterday but had troubles with flashing existing example hex’ and getting some if the tools to work. Seems I have to recompile using the full tool chain.

    The dongle is brand new and the desktop integration might still need minor work/updating.

    I‘ll post an update if I got something going Espruino-wise.

  • Please do keep us updated, I have 2 of these little jewels arriving Wednesday.

  • Better not count on an early. Got the native blinky example running..
    Not sure, how much time I'll have on my hands in August. Intensely waiting for a rainy day for looking at the Espruino code :)

  • Just to let you know I now have a build of Espruino running on SDK15 on the nRF52840, with preliminary USB support (you can move the console over to it and upload code \o/ ).

  • Terrence here.
    Wow, that is really good news. I have 2 of those little chips and eager to put them to use.

  • Hooray, indeed, @Gordon

    Though we got a new dog and I will never have time for anything again, I‘m afraid...

    Had a look at the sources, though, last week after not having looked at it for a few years now, and am pretty happy with what Espruino has become and that it‘s well and alive. Great work.

  • Hi @Gordon,

    Is the code for the nRF52840 + USB on GitHub? I tried to look for it in master, but couldn't seem to find any mention of nRF + USB...

    Thx!

  • Thank you for that @Gordon! Does it still build for you?

    I'm getting an error saying it can't find nrf.h, I suspect it could be looking in the wrong place or perhaps this file is missing in the nrf5x_15 sdk folder?

    uri@JAY:/home/uri/espruino$ make BOARD=NRF52840DK RELEASE=1
    Generating platform configs
    Generating pin info
    Generating JS wrappers
    WRAPPERSOURCES = src/jswrap_array.c src/jswrap_arraybuffer.c src/jswrap_dataview.c src/jswrap_date.c src/jswrap_error.c src/jswrap_espruino.c src/jswrap_flash.c src/jswrap_functions.c src/jswrap_interactive.c src/jswrap_io.c src/jswrap_json.c src/jswrap_modules.c src/jswrap_pin.c src/jswrap_number.c src/jswrap_object.c src/jswrap_onewire.c src/jswrap_pipe.c src/jswrap_process.c src/jswrap_promise.c src/jswrap_regexp.c src/jswrap_serial.c src/jswrap_storage.c src/jswrap_spi_i2c.c src/jswrap_stream.c src/jswrap_string.c src/jswrap_waveform.c libs/math/jswrap_math.c libs/graphics/jswrap_graphics.c libs/network/jswrap_net.c libs/network/http/jswrap_http.c libs/network/js/jswrap_jsnetwork.c libs/bluetooth/jswrap_bluetooth.c libs/neopixel/jswrap_neopixel.c
    DEFINES = -DGIT_COMMIT=0304abbc -DNO_ASSERT -DRELEASE -DBUILDNUMBER="154" -DCONFIG_GPIO_AS_PINRESET -DBOARD_PCA10056 -DNRF_USB=1 -DUSB -DUSE_DEBUGGER -DUSE_TAB_COMPLETE -DUSE_HEATSHRINK -DUSE_MATH -DUSE_GRAPHICS -DUSE_NET -DBLUETOOTH -DUSE_NEOPIXEL -DS140 -DNRF_SD_BLE_API_VERSION=6 -D__HEAP_SIZE=0 -DBLE_STACK_SUPPORT_REQD -DSWI_DISABLE0 -DSOFTDEVICE_PRESENT -DFLOAT_ABI_HARD -DNRF52 -DNRF52840_XXAA -DNRF52840DK -DNRF52840 -DNRF5X -DNRF5X_SDK_15 -DARM -DLINK_TIME_OPTIMISATION -DEMBEDDED
    CC libs/compression/heatshrink/heatshrink_e­ncoder.o
    CC libs/compression/heatshrink/heatshrink_d­ecoder.o
    CC libs/compression/compress_heatshrink.o
    In file included from /mnt/c/P/espruino/src/jsutils.h:17:0,
                     from libs/compression/compress_heatshrink.c:1­5:
    gen/platform_config.h:13:17: fatal error: nrf.h: No such file or directory
     [#include](http://forum.espruino.com/sea­rch/?q=%23include) "nrf.h"
                     ^
    compilation terminated.
    Makefile:768: recipe for target 'libs/compression/compress_heatshrink.o'­ failed
    make: *** [libs/compression/compress_heatshrink.o]­ Error 1
    
  • Looking at .gitignore, it seems like most of the content of the nrf5x_15 folder is not present in git. Thus, I manually downloaded SDK 15 (as well as micro-ecc, under targetlibs/nrf5x_15/external/micro-ecc), so now the source code compiles, however the linker script is missing:

    CC /home/uri/espruino/targetlibs/nrf5x_15/c­omponents/libraries/experimental_memobj/­nrf_memobj.o
    make: *** No rule to make target '/home/uri/espruino/targetlibs/nrf5x_15/­nrf5x_linkers/linker_nrf52840_ble_esprui­no.ld', needed by 'espruino_1v99.154_nrf52840.elf'.  Stop.
    

    Any pointers?

  • try now :)

  • 😍

    It compiles!

    When I upload the .hex file and run it on the chip, it doesn't seem to be showing up as a USB device, though it is connectable by BLE (even though it doesn't seem to advertise correctly). When I debug it in GDB, it seems to always stop inside jswrap_regexp routines, e.g.:

    (gdb) monitor reset
    (gdb) c
    Continuing.
    target not halted
    target nrf52.cpu was not halted when resume was requested
    ^C
    Program received signal SIGINT, Interrupt.
    matchfound (txtIt=<optimized out>, info=...) at src/jswrap_regexp.c:57
    57        jsvObjectSetChild(rmatch, "input", info.sourceStr);
    (gdb)
    

    Not sure if this is something wrong with my setup or it indeed is busy parsing regular expressions all the time for some reason. I will keep investigating - any pointers are appreciated!

  • Since the advertisement was broken, I went ahead and patched navigator.requestDevice so I could still connect to the device over BLE-UART using the Espruino Web IDE:

    _originalRequestDevice = navigator.bluetooth.requestDevice;
    navigator.bluetooth.requestDevice = function(p) { 
      delete p.filters;
      p.acceptAllDevices = true; 
      return _originalRequestDevice.call(this, p);
    };
    

    However, once connected, the device sends a single line endlessly, and does not seem to respond to any input:

    <- Serial1
    <- Serial1
    <- Serial1
    ...
    

    Any ideas what this might be?

  • Hmm - not sure. What are you running it on? The 52840DK, or the dongle?

    The board file was for the DK so perhaps there's something different in the pin mappings? <- Serial1 happens when the REPL moves to Serial1, which I guess it might do if USB dropped out? The code to swap REPL probably isn't designed for working with USB, Bluetooth and serial so it might choose the wrong one.

    It's possible that the computer you're using keeps connecting & disconnecting on USB, which causes that?

  • It's running on the Dongle, I'll try to tinker with the pin mapping and see if that helps.

    It doesn't seem the the USB serial port even show up on the Windows machine I'm connecting it to - it works in CircuitPython for the same dongle, though, so this probably has something to do with the configuration. Should I try switching to SDK 15.2.0 and see if that helps?

    So far, I tried changing the pin mapping for the serial port and map RX/TX to unconnected pins, but it didn't make any difference. Also, tried switching the default console to EV_USBSERIAL, and now I'm getting an endless loop of <- USB when connecting through Bluetooth.

  • Should I try switching to SDK 15.2.0 and see if that helps?

    You could give it a go. Looks like I used SDK15 for my builds.

    Honestly not sure what to suggest though - afraid I'm a bit too busy to help out with this at the moment

  • Sure, no worries! I'm already happy that we managed to get it to build and run on my board. Perhaps you could share one of the hex files that you have built so I will be able to test it and compare the results?

  • Here's one I believe works - however I was using the 52840DK, not the Dongle - so I don't know if that changes things.


    1 Attachment

  • Thank you!

  • Okay, the hex file you built is giving me a similar result:

    ><- Serial1
    ><- Serial1
    ><- Serial1
    ><- Serial1
    ><- Serial1
    ><- Serial1
    ><- Serial1
    ><- Serial1
    ><- Serial1
    ><- Serial1
    ><- Serial1
    ><- Serial1
    ><- Serial1
    ><- Serial1
    ><- Serial1
    ><- Serial1
    ><- Serial1
    ><- Serial1
    ><- Serial1
    ><- Serial1
    ><- Serial1
    ><- Serial1
    ><- Serial1
    

    I'm wondering why each line now has an extra > in front of it (there wasn't one in my version).

    Anyway, getting Espruino to run on it is just a nice to have experiment for me at this stage, so if you are busy, this can definitely wait...

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

Nordic "nRF52840 Dongle" Support

Posted by Avatar for Stev @Stev

Actions