Nordic not reflashable suddenly

Nordic,

We've been using the nRF52832 for many years now.  We have a custom board that uses SWCLK and SWDIO to flash our NRF52.  We're getting set for production and I am working on our automated manufacturing rig.  We have a python script that flashes a nordic with a soft device, bootloader, and then application.  Some of the GPIO go to LEDs, so I can see what state the chip is in after programming.  It had been working great then I started getting this problem where the LEDs didn't show up in the right state.  I'd go to reflash the device, and then the SWD won't connect, and I could not erase the chip.  I can hit our reset button, tied to the RESET pin on the IC, and nothing happens.  Normally this button does a hard reset, where the LED goes away and (I believe) the chip loses power.  Upon release of the reset, the board should initialize into the bootloader and the LED blinks red marking as such.  But for these 'bricked' boards, the LED stays on throughout the reset button press.   These two things: not able to reset the chip, and not being able to reflash the chip, these are quite alarming.

One piece of good news is the current drawn seems to be about 1 mA like when the Nordic is in low power state.  

I've spent most all day going through devzone forums trying things, hoping to recover or at least explain my freeze-up.  

When I go back into J Flash Lite, I can no longer ERASE the chip.  Now it says

Connecting to J-Link...
Connecting to target...
ERROR: Could not connect to target.
Done.

Fine, I can try from the command utility.  I use the jlink.exe tool, and go through the regular steps to connect and then try to erase.  This also doesn't work:

J-Link>connect
Device "NRF52832_XXAA" selected.


Connecting to target via JTAG
InitTarget() start
InitTarget() end
TotalIRLen = ?, IRPrint = 0x..000000000000000000000000
InitTarget() start
InitTarget() end
TotalIRLen = ?, IRPrint = 0x..000000000000000000000000
InitTarget() start
InitTarget() end
TotalIRLen = ?, IRPrint = 0x..000000000000000000000000
InitTarget() start
InitTarget() end
TotalIRLen = ?, IRPrint = 0x..000000000000000000000000
Cannot connect to target.

Ok, now I try to use the nrfjprog tool.  For reference I look up the version as 

nrfjprog version: 10.15.1 external
JLinkARM.dll version: 7.58b

Then I do all kinds of commands to try and talk to my board.  Here are some

>nrfjprog --recover --log
ERROR: [SeggerBackend] - JLinkARM.dll reported "-1", "An unknown error.".
ERROR: [SeggerBackend] - JLinkARM.dll reported "-1", "An unknown error.".
ERROR: [SeggerBackend] - JLinkARM.dll reported "-1", "An unknown error.".
ERROR: [SeggerBackend] - JLinkARM.dll reported "-1", "An unknown error.".
ERROR: [SeggerBackend] - JLinkARM.dll reported "-1", "An unknown error.".
ERROR: [SeggerBackend] - JLinkARM.dll reported "-1", "An unknown error.".
ERROR: [SeggerBackend] - JLinkARM.dll reported "-1", "An unknown error.".
ERROR: [ nRFXX] - Device does not have an ARM debug port.
ERROR: [SeggerBackend] - JLinkARM.dll reported "-1", "An unknown error.".
ERROR: nrfjprog could not identify the target device. This may be due to an
ERROR: invalid family argument, a problem with your device, or nrfjprog may
ERROR: not yet support your device.
ERROR: Please check the family argument passed, or upgrade nrfjprog to a more
ERROR: recent version.

>nrfjprog -e
ERROR: nrfjprog could not identify the target device. This may be due to an
ERROR: invalid family argument, a problem with your device, or nrfjprog may
ERROR: not yet support your device.
ERROR: Please check the family argument passed, or upgrade nrfjprog to a more
ERROR: recent version.
NOTE: For additional output, try running again with logging enabled (--log).
NOTE: Any generated log error messages will be displayed.

>nrfjprog -d --family nrf52 --log
ERROR: Unable to connect to a debugger.
ERROR: [ nRF52] - Debug probe is not connected to an NRF52 series device.
ERROR: The --family option given with the command (or the default from
ERROR: nrfjprog.ini) does not match the device connected.

