I'm working on hid keyboard example. How can I check whether multiple bytes are received & transmitted after I increase the assigned no. of bytes in input/output report? From the code I understood that nrf device can send 64 bytes to host device. So how do I append bytes in one packet of 64 bytes when sending to host? How does it work from host side? Does nrf read 1 byte at a time sent from host?
So how do I append bytes in one packet of 64 bytes when sending to host?
What do you mean by that? Do you want to increase the packet size so you can send more than 64 bytes?
I read somewhere that Windows machine accepts 64 bytes from BLE device. So accordingly I should make changes in HID descriptor which are - REPORT_COUNT = 64, REPORT_SIZE = 8. In the current situation, the below image demonstrates how many no. of bytes are sent/received in nrfConnect.
If I make the changes for 64 bytes, do I need to take care of any header bytes getting added to the packet or can all 64 bytes be data bytes? I know for sure that the first byte to be sent from nrf to pc should be report ID.
Also in the code, in which locations are the packet size actually being checked for input & output report?
I would like maximum size possible for input & output report for Windows OS & Mac OS.
p_input_report->rep_ref.report_id = INPUT_REP_REF_ID;
I think you need to set it to 1, to match the REPORT_ID you set in report_map_data.
Cool so now input report works but 20 bytes for output report does not work! Here is my code -
I think what needs to be checked is in on_hid_rep_char_write() function, the ble_hids_outp_rep_get() gets this 20 byte value in report_val which is 8-bit unsigned int.
Kindly look into this!
bscdb said:Cool so now input report works but 20 bytes for output report does not work!
Are you using just nRF Connect to send, or have you tried other applications as well?
I have tried other applications too.
And you get just one byte every time?
No the applications show errors, they dont receive anything.
I'm not able to send 26 byte output report from all applications, after that the board just disconnects.
static void on_hid_rep_char_write(ble_hids_evt_t * p_evt)
if (p_evt->params.char_write.char_id.rep_type == BLE_HIDS_REP_TYPE_OUTPUT)
uint8_t report_index = p_evt->params.char_write.char_id.rep_index;
if (report_index == OUTPUT_REPORT_INDEX)
// This code assumes that the output report is one byte long. Hence the following static assert is made.
STATIC_ASSERT(OUTPUT_REPORT_MAX_LEN == 26);//1);
err_code = ble_hids_outp_rep_get(&m_hids, report_index, OUTPUT_REPORT_MAX_LEN, 0, m_conn_handle, &report_val);
// For HID
if (report_val != 0x00)
NRF_LOG_INFO("Caps Lock is turned On!");
err_code = bsp_indication_set(BSP_INDICATE_ALERT_3);
else if (report_val == 0x00)
NRF_LOG_INFO("Caps Lock is turned Off!");
err_code = bsp_indication_set(BSP_INDICATE_ALERT_OFF);
// The report received is not supported by this application. Do nothing.
In nrfConnect, I get this error. What does it mean? Does it mean I can only send 20 bytes?
With 20 bytes, I can send output report from all applications.
Have you tried changing the report descriptor for output report to accommodate 26 bytes?
Yes I did but I received BLE_GATT_OP_WRITE_CMD error and did a little search in Nordic forum. What should I do?