Hi all
I'm working on a project based on the nRF52 chip and I'm encountering
If the system runs out of battery or no buttons are pressed within a timeout the system has to enter in SYSTEM OFF state. Once the user presses any of the connected buttons the system as to wake ad describe from the following code snippet:
void main(void) {
const struct device *gpio0;
gpio0 = device_get_binding("GPIO_0");
if (gpio0 == NULL) {
printk("Error: didn't find %s device\n", "GPIO_0");
return;
}
gpio_pin_configure(gpio0, BUTTON_TRIGGER_PIN, GPIO_INPUT | GPIO_PULL_UP | GPIO_ACTIVE_LOW);
gpio_init_callback(&button_cb_data, button_pressed, BIT(BUTTON_TRIGGER_PIN));
gpio_add_callback(gpio0, &button_cb_data);
gpio_pin_interrupt_configure(gpio0, BUTTON_TRIGGER_PIN, GPIO_INT_EDGE_BOTH);
// Configure wake Up button
nrf_gpio_cfg_sense_input(BUTTON_TRIGGER_PIN, NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_SENSE_LOW);
/* Other stuff */.
while (1) {
// OFF in caso di timeout o livello batteria critica
if (/****condition to go in deep sleep****/) {
NRF_POWER->SYSTEMOFF = 1;
}
....
}
}
The system enters in SYSTEM OFF and then wakes up correctly when the user interacts with the button 99% of the time. Unfortunately, there are some times where the system fails to wake up.
The system is powered by the standard bootload.
- Could this problem be related to the presence of the bootloader?
- Or maybe, Have I to reconfigure the gpio sense function before entering the SYSTEM OFF state?
- Have you ever had this problem?
Thanks
Andrea