Hi,
I'm currenty try to code GPIO wakeup from System ON sleep with system_on_wakeup_on_gpio as a reference.
My circuit is powerd by solar panel via control board. In this design P0_04 on nRF52832 receives the PWR_GOOD signal.
I would like to keep it in low power mode until the PWR_GOOD flag is set at the beginning of the main function.
The following code does not work even if VCC is applied manually to P0_04.
// Standards
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
#include <math.h>
// nRF
#include "nrf.h"
#include "app_error.h"
#include "app_timer.h"
#include "app_scheduler.h"
#include "nrf_delay.h"
#include "nrf_drv_clock.h"
#include "nrf_pwr_mgmt.h"
#include "nrf_gpio.h"
#include "nrf_drv_twi.h"
// User defined pin configuration
#define PIN_PWR_GOOD 4
int main(void)
{
nrf_gpio_cfg_sense_input(PIN_PWR_GOOD, NRF_GPIO_PIN_PULLDOWN, NRF_GPIO_PIN_SENSE_HIGH);
// Enter System ON sleep mode
__WFE();
__SEV();
__WFE();
...
}
I removed the unnecessary lines from the sample code above, is that the problem? I do not know how the program counter behaves after it is taken out of sleep mode.
Currently I am using the following statement and would like to consider saving electricity during this waiting period.
nrf_gpio_cfg_input(4, NRF_GPIO_PIN_PULLDOWN); while (nrf_gpio_pin_read(4) == false);
tyro