大师冥想错误:核心0出现紧急情况LoadProhibited,CPU1上的wdt中断超时

问题描述

我正在尝试记录Li-Fi项目的光强度值。

这是我的代码

#include <soc/sens_reg.h>
#include <soc/sens_struct.h>
#include <driver/adc.h>
#include <SD.h>

#define ADC1_GPIO36_CHANNEL  ADC1_CHANNEL_0

#include <adc_channel.h>

const char filename1[] = "/part1.dat";
const char filename2[] = "/part2.dat";
File file1,file2;

int local_adc1_read(int channel) {
    uint16_t adc_value;
    SENS.sar_meas_start1.sar1_en_pad = (1 << channel); // Only one channel is selected
    while (SENS.sar_slave_addr1.meas_status != 0)
        ;

    SENS.sar_meas_start1.meas1_start_sar = 0;
    SENS.sar_meas_start1.meas1_start_sar = 1;
    while (SENS.sar_meas_start1.meas1_done_sar == 0)
        ;

    adc_value = SENS.sar_meas_start1.meas1_data_sar;
    return adc_value;
}

#define ADC_SAMPLES_COUNT 1000

int16_t abuf[ADC_SAMPLES_COUNT];
int16_t abufPos = 0;
portMUX_TYPE DRAM_ATTR timerMux = portMUX_INITIALIZER_UNLOCKED;
TaskHandle_t complexHandlerTask;
hw_timer_t * adcTimer = NULL; // Our timer

void complexHandler(void *param) {
    timerAlarmdisable(adcTimer);
    timerDetachInterrupt(adcTimer);
    timerEnd(adcTimer);
    adcTimer = NULL;
    file1 = SD.open(filename1,FILE_WRITE);
    file2 = SD.open(filename2,FILE_WRITE);
    file1.write((const byte*)abuf,abufPos);
    file2.write((const byte*)abuf,abufPos);
    file1.close();
    file2.close();
}

int counter;

void IRAM_ATTR onTimer() {
    portENTER_CRITICAL_ISR(&timerMux);

    abuf[abufPos++] = local_adc1_read(ADC1_CHANNEL_0);
    //abuf[abufPos++] = adc1_get_raw(ADC1_CHANNEL_0);

    if (abufPos >= 8) {
        if (abuf[abufPos-7] ==
            abuf[abufPos-6] ==
            abuf[abufPos-5] ==
            abuf[abufPos-4] ==
            abuf[abufPos-3] ==
            abuf[abufPos-2] ==
            abuf[abufPos-1] ==
            abuf[abufPos])
        {
            // Notify adcTask that the buffer is full.
            BaseType_t xHigherPriorityTaskWoken = pdFALSE;
            vTaskNotifyGiveFromISR(complexHandlerTask,&xHigherPriorityTaskWoken);
            if (xHigherPriorityTaskWoken) {
                portYIELD_FROM_ISR();
            }
        }
        portEXIT_CRITICAL_ISR(&timerMux);
    }
}

void setup() {
    setcpuFrequencyMhz(240);
    xTaskCreate(complexHandler,"Handler Task",8192,NULL,1,&complexHandlerTask);
    adcTimer = timerBegin(3,80,true); // 80 MHz / 80 = 1 MHz hardware clock for easy figuring
    timerAttachInterrupt(adcTimer,&onTimer,true); // Attaches the handler function to the timer
    timerAlarmWrite(adcTimer,100,true); // Interrupts when counter == 45,i.e. 22.222 times a second
    timerAlarmEnable(adcTimer);

    Serial.begin(115200);
    pinMode(2,OUTPUT);
    //pinMode(36,INPUT);
    if (!SD.begin())
        Serial.println("SD begin Failed");

    while(!SD.begin()) {
        Serial.print(".");
        //delay(500);
        SD.remove(filename1);
        SD.remove(filename2);
    }
}

void loop() {
}

我收到此错误

Guru Meditation Error: Core  0 panic'ed (LoadProhibited). Exception was unhandled.

rst:0xc (SW_cpu_RESET),boot:0x13 (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:10900
load:0x40080400,len:6388
entry 0x400806b4
Guru Meditation Error: Core  0 panic'ed (LoadProhibited). Exception was unhandled.
Core 0 register dump:
PC      : 0x400f095f  PS      : 0x00060030  A0      : 0x800d1019  A1      : 0x3ffb3f80
A2      : 0x00000000  A3      : 0x3ffb2080  A4      : 0x00000020  A5      : 0x80000020
A6      : 0x00000000  A7      : 0x00000000  A8      : 0x00000005  A9      : 0x00000020
A10     : 0x00000020  A11     : 0x3ffbc0d0  A12     : 0x80087259  A13     : 0x3ffbc0d0
A14     : 0x00000000  A15     : 0x00000000  SAR     : 0x00000000  EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000000  LBEG    : 0x00000000  LEND    : 0x00000000  LCOUNT  : 0x00000000

ELF file SHA256: 0000000000000000

Backtrace: 0x400f095f:0x3ffb3f80 0x400d1016:0x3ffb3fa0 0x40088269:0x3ffb3fe0

我尝试使用一个大型应用程序(3 MB)降低中断频率,将cpu时钟提高到240Hz,但没有任何变化。

通过注释

vTaskNotifyGiveFromISR(complexHandlerTask,&xHigherPriorityTaskWoken);

xTaskCreate(complexHandler,&complexHandlerTask);

现在错误

大师冥想错误:核心1出现了紧急情况(cpu1上的wdt中断超时)

还有一些内核1和内核0的寄存器转储。循环中没有任何变化。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)