This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

No BLE_GATT_HVX_NOTIFICATION under 20 bytes

In SDK 8 for the nrf51422, notifications are always being sent as 20 bytes, regardless of p_len. The BLE_EVT_TX_COMPLETE event stores the proper number in tx_length, but the packet over the air always contains 20 for its size field.

#define CHAR_TX_SIZE 20
uint8_t tx_buffer[CHAR_TX_SIZE];
static uint16_t tx_length;
static ble_gatts_hvx_params_t hvx_params;

tx_buffer[0] = 1;
tx_buffer[0] = 2;
tx_buffer[0] = 3;
tx_length = 3;

hvx_params.handle = rx_handles.value_handle;
hvx_params.offset = 0;
hvx_params.p_data = tx_buffer;
hvx_params.p_len  = &tx_length;
hvx_params.type   = BLE_GATT_HVX_NOTIFICATION;
result = sd_ble_gatts_hvx(m_conn_handle, &hvx_params);
Parents Reply Children
No Data
Related