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

nRF51822 controller connection through UART/SWD.

I need to program the nrf51 controller directly from PC. How to connect nRF51822 controller from PC through UART/SWD pins to program.

  • Hi,

     

    The programmer needs SWD, SWDIO, VDD and GND, no matter which one you use.

     

    Also there are some de-facto standard connectors for this that might be interesting, which all incorporate the needed signals. See as an example J-link needle adapter and 9-pin cortex-M connector.

     

    Best regards,

    Andreas

  • I need to do something similar to the above. I have a finished pulse oximeter using the nRF51822 on a YJ-14001-nrf51822 daughter board. The device is to test a new BLE protocol specification and I have been provided with the original software in a Keil project. I need to replace the existing BLE protocol with the new protocol specification.

    According to the company, I can flash the software using SWD. They have given me the input soldering points on the daughter board to make the SWD connection on the Pulse OX. Now what I need to do is interface that to the PC. I have no idea how to do this.

    From this discussion it appears that I cannot repurpose a USB cable and flash the device from the Keil IDE even though it supports SWD via USB when using a DK..

    How do I do this directly to the nrf51822 SWD contact points? Do I need additional hardware to go from USB to SWD?

    Thanks. If this is not answered in a few days (old post) I will make an additional post.

  • Hi,

     

    Not sure I understand correctly, but the DK has a debugger IC on it (the one with the sticker) that translates the information received from Keil over the USB cable into SWD. Hypothetically you could direct SWD over a USB cable from the debugger to your target nRF51, the nRF51 just needs an electrical connection to the SWD, SWDIO, VDD and GND pins on the debugger.

    You can use P20 or P19 on the DK to program or debug an external target (instead of the nRF51 on the DK itself), see section 6.10 in the DK User Guide.

     

    Best regards,
    Andreas

  • I DO have the DK. My production target also has its own power (it is a real market device) but the device will not be on when flashing. So what you are saying is that I could take a USB cable connected from the PC and wire it directly to the SWD pins on my production device (I know where to solder the connections). Will there be a power problem? I've seen in this forum somewhere that the voltage needs of the nrf51822 are not that supplied by USB.

    Alternatively, I could connect the USB cable to the DK and wire the P20 and P19 pins to my production device. The latter sounds easier and safer as I assume that all voltage and power supply issues are worked out.

  • Hi,

    brianreinhold said:
    So what you are saying is that I could take a USB cable connected from the PC and wire it directly to the SWD pins on my production device (I know where to solder the connections)

    No, the USB port on the PC will not understand the SWD protocol. You can connect the SWD pins on your debugger to SWD through an USB cable, obviously this will not work as a 'normal' USB port (e.g. by a compunter) and for that it might not be an ideal solution as the debug USB port might be confused with a normal USB port, care must be taken for this to handle the 5V bus voltage in case it is incorrectly inserted into a normal USB port.

     

     

    brianreinhold said:
    Alternatively, I could connect the USB cable to the DK and wire the P20 and P19 pins to my production device. The latter sounds easier and safer as I assume that all voltage and power supply issues are worked out.

    Yes, this would work. The interface MCU on the DK acts as a translator, and will translate the communication from the PC (over USB) into SWD which is needed by the nRF51822 target. This needs SWDCLK and SWDIO for communication, and VDD (called VTG by the debugger) and GND for reference voltage. Note that the VTG connection on the debugger does not supply the target, you must make sure to do this externally.

     

    Best regards,
    Andreas

Related