nRF52840 MDK USB Dongle Espruino Port

Posted on
  • Hi all,

    I just received a couple of those nRF52840 dongles from makerdiary (as you can see below) nice boards even with a plastic shell. I would like to run Espruino on those it will be possible ? Can I build the firmware for it with actual Espruino Repo ? Thanks a lot to everyone

    1 Attachment

    • nRF_Dongle.jpg
  • There is no board file with correct pins but it is easy to make one, can you find out pinout or schematics? Or do you know the pinout of your board is compatible with Nordic nrf52840 dongle? More details here­ug_nrf52840_dongle/UG/nrf52840_Dongle/hw­_description.html?cp=4_0_5_5

    There is topic about Espruino for nordic 52840 dongle, you may try builds from posts below this one­323658/?offset=100

    Anyway, it is just about correct board file, no changes are needed in Espruino source.

  • Hello @fanoush, nice to read you again, I was able to find the schematic of the dongle I have. From waht I can see it is really simple just a nRF52840 chip a voltage regulator and a classic rgb led. You'll find the schematic below. no external flash is present by the way

    1 Attachment

  • OK so the pinout is different from nordic dongle. There are couple of dongles on aliexcpress that have exactly same pinout as nordic one so this is not the case. Also it comes with usb bootloader, two different ones in fact as per­-usb-dongle/programming/ :-)

    so unless you plan to use SWD for programing and clear everything the most important setting in board file is the storage area so that it does not overwrite existing bootloader.
    As per­dk-usb-dongle/blob/master/examples/nrf5-­sdk/open_bootloader/armgcc/open_bootload­er_gcc_nrf52.ld the bootloader starts at 0xE0000 which is same as nordic dongle. You can take storage layout from this­c8eb2a4562785bbb684f661e#file-nrf52840do­ngle-py-L66
    You can also take whole file but remove -DBOARD_PCA10059 and fix LEDx and BTN pin numbers and better change default console to EV_BLUETOOTH
    Then after building you need to follow that programming guide for your dongle.

  • Well of course I will use the swd to fresh program everyhing from start, including bootloader.
    Below you can find the board file I'm making, please take a look at it if you can.

    1 Attachment

  • I'd remove -DBOARD_PCA10059 as this pulls in some SDK board definitions for nordic dongle, see targetlibs/nrf5x_15/components/boards/pc­a10059.h

    With SWD it does not matter much as it is easy to recover from mistakes. OTOH having some bootloader is practical. The USB one is nice as it is fast, works also in Windows with nrf tools and does not depend on softdevice version, almost as good as SWD for updates.

  • Well I only would like to have the usb as a serial device and the standard espruino bootloader to use nrf connect on my smartphone. I tried to compile with the latest espruino repo and I got this error:

    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/compression/jswrap_heatshrink.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
    Generating pin info
    make: *** [Makefile:776: gen/platform_config.h] Error 1
    make: *** Waiting for unfinished jobs....
  • Does building for BANGLEJS2 board (or NRF52840DK) work? If yes then there is probably some python syntax error in the board file.
    BTW, when switching between boards make clean is needed.

  • Yep, It build quite fine for every Espruino board, and yes I always use make clean first. I think I found the problem, basically in the board file i was using the function:

    def get_pins():

    contained the pin array as

     pins = []

    I changed it as i found in the

    pins = pinutils.generate_pins(0,47)

    Now everything builds correctly but I'm not sure what I did is correct

  • Ok, after testing everyhing went fine the board is working correctly, tomorrow I'll post a more decent board file and the compiled hex. Bye for now
    Below you'll see the most satisfying blink of mine !

    1 Attachment

    • blink.jpg
  • A bit late but here I am, below you'll find the board file I did and a pre compiled hex (to be used with st-link / j-link ) for flashing. Everything works really well, the only thing I haven't done yet is to decide what to do with the BTN1 device because right now it is connected to the reset pin of the nRF

    2 Attachments

  • I have tried this one on 52840 devices (E73 from Ebyte), it works at first. But when changing advertising later (by timer) it falls back into advertising as "UART" instead – strangely because it was never named like this. Maybe a default setting. All other options (interval, connection, ...) seem to be accurate.

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

nRF52840 MDK USB Dongle Espruino Port

Posted by Avatar for thejoker187 @thejoker187