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

nRF52832 flashing custom board

Hi,

I know that this question has been asked before but I was wondering if someone can help me understand if the problem is from the connections on my board or my chip is bricked and what the next step would be in my case. I have a custom board and have been trying to flash it via jlink EDU with JFlash Lite. I connected the four required pins SWDIO, SWDCLK, VREF and GND to jlink 20-pin connector pins 7, 9, 1 and 4, respectively. As said here and here, these four pins are enough. Although here it is also suggested to bring out the RESET pin. My first question is:

  • Why does the JLINK datasheet claim that the RESET pin is needed?

In fact first I thought that I missed the RESET pin (because I was not able to perform any erasing or flashing without RESET) and connected it manually to the programmer connector. After this I was able to erase the chip and flash it. But it happened only once and I could not repeat the process. The second question is:

  • Why the RESET pin affected the flashing process? Or does it make any sense that it does so? Is it possible that the JFlash Lite has a different algorithm than for example nrfjprog at least for taking the CPU to the debug mode? And I also tried programming the nRF52 DK through Debug In connected and by JLINK EDU and JFlash Lite. I could not program it without RESET pin connected. But with RESET pin I was able to program it several times and everything was OK.

I got the following error after the first time I could program the device (after this I tried with and without RESET pin connected, but always the same errors):

Erasing nRF52832_xxAA via SWD-Interface@500kHz 
Erase Thread started.
Device "NRF52832_XXAA" selected.
Found SWD-DP with ID 0x2BA01477
Could not power-up debug power domain.
Found SWD-DP with ID 0x2BA01477
Could not power-up debug power domain.
Erase Thread exited 
Initialization of debug session failed.
Could not connect to target.
  • Does this line "Found SWD-DP with ID 0x2BA01477" give any information about the hardware connection? or it might appear even when there is connection problem?

I tried with different values for the frequency. After that I realized I cannot erase the chip anymore, I thought I might have to recover the chip. I tried nRFgo Studio first. I got the error "Recover failed. Can not connect to the device". Then I tried nrfjprog with the following command (as explained here):

 nrfjprog --clockspeed 125 --family nrf52 --recover

and I get the following error:

ERROR: Cannot connect to any nRF device. Please make sure a device is
ERROR: connected to the debugger and supplied.

The power of the device is connected. Otherwise (when there is no power) I get the following error from nrfjprog:

ERROR: Low voltage detected at the target. Please make sure the device is
ERROR: properly supplied.

I did not try programming my custom board by the onboard Jlink programmer of nrf52 DK since I read in one threads that the programmer needs a minimum power about 3V from the custom board. Am I correct? the power in my custom board is 1.8V.

Another question:

  • The RESET pin is configured as IO at the startup, right? because it is pull-down in my board (used as GPIO), and I was thinking if it affects this problem.

I checked the impedance between SWDIO and SWDCLK pins with respect to GND of the circuit. It was several Mohms. I guess it's reasonable right? If so, the soldering is also find in my board.

-Vala

  • I am not sure about the nRF52832 but the nRF51822 and all other ARM based devices I have worked with, only require 3 SWD pins GND SWCLK and SWDIO

    With JLink you also need to provide Vcc to its Vcc sense pin, otherwise it doesn't think your board is powered up.

    So connect 3.3V to the Voltage sense pin

    I use both JLink and also the BlackMagic probe and I never have to connect reset (I don't even know if Blackmagic probe has a reset pin - but it may do)

    Just try using JFlash, and select the correct template for the device. Make sure you have SWDIO and SWCLK around the right way

  • Thanks for your comment Roger. By VREF in my post I meant VCC. So I have this pin connected. I cannot use jFlash for erasing or programming the MCU since I don't have its license (I'm using jLink EDU). I can only use the option 'connect' in jFlash. When I try to connect it (after choosing the right device in jFlash of course), it detects the voltage level correctly (about 1.8V) but gives me this error: ERROR: Failed to connect. The jLink datasheet says that the minimum voltage is 1.2V. So there shouldn't be a problem with 1.8V. Additionally, I have tried feeding a 3V voltage to VCC sense pin of the programmer (which is not a good practice since the voltage level of the SWDIO and SWCLK is set according to VCC sense) but still getting the same error.

  • Can you connect VREF to another supply of 3.3V then see what voltage Jflash reports.

    It doesnt need to be connected to the actual board you are programming

    If your Jlink has a 3.3V output, (some do) just connect it to that voltage

  • I powered up the MCU with 2.8V got from nRF52DK. jFlash reports the same:

    Connecting ...

    • Connecting via USB to J-Link device 0
    • Target interface speed: 200 kHz (Auto)
    • VTarget = 2.832V
    • ERROR: Failed to connect. Could not establish a connection to target.

    When I use 1.8V generated in my own board I get this:

    Connecting ...

    • Connecting via USB to J-Link device 0
    • Target interface speed: 200 kHz (Auto)
    • VTarget = 1.793V
    • ERROR: Failed to connect. Could not establish a connection to target.

    nrfjprog although gives a different report:

    λ nrfjprog --clockspeed 1000 --family nrf52 --recover Recovering device. This operation might take 30s. ERROR: JLinkARM DLL reported an error. Try again. If error condition ERROR: persists, run the same command again with argument --log, contact Nordic ERROR: Semiconductor and provide the generated log.log file to them.

    I'm not sure why it gives a DLL error. Because I am able to program the nrf52DK with same command and the same programmer (using Debug In connector).

    Also here some one was able to program the MCU with 1.7V. The minimum voltage for jLink is 1.2V.

  • And one update:

    In my first post I said that I was not able to program the nRF52DK without RESET pin connected to the programmer. It was wrong. I have no idea why. I tried it again and everything works perfectly with nRF52DK using Debug Out connector and without RESET pin used.

Related