writing to a ble characteristic

Hello everyone,

I have two devices: a Thingy53 acting as the peripheral and an nRF5340 acting as the central. I have a characteristic in a service that I want to modify using the central device. After discovering the characteristic and obtaining its handle, I attempted to write to this characteristic. However, I encountered the following error:

[00:00:06.088,745] <err> os: ***** USAGE FAULT *****
[00:00:06.088,775] <err> os:   Illegal use of the EPSR
[00:00:06.088,775] <err> os: r0/a1:  0x20001420  r1/a2:  0x00000003  r2/a3:  0x20002a48
[00:00:06.088,806] <err> os: r3/a4:  0x00000000 r12/ip:  0x00000001 r14/lr:  0x0001ca51
[00:00:06.088,806] <err> os:  xpsr:  0x60000000
[00:00:06.088,836] <err> os: Faulting instruction address (r15/pc): 0x00000000
[00:00:06.088,867] <err> os: >>> ZEPHYR FATAL ERROR 35: Unknown error on CPU 0
[00:00:06.088,897] <err> os: Current thread: 0x20001210 (BT RX)

the funtion i am using to write to the characteristic is :

void write_characteristic(struct bt_conn *conn) {

static uint8_t value_to_write[] = { 0x01, 0x02, 0x03 }; 

struct bt_gatt_write_params write_params = {

.handle = characteristic_handle,

.data = value_to_write,

.length = sizeof(value_to_write),

.func = write_func,

.offset = 0, };

int err = bt_gatt_write(conn, &write_params);

if (err) {

printk("Write failed (err %d)\n", err); }

else{ printk("Write successful\n");

}

}

Parents Reply Children
Related