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

Current comsumption during button pressed and don't let go

Hi all!

I got a little problem with my ble device. That is: my device takes system_off mode as initial mode, when being pressed the button, it will wake up and start advertising (just the same as the ble_app_hrs example).

And the problem is: I added this code to my button: while(nrf_gpio_pin_read(EVAL_BOARD_BUTTON_0) == 0) ;
in order to keep the program runing forever here if I press the button and don't let go. Then i measured the current: about 4 mA,and I can not accept this current comsumption. Can you tell me a method to decrease the current comsumption?(had better decrease to uA level)

By the way, I have try: while(nrf_gpio_pin_read(EVAL_BOARD_BUTTON_0) == 0) sd_app_event_wait(); and there seems to be no help.

Looking forward to your reply, thank you very much!

  • Hi kk,

    The 4mA means the CPU haven't entered sleep mode yet.

    Have you cleared the event register before you enter the loop ? Also it's not a good idea to have a loop for sleep inside the interrupt handler, you would need a higher priority to wake the chip up.

    I would suggest you to catch the pulse when you release the button instead of when you pressing it (for example instead of GPIO_PIN_CNF_SENSE_High you use GPIO_PIN_CNF_SENSE_Low ) So that the chip only wake up when you release the button.

Related