adafruit / adafruit/Adafruit_nRF52_Arduino
attachInterrupt() current consumption
- Dominant language
- C
- Stars
- 699
- Forks
- 570
- PR merge metrics
- No merged PRs in 30d
Description
### Operating System
Linux
### IDE version
PlatformIO 3.4.3
### Board
adafruit_feather_nrf52832
### BSP version
1.3.0
### Sketch
`#include
#define INT_PIN 14
#define LED 17
uint8_t sleepTime = 0;
uint8_t sleepDuration = 100000;
void irqHandler()
{
Serial.print("interrupt activated");
}
void setup() {
Serial.begin(9600);
Serial.print("led ON");
Serial.end();
pinMode(LED, OUTPUT);
digitalWrite(LED, HIGH);
pinMode(INT_PIN, INPUT_PULLUP_SENSE);
attachInterrupt(INT_PIN, irqHandler, FALLING);
}
void loop()
{
sleepTime = 0;
digitalWrite(LED, HIGH);
delay(1000);
digitalWrite(LED, LOW);
delay(5000);
Serial.begin(9600);
Serial.println("sleep mode");
Serial.end();
while(sleepTime < sleepDuration){
__WFI(); //sleep mode//
sleepTime ++;
}
}`
### What happened ?
Hi, here I am facing issue regarding current consumption in sleep mode.It is drawing 13uA in sleep mode when interrupt is enabled and 1uA when interrupt is disabled. Is there any way to reduce the current in sleep mode without disabling interrupt.
### How to reproduce ?
Check the above code with attachInterrupt() and without attachInterrupt()
### Debug Log
_No response_
### Screenshots
_No response_
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the supplied sketch, focusing on attachInterrupt(), INPUT_PULLUP_SENSE, and __WFI(); reproduce and compare the two reported sleep-current measurements. Done means identifying why enabling the interrupt changes consumption and documenting a verified way to reduce it without disabling the interrupt.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- embedded-iot
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100