|
本帖最后由 lmn2005 于 2022-5-24 18:39 编辑
ESP8266 启用GPIO中断后会引起不断重启,打印内容:
rl\0l恟$鈔?l?b|帎抮b?b騨nlnnbbp?blrlp騨?l?bn鈔??b尿nn'l?l`?nn$`nr帓抧rr抈p騨?r?bbn鈔b尿nn'l`?nn$`nr帓抧rl`r拻nrl`?宭?l`鼈n抈ISR not in IRAM!
User exception (panic/abort/assert)
--------------- CUT HERE FOR EXCEPTION DECODER ---------------
Abort called
>>>stack>>>
ctx: cont
sp: 3fffff00 end: 3fffffc0 offset: 0000
3fffff00: feefeffe feefeffe feefeffe 3ffef33c
3fffff10: 000000fe 00000000 00000000 00000000
3fffff20: 00000000 00000000 00000000 00ff0000
3fffff30: 5ffffe00 5ffffe00 0001c200 3ffee564
3fffff40: 00000000 00000002 0000000d 40201dae
3fffff50: 40100489 00000001 3ffee4fc 40201dc0
3fffff60: 00000000 00000001 0000000d 402022fd
3fffff70: 00000000 feefeffe feefeffe feefeffe
3fffff80: 3fffdad0 00000000 3ffee550 4020239c
3fffff90: 3fffdad0 00000000 3ffee550 402010f5
3fffffa0: feefeffe feefeffe feefeffe 4020193c
3fffffb0: feefeffe feefeffe 3ffe85d8 40100d45
<<<stack<<<
--------------- CUT HERE FOR EXCEPTION DECODER ---------------
#define LED_Pin 4
#define K1_Pin 13
uint8 led=0;
void keyscan() // GPIO输入中断函数
{
if (analogRead(K1_Pin) == LOW)
{
delay(20);
if (analogRead(K1_Pin) == LOW)
{
Serial.println("IRQ");
if (led == 1)
turnOffLed(); //关闭灯泡
else
turnOnLed(); //打开灯泡
}
}
}
void turnOnLed() //打开灯泡
{
Serial.println("Turn ON");
led = 1;
digitalWrite(LED_Pin, LOW);
}
void turnOffLed() //关闭灯泡
{
Serial.println("Turn OFF");
led = 0;
digitalWrite(LED_Pin, HIGH);
}
void setup()
{
Serial.begin(115200);
pinMode(LED_Pin, OUTPUT);
pinMode(K1_Pin, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(K1_Pin), keyscan, FALLING); // 中断
}
void loop()
{
}
|
|