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

After I have compiled a simple "Hello World" type of program into a hex file for the nRF52840. How do I upload it to the nRF52840 dongle over the USB connection from a PC running Windows?

Exactly what steps do I follow?

Parents
  • I think I may see part of the problem: the dongle contains no dedicated USB chip.  So, unless the "Hello World" sketch that I upload to the dongle contains some USB initialization code in it, the dongle basically loses all USB connectivity at that point.  Correct?  At least that might explain why nRF Connect can no longer find the dongle after I uploaded my Hello World sketch to it.

    If that is true, what is some very simple USB initialization code that I can include with my "Hello World" sketch so that this doesn't happen in the future?

  • The dongle contains a bootloader, which is what makes it possible to update the FW via the nRF Connect Programmer app. Before we try any more drastic measures, could you try unplugging the dongle, plugging it back in & then pressing the reset button? The dongle LED should then blink red, indicating that the dongle is in bootloader mode.

  • Great! Can you try uploading the softdevice & the application (e.g. ble_app_blinky) using the nrf connect for desktop programmer app. The dongle needs to blink red for nrf connect to connect to the dongle. You could also try running the ble app & upload the firmware when it asks you to. This will enable you to use the dongle as a bluetooth device sniffer.

  • Uh, where is the ble_app_blinky?  I tried going to the dongle page to find it, but right now I instead get "The requested URL /topic/com.nordic.infocenter.nrf52/dita/nrf52/development/nrf52840_dongle/getting_started.html was not found on this server."

    So, instead of that, I tried writing to it a hex file I wrote that works on the nrf52840-dk, which acts as a simple radio beacon (using Nordic's proprietary mode for the radio).  Well, that almost worked, but in the end it apparently failed.  Here is the log:

    06:45:38.576	Application data folder: C:\Users\CoolerMaster\AppData\Roaming\nrfconnect\pc-nrfconnect-programmer
    06:45:38.866	Using nrfjprog library 9.7.1, pc-nrfjprog-js 1.2.0
    06:45:46.298	Using USB SDFU protocol to communicate with target
    06:45:46.353	Protocol Version: 1 found
    06:45:46.368	Hardware: 52840 found
    06:45:46.381	Firmware: Bootloader found
    06:45:46.382	Firmware: SoftDevice found
    06:45:46.382	Firmware: Application found
    06:46:47.965	Parsing .hex file: C:\Users\CoolerMaster\Downloads\experiment_v001.NRF52840_DK (39).hex
    06:46:47.975	File was last modified at 9/12/2018, 8:14:47 PM
    06:46:48.566	Data block: 0x00000000-0x00000964 (0x00000964 bytes long)
    06:46:48.566	Data block: 0x00001000-0x000206F0 (0x0001F6F0 bytes long)
    06:47:41.063	Hash is generated by SHA256
    06:47:41.064	Hash is generated by SHA256
    06:47:41.078	Performing DFU. This may take a few seconds
    06:47:41.129	DFU procedure starts. This may take a few seconds.
    06:47:48.664	DFU for SoftDevice completed successfully!
    06:47:48.664	1 dfu package(s) left.
    06:47:48.664	Waiting for device
    06:47:48.685	DFU procedure starts. This may take a few seconds.
    06:47:52.036	DFU for Application completed successfully!
    06:47:52.036	0 dfu package(s) left.
    06:47:52.036	Waiting for device
    06:47:57.037	Reopen device failed: Timeout while waiting for device C4A688852ED9 to be attached and enumerated
    06:47:57.038	Nordic DFU Trigger Interface was not found.Please physically reset device.
    06:47:57.041	Device not found due to failure during DFU
    06:47:57.125	Target device closed.

    And the radio beacon isn't sending either.

    i.e. Close, but no cigar.  What to do now?

Reply
  • Uh, where is the ble_app_blinky?  I tried going to the dongle page to find it, but right now I instead get "The requested URL /topic/com.nordic.infocenter.nrf52/dita/nrf52/development/nrf52840_dongle/getting_started.html was not found on this server."

    So, instead of that, I tried writing to it a hex file I wrote that works on the nrf52840-dk, which acts as a simple radio beacon (using Nordic's proprietary mode for the radio).  Well, that almost worked, but in the end it apparently failed.  Here is the log:

    06:45:38.576	Application data folder: C:\Users\CoolerMaster\AppData\Roaming\nrfconnect\pc-nrfconnect-programmer
    06:45:38.866	Using nrfjprog library 9.7.1, pc-nrfjprog-js 1.2.0
    06:45:46.298	Using USB SDFU protocol to communicate with target
    06:45:46.353	Protocol Version: 1 found
    06:45:46.368	Hardware: 52840 found
    06:45:46.381	Firmware: Bootloader found
    06:45:46.382	Firmware: SoftDevice found
    06:45:46.382	Firmware: Application found
    06:46:47.965	Parsing .hex file: C:\Users\CoolerMaster\Downloads\experiment_v001.NRF52840_DK (39).hex
    06:46:47.975	File was last modified at 9/12/2018, 8:14:47 PM
    06:46:48.566	Data block: 0x00000000-0x00000964 (0x00000964 bytes long)
    06:46:48.566	Data block: 0x00001000-0x000206F0 (0x0001F6F0 bytes long)
    06:47:41.063	Hash is generated by SHA256
    06:47:41.064	Hash is generated by SHA256
    06:47:41.078	Performing DFU. This may take a few seconds
    06:47:41.129	DFU procedure starts. This may take a few seconds.
    06:47:48.664	DFU for SoftDevice completed successfully!
    06:47:48.664	1 dfu package(s) left.
    06:47:48.664	Waiting for device
    06:47:48.685	DFU procedure starts. This may take a few seconds.
    06:47:52.036	DFU for Application completed successfully!
    06:47:52.036	0 dfu package(s) left.
    06:47:52.036	Waiting for device
    06:47:57.037	Reopen device failed: Timeout while waiting for device C4A688852ED9 to be attached and enumerated
    06:47:57.038	Nordic DFU Trigger Interface was not found.Please physically reset device.
    06:47:57.041	Device not found due to failure during DFU
    06:47:57.125	Target device closed.

    And the radio beacon isn't sending either.

    i.e. Close, but no cigar.  What to do now?

Children
  • You will need to download the nordic sdk found here. You can download the latest one. Then, go to examples/ble_peripheral/ble_app_blinky. Take a look at the documentation here for more info.

  • Thanks.  I just now tried that, and it fails in the same way.  Here's the log:

    07:40:44.723	Application data folder: C:\Users\CoolerMaster\AppData\Roaming\nrfconnect\pc-nrfconnect-programmer
    07:40:45.042	Using nrfjprog library 9.7.1, pc-nrfjprog-js 1.2.0
    07:40:54.050	Using USB SDFU protocol to communicate with target
    07:40:54.106	Protocol Version: 1 found
    07:40:54.120	Hardware: 52840 found
    07:40:54.136	Firmware: Bootloader found
    07:40:54.137	Firmware: SoftDevice found
    07:40:54.137	Firmware: Application found
    07:41:05.972	Parsing .hex file: C:\Users\CoolerMaster\Downloads\nRF5_SDK_15.2.0_9412b96 (1)\nRF5_SDK_15.2.0_9412b96\examples\ble_peripheral\ble_app_blinky\hex\ble_app_blinky_pca10059_s140.hex
    07:41:05.981	File was last modified at 9/7/2018, 11:43:56 PM
    07:41:06.638	Data block: 0x00000000-0x00000A18 (0x00000A18 bytes long)
    07:41:06.639	Data block: 0x00001000-0x00025E7C (0x00024E7C bytes long)
    07:41:15.629	Hash is generated by SHA256
    07:41:15.630	Hash is generated by SHA256
    07:41:15.642	Performing DFU. This may take a few seconds
    07:41:15.696	DFU procedure starts. This may take a few seconds.
    07:41:24.093	DFU for SoftDevice completed successfully!
    07:41:24.093	1 dfu package(s) left.
    07:41:24.093	Waiting for device
    07:41:24.112	DFU procedure starts. This may take a few seconds.
    07:41:27.270	DFU for Application completed successfully!
    07:41:27.270	0 dfu package(s) left.
    07:41:27.270	Waiting for device
    07:41:32.272	Reopen device failed: Timeout while waiting for device C4A688852ED9 to be attached and enumerated
    07:41:32.272	Nordic DFU Trigger Interface was not found.Please physically reset device.
    07:41:32.278	Device not found due to failure during DFU
    07:41:32.363	Target device closed.

    Also, it's not blinking either.  :(

    However, there is a green LED on the dongle, and it is fully lit and staying that way.  Does that mean something?  So, on a positive note, at least something has changed compared to how it was before.

    What to do now?

  • OK, I just now tried downloading my nRF52840 hex file to a brand new, fresh out of the wrapper dongle, and I get the same result:

    07:59:29.873	Application data folder: C:\Users\CoolerMaster\AppData\Roaming\nrfconnect\pc-nrfconnect-programmer
    07:59:30.170	Using nrfjprog library 9.7.1, pc-nrfjprog-js 1.2.0
    07:59:39.705	Parsing .hex file: C:\Users\CoolerMaster\Downloads\experiment_v001.NRF52840_DK (39).hex
    07:59:39.714	File was last modified at 9/12/2018, 8:14:47 PM
    07:59:40.315	Data block: 0x00000000-0x00000964 (0x00000964 bytes long)
    07:59:40.316	Data block: 0x00001000-0x000206F0 (0x0001F6F0 bytes long)
    07:59:40.316	Data block: 0x00021000-0x00027D4C (0x00006D4C bytes long)
    07:59:40.334	SoftDevice detected, id 0x8F (S132 v5.0.0)
    07:59:52.557	Using USB SDFU protocol to communicate with target
    07:59:52.613	Protocol Version: 1 found
    07:59:52.628	Hardware: 52840 found
    07:59:52.638	Firmware: Bootloader found
    07:59:52.668	SoftDevice detected, id 0x8F (S132 v5.0.0)
    08:00:03.582	SdReq for SoftDevice is set as 0x00.
    08:00:03.586	Hash is generated by SHA256
    08:00:03.587	Hash is generated by SHA256
    08:00:03.601	Performing DFU. This may take a few seconds
    08:00:03.654	DFU procedure starts. This may take a few seconds.
    08:00:11.186	DFU for SoftDevice completed successfully!
    08:00:11.187	1 dfu package(s) left.
    08:00:11.187	Waiting for device
    08:00:11.203	DFU procedure starts. This may take a few seconds.
    08:00:14.556	DFU for Application completed successfully!
    08:00:14.556	0 dfu package(s) left.
    08:00:14.556	Waiting for device
    08:00:19.559	Reopen device failed: Timeout while waiting for device C33AAD4959C9 to be attached and enumerated
    08:00:19.559	Nordic DFU Trigger Interface was not found.Please physically reset device.
    08:00:19.565	Device not found due to failure during DFU
    08:00:19.650	Target device closed.

    So, clearly, this is not a case of a defective dongle.  Rather, it looks to me like Nordic's experimental USB programmer app is fatally flawed.  

    Can you confirm?

  • Did you read the testing documentation I provided? From what you wrote, it seems like you just programmed your dongle successfully. Download nRF Connect for Mobile (iOS or Android), scan for the ble blinky device, connect to it, click the up arrow under Nordic Blinky LED. Then, set the write value to 1 or 0 to turn the LED on or off. You can also test with the blinky example in the peripheral folder. That example should make the LEDs on the dongle blink in different colors.

  • No, that is not the case. The dongle is not defective & the programmer works exactly like it should most likely. Just check out my other comment. Slight smile

Related