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

how does the nrf52832 decide to enter the swd mode?

hi

my question is really basic, but i am not able to find an answer anywhere else. I am trying to program the nordic using its SWDIO and SWCLK pins and am stuck as i get " emulator not found" error. I am wondering what the problem could be. How does the nrf52832 detect a swd programmer connected and decide to enter the debug mode as against running its existing code if any? 

is a reset or some specific signal on any other pin necessary?

I have used the nrf51822 before and i only connected SWDIO, SWCLK, VCC and GND and everything worked well. but with the nrf52832 i am having issues programming the IC.

thanks in advance for the answer

Parents
  • For the specific debugger that you're using, it seems that it has limited support according to this page: https://www.waveshare.com/arm-debugger.htm

    It mentions that this only works with the nRF51822 board. I suspect that the manufacturer does not support other devices with this specific programmer, but I would recommend contacting them to double check.

    Best regards,

    Håkon

  • thanks!

    yes it seems so.. i will check with the manufacturer. However i would still want to know the answer to my question "How does the nrf52832 detect a swd programmer connected and decide to enter the debug mode as against running its existing code if any? "

    because i am not finding sufficient documentation on the reset process from hardware + firmware perspective at one place

  • the processor doesn't detect it - the debugger connects, powers up the debug port which is a separate piece of hardware inside the cortex-M and then halts the processor, or resets it or reads registers. There really isn't a separate debug mode, there's just running with and without the debug port powered up and in-use or not. Of course with the DAP powered bits of the power and clock systems remain running all the time so the chip can't go into low power mode (for instance). 

    To your point in the next mail - a debugger can't damage the device, so you're getting it into a state it's not being responsive to what you're trying, however it's undamaged. 

  • yes, i searched for the error i am getting in the log, looks like many such cases for the nrf52.

    . . . . nRFXX_write_debug_port_register: JLinkARM.dll CORESIGHT_WriteAPDPReg returned error -1. . . . nRFXX_power_debug_and_system_regions: JLinkARM.dll CORESIGHT_WriteAPDPReg returned error -102.

    after this is the device getting "locked" in some way and there is no way to program it using SWD?

    Many threads with similar say it many be due to unstable power or RESET pin being not connected.

    I tried PCBs with 2 different layouts and power and i do not really doubt power issue on that. The RESET pin however unfortunately i left unused and is not brought out of the QFN. i might have to try and actually solder something on the QFN ic to pull the RESET to 3V.

  • have you tried 

    nrfjprog --recover 

    because it's possible the debug port is locked and so it won't power up. As far as I can tell from guessing what the logfile means it's trying to do a write to the DP SELECT register which is a fairly basic operation. 

  • i pulled up the reset pin and then tried recover by connecting to the DK. i powered the custom board separately, not from the DK. 

    Problem solved this way. 

    I understand DK is not licence for production programming. Which segger part numbers can be used for the Nrf52X ? 

  • As a side note, nordic can consider bringing out the reset and SWO pins in their reference designs and kept as optional. it will be good heads up for the people using the designs.

Reply Children
Related