首先,我知道代码已损坏,这不是重点。它注定要被打破。
我们在POC中有3个pycom(LoPy4,一个基于LoRa / Sigfox ESP32的开发板,通常运行python,但我们切换到了arduino)。出于某种原因(我认为是多核多线程陷阱),ESP有时会崩溃,并且尽管实现了看门狗,但它不会重新联机。
因此,我尝试在本地复制类似的崩溃,这基本上就是该草图所做的事情:
#include "esp_system.h"
#include "esp_int_wdt.h"
#include "esp_task_wdt.h"
//hw_timer_t *timer = NULL;
//void IRAM_ATTR resetModule(){
// ets_printf("reboot\n");
// esp_restart();
//}
void setup() {
Serial.begin(115200);
esp_int_wdt_init();
esp_task_wdt_init(5000, true);
enableLoopWDT();
// enableCore0WDT();
// enableCore1WDT();
//esp_task_wdt_feed();
//
// esp_int_wdt_init();
// timer = timerBegin(0, 80, true); //timer 0, div 80
// timerAttachInterrupt(timer, &resetModule, true);
// timerAlarmWrite(timer, 3000000, false); //set time in us
// timerAlarmEnable(timer); //enable interrupt
}
void loop() {
delay(500);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
digitalWrite(6, HIGH);
digitalWrite(7, HIGH);
digitalWrite(8, HIGH);
digitalWrite(9, HIGH);
digitalWrite(10, HIGH);
digitalWrite(11, HIGH);
while(true) {
Serial.print("broken");
}
}
如前所述,我不是在寻找解决此代码的方法,这很容易,只需评论一下flash-SPI端口的引脚模式/写入即可。我只是在寻找一种实现看门狗的故障安全方式,无论发生什么情况,pycom / ESP都会重置。
您可以在代码中看到,我已经尝试了几种方法,但是仍然没有运气。
这是我目前获得的输出
ets Jun 8 2016 00:22:57
rst:0x1 (POWERON_RESET),boot:0x12 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1100
load:0x40078000,len:9232
load:0x40080400,len:6400
entry 0x400806a8
Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.
Guru Meditation Error: Core 1 panic'ed (IllegalInstruction). Exception was unhandled.
Memory dump at 0x400e8c64: 00000000 00000000 00000000
Guru Meditation Error: Core 1 panic'ed (IllegalInstruction). Exception was unhandled.
Memory dump at 0x400e8c64: 00000000 00000000 00000000
Guru Meditation Error: Core 1 panic'ed (IllegalInstruction). Exception was unhandled.
Memory dump at 0x400e8c64: 00000000 00000000 00000000
Guru Meditation Error: Core 1 panic'ed (IllegalInstruction). Exception was unhandled.
Memory dump at 0x400e8c64: 00000000 00000000 00000000
Guru Meditation Error: Core 1 panic'ed (IllegalInstruction). Exception was unhandled.
Memory dump at 0x400e8c64: 00000000 00000000 00000000
Guru Meditation Error: Core 1 panic'ed (IllegalInstruction). Exception was unhandled.
Memory dump at 0x400e8c64: 00000000 00000000 00000000
Guru Meditation Error: Core 1 panic'ed (IllegalInstruction). Exception was unhandled.
Memory dump at 0x400e8c64: 00000000 00000000 00000000
Guru Meditation Error: Core 1 panic'ed (IllegalInstruction). Exception was unhandled.
Memory dump at 0x400e8c64: 00000000 00000000 00000000
Guru Meditation Error: Core 1 panic'ed (IllegalInstruction). Exception was unhandled.
Memory dump at 0x400e8c64: 00000000 00000000 00000000
Guru Meditation Error: Core 1 panic'ed (IllegalInstruction). Exception was unhandled.
Memory dump at 0x400e8c64: 00000000 00000000 00000000
Guru Meditation Error: Core 1 panic'ed (IllegalInstruction). Exception was unhandled.
Memory dump at 0x400e8c64: 00000000 00000000 00000000
Guru Meditation Error: Core 1 panic'ed (IllegalInstruction). Exception was unhandled.
Memory dump at 0x400e8c64: 00000000 00000000 00000000
Guru Meditation Error: Core 1 panic'ed (IllegalInstruction). Exception was unhandled.
Memory dump at 0x400e8c64: 00000000 00000000 00000000
Guru Meditation Error: Core 1 panic'ed (IllegalInstruction). Exception was unhandled.
Memory dump at 0x400e8c64: 00000000 00000000 00000000
Guru Meditation Error: Core 1 panic'ed (IllegalInstruction). Exception was unhandled.
Memory dump at 0x400e8c64: 00000000 00000000 00000000
Guru Meditation Error: Core 1 panic'ed (IllegalInstruction). Exception was unhandled.
Memory dump at 0x400e8c64: 00000000 00000000 00000000
Guru Meditation Error: Core 1 panic'ed (IllegalInstruction). Exception was unhandled.
Memory dump at 0x400e8c64: 00000000 00000000 00000000
Guru Meditation Error: Core 1 panic'ed (IllegalInstruction). Exception was unhandled.
Memory dump at 0x400e8c64: 00000000 00000000 00000000
Guru Meditation Error: Core 1 panic'ed (IllegalInstruction). Exception was unhandled.
Memory dump at 0x400e8c64: 00000000 00000000 00000000
Guru Meditation Error: Core 1 panic'ed (IllegalInstruction). Exception was unhandled.
Memory dump at 0x400e8c64: 00000000 00000000 00000000
Guru Meditation Error: Core 1 panic'ed (IllegalInstruction). Exception was unhandled.
Memory dump at 0x400e8c64: 00000000 00000000 00000000
Guru Meditation Error: Core 1 panic'ed (IllegalInstruction). Exception was unhandled.
Memory dump at 0x400e8c64: 00000000 00000000 00000000
Guru Meditation Error: Core 1 panic'ed (IllegalInstruction). Exception was unhandled.
Memory dump at 0x400e8c64: 00000000 00000000 00000000
Guru Meditation Error: Core 1 panic'ed (IllegalInstruction). Exception was unhandled.
Memory dump at 0x400e8c64: 00000000 00000000 00000000
Guru Meditation Error: Core 1 panic'ed (IllegalInstruction). Exception was unhandled.
Memory dump at 0x400e8c64: 00000000 00000000 00000000
Guru Meditation Error: Core 1 panic'ed (IllegalInstruction). Exception was unhandled.
Memory dump at 0x400e8c64: 00000000 00000000 00000000
Guru Meditation Error: Core 1 panic'ed (Unhandled debug exception)
Debug exception reason: Stack canary watchpoint triggered (loopTask)
Guru Meditation Error: Core 1 panic'ed (Interrupt wdt timeout on CPU1)
Guru Meditation Error: Core 1 panic'ed (Interrupt wdt timeout on CPU1)
Guru Meditation Error: Core 1 panic'ed (Interrupt wdt timeout on CPU1)
Guru Meditation Error: Core 1 panic'ed (Interrupt wdt timeout on CPU1)
Guru Meditation Error: Core 1 panic'ed (Interrupt wdt timeout on CPU1)
Guru Meditation Error: Core 1 panic'ed (Interrupt wdt timeout on CPU1)
Guru Meditation Error: Core 1 panic'ed (Interrupt wdt timeout on CPU1)
Guru Meditation Error: Core 1 panic'ed (Interrupt wdt timeout on CPU1)
Guru Meditation Error: Core 1 panic'ed (Interrupt wdt timeout on CPU1)
Guru Meditation Error: Core 1 panic'ed (Interrupt wdt timeout on CPU1)
Guru Meditation Error: Core 1 panic'ed (Interrupt wdt timeout on CPU1)
Guru Meditation Error: Core 1 panic'ed (Interrupt wdt timeout on CPU1)
Guru Meditation Error: Core 1 panic'ed (Interrupt wdt timeout on CPU1)
Guru Meditation Error: Core 1 panic'ed (Interrupt wdt timeout on CPU1)
Guru Meditation Error: Core 1 panic'ed (Interrupt wdt timeout on CPU1)
Guru Meditation Error: Core 1 panic'ed (Guru Meditation Error: Core 1 panic'ed (
此后,电台完全静音...