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?

Reply
  • 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?

Children
  • 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?

  • 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.

Related