ASSERTION FAIL Error Issue

Hello!
I am working on nrf52840 NCS  2.6.0v

I Configured the button to generate an interrupt every time it is pressed. Then, inside the interrupt handler (callback function) of the button I wrote below function.

void button_pressed(const struct device *dev, struct gpio_callback *cb, uint32_t pins)
{
	int err;
	
	if(BIT(button.pin) & pins)
	{
		if(gpio_pin_get_dt(&button))
		{
			button_pressed_var = !button_pressed_var;
            if(button_pressed_var)
			{
				err = bt_disable();
				if (err) {
					LOG_ERR("Bluetooth init failed (err %d)", err);
					return -1;
				}

				"or"

				err = bt_le_adv_stop();
    			if (err) {
       				 printk("Failed to stop advertising (err %d)\n", err);
				}
				printk("device Off: \n");
			}
			else
			{
				 err = bt_enable(NULL);
				 if (err) {
			     	LOG_ERR("Bluetooth init failed (err %d)", err);
				 	return -1;
				 }				
				 printk("device On: \n");
			}

		}
	}
            /* Button changed its state to pressed */
 
	
}
/* STEP 5 - Define a variable of type static struct gpio_callback */
static struct gpio_callback button_cb_data;

I got below error.

ASSERTION FAIL [err == 0] @ WEST_TOPDIR/zephyr/subsys/bluetooth/host/hci_core.c:331
        command opcode 0x200a timeout with err -11
[00:00:06.575,561] <err> os: r0/a1:  0x00000003  r1/a2:  0x00000000  r2/a3:  0x00000002
[00:00:06.575,592] <err> os: r3/a4:  0x20001758 r12/ip:  0x00000010 r14/lr:  0x0001260d
[00:00:06.575,592] <err> os:  xpsr:  0x41000016
[00:00:06.575,592] <err> os: Faulting instruction address (r15/pc): 0x00012618
[00:00:06.575,653] <err> os: >>> ZEPHYR FATAL ERROR 3: Kernel oops on CPU 0
[00:00:06.575,653] <err> os: Fault during interrupt handling

[00:00:06.575,683] <err> os: Current thread: 0x200027f8 (unknown)


How to disable BLE or stop the BLE advertising when i press the button and gain I press the button How to advertise BLE 

I am searched lot of dev tickets everything is related to nrfSDK.

Please help on this.

Thank you in advance.

Related