• Sun 2021.09.19

    Repeatable on both native WebIDE and web based espruino\ide
    Repeatable on either editor upload or direct console entry

    I have worked two days on attempting to get neopixels to run on a Nordic nRF52840 Dongle based on the work that @AkosLukacs did two years ago.


    post #123   Nordic "nRF52840 Dongle" Support

    As can be seen from the console output, the first two lines will upload and execute fine. As the third linerequire("neopixel") starts to upload, the WebIDE locks.

    Board Green LED is D6 - For neopixel also tried D2, D13, D29, D31

    require("neopixel").write(D2, [11,11,0]);
      VERSION: "2v06.6",
      GIT_COMMIT: "db576d70",
      BOARD: "NRF52840DONGLE",

    Note the require statement is commented out - 4th line of L5

    [success] Connected to COM10
    >>> Connected to COM10
    Found a prompt... great!
    Splitting for reset(), delay 250
    SET chrome.storage.sync = {"AUTO_SAVE_CODE":true,"BAUD_RATE":"1152­00","BLOCKLY_EXTENSIONS":"|bluetooth|rob­ot|","BLOCKLY_LANGUAGE":"en","BLOCKLY_TO­_JS":false,"BOARD_JSON_URL":"http://www.­espruino.com/json","CODE":"digitalWrite(­D6,0);\n\npinMode(D2,\"output\");\n//req­uire(\"neopixel\").write(D2, [11,11,0]);\n","COMPILATION":true,"COMPI­LATION_URL":"https://www.espruino.com/se­rvice/compiler","DISABLE_CODE_HINTS":fal­se,"ENABLE_Testing":false,"ENV_ON_CONNEC­T":true,"FONT_SIZE":12,"MINIFICATION_Dea­dCode":true,"MINIFICATION_LEVEL":"","MIN­IFICATION_Literal":true,"MINIFICATION_Ma­ngle":true,"MINIFICATION_Unreachable":tr­ue,"MINIFICATION_Unused":true,"MODULE_AS­_FUNCTION":false,"MODULE_EXTENSIONS":".m­in.js|.js","MODULE_MINIFICATION_LEVEL":"­","MODULE_PROXY_ENABLED":false,"MODULE_P­ROXY_PORT":"","MODULE_PROXY_URL":"","MOD­ULE_URL":"https://www.espruino.com/modul­es","OFFLINE_DATA":"","OFFLINE_DATA_DOWN­LOAD":"","OFFLINE_DATA_UPLOAD":"","OFFLI­NE_ENABLED":false,"RESET_BEFORE_SEND":tr­ue,"SAVE_ON_SEND":0,"SERIAL_AUDIO":"0","­SERIAL_TCPIP":"","SERIAL_THROTTLE_SEND":­false,"SET_TIME_ON_WRITE":false,"SHOW_CO­DE_LINK_ICON":false,"SHOW_WEBCAM_ICON":0­,"STORE_LINE_NUMBERS":true,"Sound_Error"­:"","Sound_Info":"","Sound_Success":"","­Sound_Warning":"","Speak_Error":false,"S­peak_Info":false,"Speak_Success":false,"­Speak_Warning":false,"UI_MODE":"Normal",­"WEBCAM_CONSTRAINTS":0,"projectEntry":"E­CDBE226B08643DC748E4DFA98647B9D:Espruino­nRF52840"}
    Config.BAUD_RATE => 115200
    Found a prompt... great!
    Splitting for reset(), delay 250
    Found a prompt... great!
    Splitting for reset(), delay 250

    Code executes as it should and board responds to commands entered from the console.

    Locks - note the un-commented require - 4th of L2 - so it is this line

    >>> Connected to COM10
    SET chrome.storage.sync = {"AUTO_SAVE_CODE":true,"BAUD_RATE":"1152­00","BLOCKLY_EXTENSIONS":"|bluetooth|rob­ot|","BLOCKLY_LANGUAGE":"en","BLOCKLY_TO­_JS":false,"BOARD_JSON_URL":"http://www.­espruino.com/json","CODE":"digitalWrite(­D6,0);\n\npinMode(D2,\"output\");\nrequi­re(\"neopixel\").write(D2, [11,11,0]);\n","COMPILATION":true,"COMPI­LATION_URL":"https://www.espruino.com/se­rvice/compiler","DISABLE_CODE_HINTS":fal­se,"ENABLE_Testing":false,"ENV_ON_CONNEC­T":true,"FONT_SIZE":12,"MINIFICATION_Dea­dCode":true,"MINIFICATION_LEVEL":"","MIN­IFICATION_Literal":true,"MINIFICATION_Ma­ngle":true,"MINIFICATION_Unreachable":tr­ue,"MINIFICATION_Unused":true,"MODULE_AS­_FUNCTION":false,"MODULE_EXTENSIONS":".m­in.js|.js","MODULE_MINIFICATION_LEVEL":"­","MODULE_PROXY_ENABLED":false,"MODULE_P­ROXY_PORT":"","MODULE_PROXY_URL":"","MOD­ULE_URL":"https://www.espruino.com/modul­es","OFFLINE_DATA":"","OFFLINE_DATA_DOWN­LOAD":"","OFFLINE_DATA_UPLOAD":"","OFFLI­NE_ENABLED":false,"RESET_BEFORE_SEND":tr­ue,"SAVE_ON_SEND":0,"SERIAL_AUDIO":"0","­SERIAL_TCPIP":"","SERIAL_THROTTLE_SEND":­false,"SET_TIME_ON_WRITE":false,"SHOW_CO­DE_LINK_ICON":false,"SHOW_WEBCAM_ICON":0­,"STORE_LINE_NUMBERS":true,"Sound_Error"­:"","Sound_Info":"","Sound_Success":"","­Sound_Warning":"","Speak_Error":false,"S­peak_Info":false,"Speak_Success":false,"­Speak_Warning":false,"UI_MODE":"Normal",­"WEBCAM_CONSTRAINTS":0,"projectEntry":"E­CDBE226B08643DC748E4DFA98647B9D:Espruino­nRF52840"}
    Found a prompt... great!
    Splitting for reset(), delay 250

    At this point, powering down is the only option.

    Also toyed with minification and Esprima settings

  • Note the same for the online WebIDE


    Web IDE version 0.75.10

    >>> Receiving...
    Got "< << {\"VERSION\":\"2v06.6\",\"GIT_COMMIT\":\­"db576d70\",\"BOARD\":\"NRF52840DONGLE\"­,\"FLASH\":1048576,\"STORAGE\":40960,\"R­AM\":262144,\"SERIAL\":\"2325de65-c6b872­ca\",\"CONSOLE\":\"USB\",\"MODULES\":\"F­lash,Storage,heatshrink,net,dgram,http,N­etworkJS,neopixel\",\"EXPTR\":536885592}­ >> >\r\n>"
    [notify_info] Found NRF52840DONGLE, 2v06.6
    Loading https://www.espruino.com/json/NRF52840DO­NGLE.json
    ERROR: getURL("https://www.espruino.com/json/NR­F52840DONGLE.json") error : HTTP 404
    Board JSON loaded
    Firmware >1.43 supports faster writes over USB
    Set Slow Write = false
    Device found {"portName":"webserial:1091:498b"}
    [success] Connected to Web Serial, webserial:1091:498b
    >>> Connected to Web Serial, webserial:1091:498b
    >>> Minifying
    >>> Minification complete
    Found a prompt... great!
    Splitting for reset(), delay 250
    Connection Failed.
    Disconnect callback... {"port":"Web Serial","portName":"webserial:1091:498b"­}
    WARNING: [notify_warn] Disconnected from Web Serial, webserial:1091:498b
    >>> Disconnected from Web Serial, webserial:1091:498b
    >>> Connecting...
    Set Slow Write = true
    Serial> Pre-paired Web Serial device already found
    >>> Connecting to serial port
    Serial> ERROR: InvalidStateError: Failed to execute 'open' on 'SerialPort': The port is already open.
    ERROR: [notify_error] Connection Failed.
    >>> Connection Failed.

    At this point, powering down is the only option.

    Trying to block copy into L-Hand console side, only first char 'r' shows and console then locks

    require("neopixel").write(D2, [11,11,0]);

     2v06.6 (c) 2019 G.Williams
    Espruino is Open Source. Our work is supported
    only by sales of official boards and donations:

  • There have been some updates for using neopixel on nrf52840 since that hex files where shared.


  • Sun 2021.09.19

    Thank you for the response @MaBe

    That specific line was added for the Developer Kit version.

    neopixels on the nRF52840   WaveShare DK
    post #123 Nordic "nRF52840 Dongle" Support

    However, from post #129


    that change was part of the 2V06.1 DK build for WaveShare board.

    I have the latest 2V06.6 Nordic Dongle build, (post #1) not that one for the DK

  • Also, it is puzzling what the pin values should be.



     'DEFINES += -DNEOPIXEL_SCK_PIN=22 -DNEOPIXEL_LRCK_PIN=23', # nRF52840 needs LRCK pin defined for neopixel




    Discontinous pin numbers (for nRF52840 dongle)
    'Basically if all the pins are there then Espruino just works out the offset in pinInfo based on the number after D.'

    I've been able to use digitalWrite() to confirm these four outputs that do toggle:

    D2  :: 0.02
    D29 :: 0.29
    D31 :: 0.31
    D13 :: 0.13

    What should the designation be for pins such as 1.10 thru 1.16 ?

    Can anyone provide a pin reference for one specific pin that does work on the Nordic Dongle using neopixels please.

  • Check this for details about NRF52 pin names


  • At this point, powering down is the only option.

    The dongle is documented here https://infocenter.nordicsemi.com/topic/­ug_nrf52840_dongle/UG/nrf52840_Dongle/in­tro.html?cp=4_0_5 and there is also link to download schematics. Not sure if it helps but I know that some pins (more than just one) are tied to reset pin so the module can reset itself to bootloader (led is glowing) by setting pin. Maybe that's what happened to you and it is waiting in bootloader?

    pins 25,23,21,19 are tied to reset => -DNEOPIXEL_LRCK_PIN=23 in board file is not a good idea with the dongle.

    1 Attachment

    • Capture.JPG
  • Yes, most likely that's the problem. The dongle ties a bunch of pins together to make routing easier.

  • Wed 2021.09.22

    re: post #6   'Check this for details about NRF52 pin names'

    Thank you @MaBe for that snippet as it shall come in handy.

    I am a bit curious how one gets from the Nordic board silkscreen values:


    to the output that your JS snippet provides.

    I've located the jspin.c file along with the specific nrf_gpio.h but just haven't stumbled across the method that is used to determine the offsets for the above image. I'm sure I'll eventually locate the source, but in the mean time your JS snippet should provide the needed reference.

    • first I though you struggle with pin names, because the dongle is using PN.M

    • next that the used firmware is missing the additional pins

    • than fanoush mentioned that D23 is a bad choice

    • than posted a full circuit to figure out two pins that are not used, eg P1.03 and P1.05

    P1.03 : D35, P1.05 : D37

    replace the old pin values with those two, like this


    make and flash the new firmware and try again.

  • What should the designation be for pins such as 1.10 thru 1.16 ?

    1. prefix is +32, 1.10=D42
  • I had the same issue on a different nrf52840 board http://forum.espruino.com/conversations/­354468/ not sure if this would help but this sounds like what I experienced before

  • In this case, http://forum.espruino.com/comments/15562­682/ and building the hex file with this board def works for me

    Edit: just saw that fanoush mentioned it's not a good idea. I guess you can just pick any pin that's free (for the dongle, maybe one that's on a pad underneath so you don't accidentally use it?)

  • I guess you can just pick any pin that's free (for the dongle, maybe one that's on a pad underneath so you don't accidentally use it?)

    I never used neopixels so don't know what -DNEOPIXEL_LRCK_PIN=23 does and what this LRCK pin is used for. It is not good idea if it outputs low - that will reset the dongle. Was thinking you really use it for something and connect it to the leds - so not sure what "don't accidentally use it" means :-)

  • The neopixels require fast pulses, and the usual way firmware for microcontrollers do it is to ride on I2S (instead of bitbanging gpio).

    I2S usually need both SCK and LRCK defined, but the nRF52832 didn't need the LRCK pin defined. However after some testing (and a trip to the nordic forums) it seems it is indeed required.

    What I meant by not accidentally using it is that since with nRF52 you can assign devices their pins, if you put LRCK it on an exposed pin, you might accidentally connect it to your circuit and have a really awful time debugging :P

  • thanks, got it, so LRCK goes nowhere but must be used to enable i2s and some clock is produced there. Then it is indeed not a good idea to connect this to reset pin :-)

    So there are couple of pins not connected at all on 52840 dongle, one is P0.16 on the picture posted above.

    just tried D16 on dongle clone (E104-BT5040U) and writing 1 or 0 does nothing, reading gives true by default and false when configured as D16.mode("input_pulldown"), so I guess the pin is floating. D23.write(0) reboots to bootloader indeed

  • Fri 2021.09.24

    reply post #11

    'make and flash the new firmware and try again'

    Hi @MaBe thank you for that instruction.

    I'm not sure it has been understood, but I made my attempts using the pre-built solutions from post #123 'Nordic "nRF52840 Dongle" Support' thread that I referenced in post #1 and post #4

    Although a bit pre-mature, your steps and instruction command will come in handy when I get to the build.

  • Fri 2021.09.24

    reply to post #12

    'prefix is +32, 1.10=D42'

    Thank you @fanoush as I know you got what I was after.

    I feel like a real Dolt as your simple reponse makes it all clear now, as going back over the Nordic images and using MaBe's JS snippet, I understand where the thinking was incorrect.

    I now realize that I kept looking at the Dongle pin references and as they were all below 20, I somehow convinced myself that we were working with base 10. Just couldn't grasp what I perceived was needed an offset and increment, which just wouldn't work.

    As Spock in Star Trek would respond to an inbound tranmission;

       'Captain, . . . a simple binary code! . . .'

    How I missed the obvious really surprises me, as your example clears it all up. Thank you.

  • Sat 2021.09.25

    Temporary halt while attempting to resolve a build issue:

    Firmware build for PICO fails - make: *** [lib/startup_stm32f401xx.o] Error 127

  • Sat 2021.09.25

    While builds for the PICO and WIFI are problematic, and Make is running, I made an attampt at the nRF52840DK to see if progress could be made outside the original board list.

    Made progress there after successful install of SDK15, but a new error surfaced: make: *** [espruino_2v08.220_nrf52840.elf] Error 1

    CC /mnt/c/Users/robin/Espruino/targetlibs/n­rf5x_15/components/libraries/atomic/nrf_­atomic.o
    CC /mnt/c/Users/robin/Espruino/targetlibs/n­rf5x_15/components/libraries/atomic_flag­s/nrf_atflags.oCC /mnt/c/Users/robin/Espruino/targetlibs/n­rf5x_15/components/ble/ble_link_ctx_mana­ger/ble_link_ctx_manager.o
    CC /mnt/c/Users/robin/Espruino/targetlibs/n­rf5x_15/components/libraries/util/app_er­ror_handler_gcc.o
    CC /mnt/c/Users/robin/Espruino/targetlibs/n­rf5x_15/components/ble/peer_manager/pm_m­utex.o
    CC /mnt/c/Users/robin/Espruino/targetlibs/n­rf5x_15/components/ble/common/ble_advdat­a.o
    CC /mnt/c/Users/robin/Espruino/targetlibs/n­rf5x_15/components/ble/common/ble_conn_p­arams.o
    CC /mnt/c/Users/robin/Espruino/targetlibs/n­rf5x_15/components/ble/common/ble_srv_co­mmon.o
    CC /mnt/c/Users/robin/Espruino/targetlibs/n­rf5x_15/components/ble/common/ble_conn_s­tate.o
    CC /mnt/c/Users/robin/Espruino/targetlibs/n­rf5x_15/components/ble/ble_services/ble_­nus/ble_nus.o
    CC /mnt/c/Users/robin/Espruino/targetlibs/n­rf5x_15/components/ble/peer_manager/peer­_manager.o
    CC /mnt/c/Users/robin/Espruino/targetlibs/n­rf5x_15/components/ble/peer_manager/peer­_id.o
    CC /mnt/c/Users/robin/Espruino/targetlibs/n­rf5x_15/components/ble/peer_manager/peer­_database.o
    CC /mnt/c/Users/robin/Espruino/targetlibs/n­rf5x_15/components/ble/peer_manager/peer­_data_storage.oCC /mnt/c/Users/robin/Espruino/targetlibs/n­rf5x_15/components/ble/peer_manager/pm_b­uffer.o
    CC /mnt/c/Users/robin/Espruino/targetlibs/n­rf5x_15/components/ble/peer_manager/id_m­anager.o
    CC /mnt/c/Users/robin/Espruino/targetlibs/n­rf5x_15/components/ble/peer_manager/secu­rity_manager.o
    targetlibs/nrf5x_15/components/ble/peer_­manager/pm_buffer.c: In function 'pm_buffer_block_acquire':
    targetlibs/nrf5x_15/components/ble/peer_­manager/pm_buffer.c:104:46: warning: comparison of integer expressions of different signedness: 'int' and 'uint32_t' {aka 'long unsigned int'} [-Wsign-compare]
                 if ((i - first_locked_mutex + 1) == n_blocks)
    CC /mnt/c/Users/robin/Espruino/targetlibs/n­rf5x_15/components/ble/peer_manager/secu­rity_dispatcher.o
    CC /mnt/c/Users/robin/Espruino/targetlibs/n­rf5x_15/components/ble/peer_manager/gatt­_cache_manager.o
    CC /mnt/c/Users/robin/Espruino/targetlibs/n­rf5x_15/components/ble/peer_manager/gatt­s_cache_manager.o
    CC /mnt/c/Users/robin/Espruino/targetlibs/n­rf5x_15/components/libraries/timer/app_t­imer.o
    CC /mnt/c/Users/robin/Espruino/targetlibs/n­rf5x_15/components/libraries/fds/fds.o
    CC /mnt/c/Users/robin/Espruino/targetlibs/n­rf5x_15/components/libraries/queue/nrf_q­ueue.o
    CC /mnt/c/Users/robin/Espruino/targetlibs/n­rf5x_15/components/libraries/util/app_ut­il_platform.o
    CC /mnt/c/Users/robin/Espruino/targetlibs/n­rf5x_15/components/libraries/util/sdk_ma­pped_flags.o
    CC /mnt/c/Users/robin/Espruino/targetlibs/n­rf5x_15/components/libraries/util/app_er­ror.o
    targetlibs/nrf5x_15/components/libraries­/fds/fds.c: In function 'write_execute':
    targetlibs/nrf5x_15/components/libraries­/fds/fds.c:1237:16: warning: this statement may fall through [-Wimplicit-fallthrough=]
                 if (!record_find_by_desc(&desc, &page))
    targetlibs/nrf5x_15/components/libraries­/fds/fds.c:1245:9: note: here
             case FDS_OP_WRITE_HEADER_BEGIN:
    CC /mnt/c/Users/robin/Espruino/targetlibs/n­rf5x_15/components/libraries/util/nrf_as­sert.o
    CC /mnt/c/Users/robin/Espruino/targetlibs/n­rf5x_15/components/softdevice/common/nrf­_sdh.o
    CC /mnt/c/Users/robin/Espruino/targetlibs/n­rf5x_15/components/softdevice/common/nrf­_sdh_ble.o
    CC /mnt/c/Users/robin/Espruino/targetlibs/n­rf5x_15/components/softdevice/common/nrf­_sdh_soc.o
    CC /mnt/c/Users/robin/Espruino/targetlibs/n­rf5x_15/components/libraries/experimenta­l_section_vars/nrf_section_iter.o
    CC /mnt/c/Users/robin/Espruino/targetlibs/n­rf5x_15/components/libraries/fstorage/nr­f_fstorage.o
    CC /mnt/c/Users/robin/Espruino/targetlibs/n­rf5x_15/components/libraries/fstorage/nr­f_fstorage_sd.oCC /mnt/c/Users/robin/Espruino/targetlibs/n­rf5x_15/components/libraries/atomic_fifo­/nrf_atfifo.o
    CC /mnt/c/Users/robin/Espruino/targetlibs/n­rf5x_15/components/libraries/strerror/nr­f_strerror.o
    CC /mnt/c/Users/robin/Espruino/targetlibs/n­rf5x_15/components/libraries/balloc/nrf_­balloc.o
    LD espruino_2v08.220_nrf52840.elf
    src/jslex.o: file not recognized: file format not recognized
    collect2: error: ld returned 1 exit status
    make/targets/ARM.make:2: recipe for target 'espruino_2v08.220_nrf52840.elf' failed
    make: *** [espruino_2v08.220_nrf52840.elf] Error 1
  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

WebIDE locks up while loading require("neopixel") on Nordic nRF52840 Dongle

Posted by Avatar for Robin @Robin