I have to preface this post saying the bug could be on my side. My C skills are questionable on a good day.
I am working on a driver for the Adafruit TSL2561 lux sensor. I think I am close to having it working except I keep running into issues with the whole chip crashing after about 5 minutes of running. The driver can be found here. As you can see the code is pretty simple, it just queries the I2C bus for the four byte registers the device exposes, does some math to calculate the lux (which has the appearance of working), then pauses for second.
However, if I let the code run for several minutes (I timed it one time @ ~8:20) it eventually faults out and dumps the core with the following details. Since the fault happens after running several minutes it makes me think that something is not being released properly. The issue could be on my side, but near as I can tell I am releasing resources as instructed in the docs and all the examples I have seen.
I could use some additional help.
(I'm including the beginning and end of the printf statements since (I think) the number in ESP_LOGI is time related and it might be of use).
--- forcing DTR inactive
--- forcing RTS inactive
--- Miniterm on /dev/ttyUSB0 115200,8,N,1 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
ets Jun 8 2016 00:22:57
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
ets Jun 8 2016 00:22:57
rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0x00
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0008,len:8
load:0x3fff0010,len:2388
load:0x40078000,len:6788
load:0x40080000,len:252
entry 0x40080034
I (511) heap_alloc_caps: Initializing. RAM available for dynamic allocation:
I (512) heap_alloc_caps: At 3FFB4B28 len 0002B4D8 (173 KiB): DRAM
I (521) heap_alloc_caps: At 3FFE8000 len 00018000 (96 KiB): D/IRAM
I (542) heap_alloc_caps: At 40093DE8 len 0000C218 (48 KiB): IRAM
I (563) cpu_start: Pro cpu up.
I (574) cpu_start: Single core mode
I (587) cpu_start: Pro cpu start user code
I (863) phy: phy_version: 258, Nov 29 2016, 15:51:07, 0, 0
I (942) cpu_start: Starting scheduler on PRO CPU.
I (952) mailbox: I2C Master mode set in init_2561()
data_1l: 41
data_1h: 04
data_2l: 4b
data_2h: 02
I (956) mailbox: 1x value 13870
I (960) mailbox: calculated 1ux value 53
.......
data_1l: 04
data_1h: 03
data_2l: c8
data_2h: 01
I (498944) mailbox: 1x value 855
I (498944) mailbox: calculated 1ux value 0
E (499946) i2c: i2c command link malloc error
abort() was called at PC 0x4008156f
Guru Meditation Error: Core 0 panic'ed (abort)
Backtrace: 0x4008389f:0x3ffb6640 0x40083d4d:0x3ffb6660 0x40081594:0x3ffb6680 0x400816c4:0x3ffb66b0 0x400dacce:0x3ffb66d0 0x400d6be4:0x3ffb6990 0x400d6b7f:0x3ffb69e0 0x400e6a44:0x3ffb6a10 0x400e6aa1:0x3ffb6a30 0x400e6b49:0x3ffb6a60 0x400d0849:0x3ffb6a80
================= CORE DUMP START =================
uA4AAAQAAAB0AQAA
DGv7P4Bl+z8Aa/s/
gGn7P6Bq+z8mnwcADDX7Pww1+z8Ma/s/BDX7PxgAAACAfPs/gHz7Pwxr+z8AAAAA
AQAAAARb+z9tYWluAOvfFLn3QTQtMrQAAAAAAABr+z8BAAAAIAMGAAEAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOBL+z9ITPs/sEz7PwAAAAAAAAAA
AQAAAAAAAACIPkA/AAAAAEgdAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8wK8
Z2X7P584CEA2DQYATT0IgEBm+z8AAAAAIAMGACAHBgBITPs/AAAAAAAAAABcHPs/
AQAAACQAAAAkAAA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AAAAAAABQU/s/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
/////wAAAAAAAAAAAAAAAIxO+z8AAAAAAQAAAAAAAAAAAAAAcFP7PwAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAMIJCIAAPP4/cDT7Pyg3+z8AAAAAAAAAAHxT+z8AAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
================= CORE DUMP END =================
CPU halted.
The decoded dump is here:
espcoredump.py v0.1-dev
===============================================================
==================== ESP32 CORE DUMP START ====================
================== CURRENT THREAD REGISTERS ===================
/home/ivan/e/crosstool-NG/.build/src/gdb-7.10/gdb/findvar.c:290: internal-error: value_of_register_lazy: Assertion `frame_id_p (get_frame_id (frame))' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) [answered Y; input not from terminal]
/home/ivan/e/crosstool-NG/.build/src/gdb-7.10/gdb/findvar.c:290: internal-error: value_of_register_lazy: Assertion `frame_id_p (get_frame_id (frame))' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Create a core file of GDB? (y or n) [answered Y; input not from terminal]
GDB/MI command failed (None / None)!
==================== CURRENT THREAD STACK =====================
GDB/MI command failed (None / None)!
======================== THREADS INFO =========================
GDB/MI command failed (None / None)!
======================= ALL MEMORY REGIONS ========================
Name Address Size Attrs
.rtc.text 0x400c0000 0x0 RW
.iram0.vectors 0x40080000 0x400 R XA
.iram0.text 0x40080400 0x139e8 R XA
.dram0.data 0x3ffb0000 0x1c34 RW A
.flash.rodata 0x3f400010 0x61e0 RW A
.flash.text 0x400d0018 0x19aa0 R XA
.coredump.tasks 0x3ffb7c64 0x174 RW
.coredump.tasks 0x3ffb91f0 0x270 RW
.coredump.tasks 0x3ffb946c 0x174 RW
.coredump.tasks 0x3ffb8240 0x164 RW
.coredump.tasks 0x3ffba730 0x174 RW
.coredump.tasks 0x3ffba5e0 0x144 RW
.coredump.tasks 0x3ffb9c24 0x174 RW
.coredump.tasks 0x3ffb9b30 0xe8 RW
.coredump.tasks 0x3ffc9f10 0x174 RW
.coredump.tasks 0x3ffc9e10 0xf4 RW
.coredump.tasks 0x3ffbc5d8 0x174 RW
.coredump.tasks 0x3ffbc4d0 0xfc RW
.coredump.tasks 0x3ffbb708 0x174 RW
.coredump.tasks 0x3ffbb5e0 0x11c RW
.coredump.tasks 0x3ffc94a4 0x174 RW
.coredump.tasks 0x3ffc9390 0x108 RW
.coredump.tasks 0x3ffb7540 0x174 RW
.coredump.tasks 0x3ffb7450 0xe4 RW
===================== ESP32 CORE DUMP END =====================
===============================================================
Done!
Resource leak in I2C?
Re: Resource leak in I2C?
i2c_cmd_link_delete only called once in callI2C
Who is online
Users browsing this forum: No registered users and 42 guests