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

transfert program using nRF USB port for nRF52840 DK

Hello,

Is it possible to transfer a program using the "nRF USB" on the nRF52840 DK (the on next to the 4 push bottoms) ? Until now, I was transferring the code with the other usb port (the one above the button cell) and it was ok. I want to use the other nRF USB port because it is connected directly to the nRF52840 and not through the pca10056.

the classical command : nrfjprog -f NRF52 --reset

results to ERROR: There is no debugger connected to the PC

If I want to design my own PCB, what should I do to transfer my code to the nRF52 chip ?

Thank you very much for the help, Swip

  • There is no bootloader which would serve that USB port on nRF52840 by default. But if you write some and load it first over SWD ("the other USB" if you want;) Then subsequent FW upload might be performed by any applicative way you have in your original FW including USB.

    (I guess you understand chicken and egg problem here, right? The only native way how to talk to "empty" nRF5x chip is SWD debugging/programming wires and protocol, nothing else).

  • Hi,

    In order to transfer code(program your chip), you normally use a J-Link programmer/debugger and program the chip over the SWD pins. There is an on-board Segger J-link programmer on the nRF52840-PDK you can use to program your own custom PCB. See this infocenter page for more information on that.

    As endnode states, if you want to program the device over USB, you will first need to program the nRF52840 over SWD with a USB bootloader. After you have the bootloader in place, you can do DFU over the nRF52840 USB port. We have a USB bootloader located in the folder SDK_folder\examples\dfu\experimental_bootloader_secure_usb. See this infocenter page for more information.

  • Hi! Thanks for the reply. I think the easiest way is to use the SWD pins in my case (when it seems very obscure for the moment). Correct me if I am wrong :

    1/I use my nRF52840 PDK and load my program using the SWD using the command nrfjprog command.

    2/Using your link and the p20 infocenter page and this good tutorial

    3/I need to do this

     nRF52840 PDK -> new PCB (with nRF52 chip on it),
        VTG  -> VDD,
        SWDIO ->  SWDIO,
       SWDCLK   ->  SWDCLK,
       GND DETECT  -> GND,
    

    Will the program load on my new PCB and not on the nRF52 on the PDK?

  • Thank you for the general answer. What is FW ? and Can you be more specific on how to do this please ?

  • FW means firmware (aka your application binary). And I don't think I can be any more specific then what Sigur suggested above. You got it in principle (as you have the correct sequence in your comment above) so now just do it. Just make sure that you wire P19 or P20 correctly (or any similar equivalent on any other SWD flashing board you will decide to use, it doesn't need to be SEGGER J-Link), it's not just about power, ground and two SWD wires, you typically need to ground and power other pins as well. Luckily there are so many guidelines here on the forum and on the internet that you should always find good help.

Related