Hi, I made a beacon board only have button and leds. The version of chip is nRF51822-QFAA G0. I used the precompiled hex file in the nRF518222 Beacon v1.1.0. After I download the nrf51822_beacon_app.hex by DFU in nRF Toolbox, the beacon worked fine. The idle current is about 4uA. The problem is if once I disconnect the VCC and reconnect the VCC again, the current turns to about 1mA and never turns down. I have already disconnected the DIO and CLK pin from the debugger. I have changed many boards, it is always same. Pins of leds and button are different form PCA20006, however if I recompile the source code and change the configuration of leds and button pins, the problem still exists.
Does anyone know what is the problem and what can I do? Thanks for any help.
It is most likely due to a bug in the softdevice. It has been reported and is fixed in S110 softdevice 8.0.0. But with nRF51822 Beacon 1.1.0 you need softdevice 7.1.0/7.3.0, so the bug is present.
The cause is that the bootloader uses the 32kHz RC oscillator as clock source by default. When the bootloader forwards control to the application it will disable the softdevice. When the softdevice is using the RC oscillator and is disabled, it will leave the chip in Constant Latency mode, which consumes around 1mA current. The solution is to put the chip manually to low power mode in the bootloader code after disabling the softdevice. For this purpose, please try to add the following code after disabling the softdevice in line 314 in \nRF51822 Beacon v1.1.0\Source Code\components\libraries\bootloader_dfu\bootloader.c:
NRF_POWER->TASKS_LOWPWR = 1;
Then compile the bootloader code and flash it to the chip after flashing the softdevice.
Another solution would be to make the bootloader use a external 32kHz crystal instead of the internal RC. The beacon kit contains an external 32kHz crystal so that should be safe.
Great! It worked. You solved my problem perfectly. Thanks a lot.