Hello, I followed this tutorial nRF Connect SDK Bluetooth Low Energy tutorial part 1: Custom Service in Peripheral role in order to setup custom BLE service. The tutorial as is works correctly and defines one service with an RX write characteristic and a TX notify characteristic.
BT_GATT_SERVICE_DEFINE(my_service, BT_GATT_PRIMARY_SERVICE(BT_UUID_MY_SERVICE), BT_GATT_CHARACTERISTIC(BT_UUID_MY_SERVICE_RX, BT_GATT_CHRC_WRITE | BT_GATT_CHRC_WRITE_WITHOUT_RESP, BT_GATT_PERM_READ | BT_GATT_PERM_WRITE, NULL, on_receive, NULL), BT_GATT_CHARACTERISTIC(BT_UUID_MY_SERVICE_TX, BT_GATT_CHRC_NOTIFY, BT_GATT_PERM_READ, NULL, NULL, NULL), BT_GATT_CCC(on_cccd_changed, BT_GATT_PERM_READ | BT_GATT_PERM_WRITE), );
What I tried to do is delete the RX characteristic and keep the TX one in both read and notify
BT_GATT_SERVICE_DEFINE(my_service, BT_GATT_PRIMARY_SERVICE(BT_UUID_MY_SERVICE), BT_GATT_CHARACTERISTIC(BT_UUID_MY_SERVICE_TX, BT_GATT_CHRC_NOTIFY | BT_GATT_CHRC_READ, BT_GATT_PERM_READ | BT_GATT_PERM_WRITE, on_read, NULL, &number), BT_GATT_CCC(on_cccd_changed, BT_GATT_PERM_READ | BT_GATT_PERM_WRITE), );
The read aspect works correctly and I'm able to get the data on the client interface (PC side, LightBlue)
But when I try to activate the notification, I have the following error on the Serial Monitor (nRF53 side):
[00:59:48.195,129] <wrn> bt_l2cap: Ignoring data for unknown channel ID 0x003a Error, unable to send notification err= -2
which corresponds to ENOENT 2 /**< No such file or directory */
I do not understand what is the problem.
The idea I have is that a write characteristic is needed in order for the client to enable the notification. Something like the following:
Client -> enable notification through write/RX
Peripheral -> send data through TX
is my understanding correct?