ZEPHYR FATAL ERROR 4: Kernel panic on CPU 0

Hi,


I am trying to modify the matter light_bulb sample to use the Zephyr GPIO driver instead of using the DK Buttons and LEDs library, I am doing this as per the Zephyr Button sample.

But when I push the button I get the following Error:

Button pressed at 219791
ASSERTION FAIL @ WEST_TOPDIR/zephyr/kernel/mutex.c:101
E: r0/a1:  0x00000004  r1/a2:  0x00000065  r2/a3:  0x20007d58
E: r3/a4:  0x20016b04 r12/ip:  0x00000000 r14/lr:  0x000326ef
E:  xpsr:  0x6100001d
E: s[ 0]:  0x00000000  s[ 1]:  0x00000000  s[ 2]:  0x00000000  s[ 3]:  0x00000000
E: s[ 4]:  0x00000000  s[ 5]:  0x00000000  s[ 6]:  0xffffffff  s[ 7]:  0x00000000
E: s[ 8]:  0x00000000  s[ 9]:  0x00000000  s[10]:  0x00000000  s[11]:  0x00000000
E: s[12]:  0x00000000  s[13]:  0x00000000  s[14]:  0x00000000  s[15]:  0x00000000
E: fpscr:  0x00000000
E: Faulting instruction address (r15/pc): 0x0007c952
E: >>> ZEPHYR FATAL ERROR 4: Kernel panic on CPU 0
E: Fault during interrupt handling
E: Current thread: 0x20007d58 (idle)
E: Halting system

Update:

The error happens only when the callback function is as the following:

void button_pressed(const struct device *dev, struct gpio_callback *cb,
		    uint32_t pins)
{
	printk("Button pressed at %" PRIu32 "\n", k_cycle_get_32());
	LightSwitch::GetInstance().InitiateActionSwitch(LightSwitch::Action::Toggle);
}

When I comment the following line, the error disappear! 

//	LightSwitch::GetInstance().InitiateActionSwitch(LightSwitch::Action::Toggle);
 

What's the problem!?

Best Regards,

Related