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

Flashing nRF52840 dongle from Visual Studio Code using nrfjprog as in the Makefile

Hi, I'm really pleased with myself as I have set up my VS Code in windows to build and clean blinky and can drag the _build hex file to nRFConnect and flash it to my dongle.

I have tried to use the make flash command from the terminal in VS Code (from command line and through a task) but it doesn't like it.

It says:

Flashing: _build/nrf52840_xxaa.hex
nrfjprog -f NRF52 --program _build/nrf52840_xxaa.hex --sectorerase
ERROR: There is no debugger connected to the PC.
make: *** [Makefile:143: flash] Error 41
The terminal process "C:\Program Files\PowerShell\7\pwsh.exe -Command make flash" terminated with exit code: 1.

Okay, so I assume this was developed for the development board for nRF52840 and not the dongle. I don't have a debugger (i suppose I should buy the Segger one?)

However if nRFConnect>Programmer can do it, why can't nrfjprog? Or are the Makefile settings wrong. I'm going to assume that nRFConnect>Programmer is NOT using nrfjprog?

Man, I'm getting to old for these adventure games.... Slight smile

Gordon

Parents
  • Okay, sorted it, eventually:

    # Flash the program
    flash: default
      @echo Flashing: $(OUTPUT_DIRECTORY)/nrf52840_xxaa.hex
      
      nrfutil pkg generate --hw-version 52 --sd-req 0x00 --application-version 1 --application $(OUTPUT_DIRECTORY)/nrf52840_xxaa.hex  $(OUTPUT_DIRECTORY)/dfu.zip
      nrfutil pkg display $(OUTPUT_DIRECTORY)/dfu.zip
      nrfutil dfu usb-serial -pkg $(OUTPUT_DIRECTORY)/dfu.zip -p com7 -b 115200

    You will need to change com7 (use windows device manager) and possibly your baud rate to match your port.

    Note that it is probably only necessary to use flash in the tasks as it builds again.

    I out in a line to display the contents of the package, but it isn't necessary.

    Well I escaped that dungeon, let's see if I can get a buetooth app to work....Here we go again.

    Gordon

    (This can be closed I think.)

    p.s. don't foget Makefile uses tab characters for indents, nt spaces. Be careful if copying and pasting.

    Oh and the Brave browser has real issues with these pages??

Reply
  • Okay, sorted it, eventually:

    # Flash the program
    flash: default
      @echo Flashing: $(OUTPUT_DIRECTORY)/nrf52840_xxaa.hex
      
      nrfutil pkg generate --hw-version 52 --sd-req 0x00 --application-version 1 --application $(OUTPUT_DIRECTORY)/nrf52840_xxaa.hex  $(OUTPUT_DIRECTORY)/dfu.zip
      nrfutil pkg display $(OUTPUT_DIRECTORY)/dfu.zip
      nrfutil dfu usb-serial -pkg $(OUTPUT_DIRECTORY)/dfu.zip -p com7 -b 115200

    You will need to change com7 (use windows device manager) and possibly your baud rate to match your port.

    Note that it is probably only necessary to use flash in the tasks as it builds again.

    I out in a line to display the contents of the package, but it isn't necessary.

    Well I escaped that dungeon, let's see if I can get a buetooth app to work....Here we go again.

    Gordon

    (This can be closed I think.)

    p.s. don't foget Makefile uses tab characters for indents, nt spaces. Be careful if copying and pasting.

    Oh and the Brave browser has real issues with these pages??

Children
No Data
Related