Ruuvi Tag is not detected by debugger

I have one of these tags and was using for Bluetooth Mesh purposes. Since it was battery powered I was aiming to reduce the current consumption using various CONFIG permutations. But then, I found that the light_switch example from Nordic enables it as a LOW_POWER_NODE and it was then supposed to improve battery life. I changed the board into ruuvi_ruuvitag in the build configuration, built the firmware and flashed it onto the tag using a JLink debugger.

After flashing I could not see the mesh node on the NRF mesh mobile app. Then I was trying to reflash again but from then onwards my debugger was not detecting the tag anymore. It was giving me this error in VSCode

Flashing build to 682230353

west flash -d /home/jeason/mesh/hyp_mesh_tag/build --skip-rebuild --dev-id 682230353 --recover

– west flash: using runner nrfjprog

– runners.nrfjprog: Recovering and erasing all flash memory.

Recovering device. This operation might take 30s.

[error] [ Client] - Encountered error -21: Command recover executed for 5713 milliseconds with result -21

[error] [ Worker] - An unknown error.

ERROR: Recover failed. Please make sure that the correct device family is given

ERROR: and try again.

NOTE: For additional output, try running again with logging enabled (–log).

NOTE: Any generated log error messages will be displayed.

FATAL ERROR: command exited with status 62: nrfjprog --recover -f NRF52 --snr 682230353

and this error on Nrf Connect Desktop Programmer.

I tried the same firmware on a nrf52DK nrf52832 and can say was working as intented. I tried using different NRF DK as debuggers to flash the tag was not working. I tried different cables, same result. Also tried different computers, no success.

Eventhough the tag does not appear of the mesh app or cannot be flashed, it is still drawing 0.45mA of current doing nothing. I assume that it means I have not fried the chip.

Is there any way to revive the tag??

Hello,

If the tag is using 0.45 mA it’s doing something useful with CPU, being just halted consumes around 4 mA.

Are you sure your tag is powered by something? The Link debugger might not provide power by default, some programmers require the tag to be powered by its own battery.

The recover command itself should erase the flash after which you can try again flashing.

The tag is powered with an external power supply at 3V. I have an another tag which is powered by the same power supply which gets detected by the debugger. But that one has different firmware on it. Is it possible some firmware I have written on it can disable the on board debugging on the tag?

nRF52 has a memory protection feature that disables the debug interface, but it’s my understanding that --recover should trigger a full erase of the chip and release the protection afterwards.

Working with the nRF52 Series' improved APPROTECT - Blogs - Nordic Blog - Nordic DevZone has instructions for enabling app protection and unlocking a protected chip.