NUS shut down & restart

I've built a project based on the peripheral_uart appliction. This is working well, but I need to now sort out the lowpower mode. My product is battery powere & I need to turn everything off when the power button is pressed.

Is there a deffined way to do this?

I will also need to restart it when the power button is pressed again.

Parents
  • Hi Priyanka,

    I've now finally got back on to this. I'm using the dk_buttons library

    gpio_pin_set_dt(&j3pins[2], 1); //### test probe: set high when enter poweroff
    sys_poweroff();
    gpio_pin_set_dt(&j3pins[2], 0); //### test probe: set low when exit poweroff
    Monitoring my test probe pin it goes high as expected when entering sys_poweroff() & when I press my button my test probe goes low as expected, but it doesn't carry on running from where it left off. I then put a break point at the system start which it hit. It seams to reset my code & run from the begining?
    Is that correct?
    Also I noticed your comment in the other ticket saying that dk_buttons_and_leds.c library you see a higher IDLE current.
    does "sense-edge-mask = <0x01800000>; /* 1<<24 | 1 <<23 */" solve this issue? If so, are this bits related for their GPIO pins (23 & 24)?
Reply
  • Hi Priyanka,

    I've now finally got back on to this. I'm using the dk_buttons library

    gpio_pin_set_dt(&j3pins[2], 1); //### test probe: set high when enter poweroff
    sys_poweroff();
    gpio_pin_set_dt(&j3pins[2], 0); //### test probe: set low when exit poweroff
    Monitoring my test probe pin it goes high as expected when entering sys_poweroff() & when I press my button my test probe goes low as expected, but it doesn't carry on running from where it left off. I then put a break point at the system start which it hit. It seams to reset my code & run from the begining?
    Is that correct?
    Also I noticed your comment in the other ticket saying that dk_buttons_and_leds.c library you see a higher IDLE current.
    does "sense-edge-mask = <0x01800000>; /* 1<<24 | 1 <<23 */" solve this issue? If so, are this bits related for their GPIO pins (23 & 24)?
Children
Related