I know the segger and cables and everything are correct, I HAD been able to program this and other boards.  But during development of the python script, I've 'bricked' 5 of my boards.  I only have 2 left.  So I need to get to the bottom of this.

I don't understand how something could ever make the SWCLK SWDIO not able to erase the chip.  What am I missing, please help.

environment:  windows 10

  • Hi,

    Could it be that you have enabeld DCDC in software but do not have it in HW? This would "brick" the devices if that where the case, but it is fixable with some tinkering, you can supply 1.2V to the DEC4 pin. You will then be able to program the device again.

    Regards,
    Jonathan.

  • Jonathon,

    Thanks for your reply.  I tried what you suggested, I soldered a tiny lead onto the DEC4 pin and gave it 1.2V, while powering the board regularly.  I tried to Erase Chip and still had no luck.  Do you have another idea?

    Thanks,

    Darren

  • Jonathan,

    Here are some more updates.  We probed the reset, because that is such a unique failure detail.  The P0.21/Reset pin is grounded, always.  This is wrong: on a good board, this pin sits at 3V.  On the good board, when the reset hw button is pressed, it grounds the IO.  This got us thinking maybe we should put 3V on the P0.21 pin.  When we do that from an external supply, the nordic IC can be fully erased!  Which confirms the chip is somewhat alive. We even reflashed the soft device, bootloader and program onto the chip.  We can watch the serial output of the initialization. 

    But then the problem is the board seems to do a self reset every couple of seconds.  This is despite us keeping 3V applied to the P0.21 pin.  

    We get the feeling there is a pull-down inside the Nordic P0.21.  

    I saw this forum post that has this same sort of discussion, where there is a reset internal problem.  https://devzone.nordicsemi.com/f/nordic-q-a/8342/nrf52832-has-the-reset-pin-an-internal-pull-down

    Now I'm just as confused.  How could we have possibly changed the reset pin setup? Furthermore, how could a complete erase and reflashing not address whatever bad setup state we got into? 

    Hmmmm 

  • More updates.  
    The self-resetting has gone away - I'm not sure why.  On three boards we get seemingly full functionality of the board as long as the external power supply gives 3V to the P0.21 reset pin.  But whenever we turn off that supply, the chip is bricked.  

    We still haven't explained how this happens, nor how to fix it.  What could we be doing to disrupt the pull-up inside the reset pin?

  • What have you set these two registers to:

      __IOM uint32_t  PSELRESET[2]; /*!< (@ 0x00000200) Description collection[0]
      __IOM uint32_t  APPROTECT;    /*!< (@ 0x00000208) Access Port protection                                     */

    In system_nrf52.c the reset pin is set when first enabled without using the optional pull-up which is always available to the pin when not in reset:

        /* Configure GPIO pads as pPin Reset pin if Pin Reset capabilities desired. If CONFIG_GPIO_AS_PINRESET is not
          defined, pin reset will not be available. One GPIO (see Product Specification to see which one) will then be
          reserved for PinReset and not available as normal GPIO. */
        #if defined (CONFIG_GPIO_AS_PINRESET)
            if (((NRF_UICR->PSELRESET[0] & UICR_PSELRESET_CONNECT_Msk) != (UICR_PSELRESET_CONNECT_Connected << UICR_PSELRESET_CONNECT_Pos)) ||
                ((NRF_UICR->PSELRESET[1] & UICR_PSELRESET_CONNECT_Msk) != (UICR_PSELRESET_CONNECT_Connected << UICR_PSELRESET_CONNECT_Pos))){
                NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos; // Write Enable
                while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
                NRF_UICR->PSELRESET[0] = 21;
                while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
                NRF_UICR->PSELRESET[1] = 21;
                while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
                NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos; // Read-only Enable
                while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
                // UICR changes require a reset to be effective
                NVIC_SystemReset();
            }
        #endif
    

    Maybe as a test enable the pin pull-up before the first power up when the pins get mapped to the reset function and the chip resets itself; at least the pin will be high at the moment of reset. First time powered up UICR.APPROTECT setting DISABLE (0x558) = 0x5A to disable, following an erase all, required for build codes Gxx and later.

Related