我编辑了“任务”函数,以便初始化取决于传递的参数。
代码:
全选
wiegand_data_t data = *(wiegand_data_t *)arg;
printf("D0 = %d, D1 = %d\n", data.d0, data.d1);
// Ini
tialize reader
ESP_ERROR_CHECK(wiegand_reader_init(&reader, data.d0, data.d1, true, CONFIG_EXAMPLE_BUF_SIZE, reader_callback,
WIEGAND_MSB_FIRST, WIEGAND_LSB_FIRST));
我添加了以下形式的结构,并将其作为参数传递:
代码:
全选
typedef struct wiegand_t
{
gpio_num_t d0, d1;
} wiegand_data_t;
当我创建一个任务时一切正常,但是当我添加第二个任务时,我会收到一些我不太理解的错误。通过做这个:
代码:
全选
void app_main()
{
xTaskCreate(task, TAG, configMINIMAL_STACK_SIZE * 4, &data1, 5, NULL);
xTaskCreate(task, TAG_2, configMINIMAL_STACK_SIZE * 4, &data2, 5, NULL);
...我收到以下错误:
代码:
全选
D (654) intr_alloc: Connected src 24 to int 9 (cpu 0)
I (659) cpu_start: Starting scheduler on PRO CPU.
D (0) intr_alloc: Connected src 25 to int 2 (cpu 1)
I (0) cpu_start: Starting scheduler on APP CPU.
D (684) heap_init: New heap initialised at 0x3ffe0440
D (684) heap_init: New heap initialised at 0x3ffe4350
D (694) intr_alloc: Connected src 16 to int 12 (cpu 0)
D0 = 16, D1 = 17
D0 = 5, D1 = 18
E (694) gpio: gpio_install_isr_service(465): GPIO isr service already installed
Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.
Core 1 register dump:
PC : 0x400e658b PS : 0x00060c33 A0 : 0x800d647a A1 : 0x3ffb7630
0x400e658b: esp_intr_get_cpu at C:/Work/Programs/Espressif/frameworks/esp-idf-v5.0/components/esp_hw_support/intr_alloc.c:771
A2 : 0x00000000 A3 : 0x3ffb293c A4 : 0x00060c20 A5 : 0x00060c23
A6 : 0x3f403b0c A7 : 0x0000abab A8 : 0x800d618c A9 : 0x3ffb75f0
A10 : 0x00010000 A11 : 0x00000010 A12 : 0x00000000 A13 : 0x00060c23
A14 : 0x3ffb7610 A15 : 0x0000abab SAR : 0x00000010 EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000000 LBEG : 0x4000c46c LEND : 0x4000c477 LCOUNT : 0x00000000
文件说:
已写入/读取的地址可在寄存器转储的 EXCVADDR 寄存器中找到。如果此地址为零,通常意味着应用程序已尝试取消引用 NULL 指针
但我无法弄清楚这是在什么时候发生的。在我看来,“GPIOisr 服务已安装”错误应该不会影响,但现在我不确定......