Hello. I am working on a application in a NRF5238 with s132, where I send 20 byte packets using notifications from a peripheral to a central board. The central is a modified version of the hrs_c example, while the peripheral is a custom BLE app.
When the boards connect, I immediately enable notifications on the peripheral because I have had quite a lot of trouble enabling them from the central board. Note that this seemed to be working fine initially so I believe it may not be the cause:
static void on_connect(ble_cus_t * p_cus, ble_evt_t const * p_ble_evt) { uint16_t buffer[4]; buffer[0] = 16; // cccd handle buffer[1] = 2; // cccd attribute size = 2 buffer[2] = 1; // 1 = enable notifications buffer[3] = 0xCACD; // CRC-CCITT (0xFFFF) sd_ble_gatts_sys_attr_set(p_cus->conn_handle, (uint8_t*)(buffer), 8, 0); // initialize cccd attribute }
As a result, when I connect to my phone I get sd_ble_gatts_hvx return value of 8 repeatedly until I enable incoming notifications on my phone and start getting a value of 0. The information transmitted to the phone is correct. However, when I connect to my central board I always get sd_ble_gatts_hvx return value of 3401, meaning a problem with the system attributes.
I apologize if I'm missing useful information but I don't even know where the problem might lie.
I don't understand what the error even means, or why it behaves differently since it was working with the central not long ago. Any help is greatly appreciated.