Hello.
I need to count impulses going to nrf51822 in low power mode. I use the following code to configure GPIOTE and PPI to toggle counter and it works well:
#define PPI_CHANNEL 0 #define PULSE_INPUT_NUM 2 #define TIMER NRF_TIMER1
void initPulseCaptureInput (void) { // Configure GPIO nrf_gpio_cfg_sense_input(PULSE_INPUT_NUM, NRF_GPIO_PIN_NOPULL, NRF_GPIO_PIN_SENSE_HIGH);
// Clear TIMER TIMER->TASKS_CLEAR = 1;
// Configure TIMER for counter mode TIMER->MODE = TIMER_MODE_MODE_Counter; TIMER->BITMODE = TIMER_BITMODE_BITMODE_32Bit;
// Start TIMER TIMER->TASKS_START = 1;
NRF_PPI->CH[PPI_CHANNEL].EEP = (uint32_t)(&NRF_GPIOTE->EVENTS_PORT); NRF_PPI->CH[PPI_CHANNEL].TEP = (uint32_t)(&TIMER->TASKS_COUNT); NRF_PPI->CHENSET = (0x1UL << PPI_CHANNEL); }
But I noticed that current consumption is 1mA in sleep mode. So I guess that this current is high frequency oscillator supply current which need for timer operation? Is there any way to achieve low current consumption pulse counting in nrf51822?