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

Increasing number of bytes in HID descriptor

Hi,

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?

Parents
  • 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.

  • Where do you find REPORT_COUNT and REPORT_SIZE?

    bscdb said:
    Also in the code, in which locations are the packet size actually being checked for input & output report?

     I could find one place in the code where the report length is checked.

    if (len <= p_hids->p_inp_rep_init_array[rep_index].max_len)
    {
        memcpy(p_host_rep_data, p_data, len);
    }

    This is done in  the ble_hids_inp_rep_send() function. Not sure if this is what you're asking for.

  • Cool! You got my point. That is exactly what I was looking for. So similarly it is being checked in ble_hids_outp_rep_get() function? Actually, I am thinking from host application point of view which would be running on Windows, MAC, etc. Will the packet size affect the communication between host and ble device? Do you think if the host sends a packet of 64 bytes, nrf will be in a position to handle that size without any data loss?

    How do 

    uint8_t      rep_index
     & 
    uint16_t len
     relate to eachother? These are the arguments passed in ble_hids_inp_rep_send() function.

    Changes made

    (1) For input report
    0x75, 0x08, // REPORT_SIZE(8)
    0x95, 0x40, // REPORT_COUNT(64)
    (2) For output report
    0x75, 0x08, // REPORT_SIZE(8)
    0x95, 0x02, // REPORT_COUNT(2)
    (3) err_code = ble_hids_inp_rep_send(&m_hids, 0, 64, (unsigned char*)&arr_data, m_conn_handle);


Reply Children
  • I'm using SDK15.2. Similarly for output report I noticed that nrfConnect can only send a byte to nrf device. Can more bytes be sent? If yes, then after changing the descriptor where else do I make the necessary changes?

    Also is the IN/OUT endpoint configured to send/receive data on receiving an IN/OUT token packet?

    What can be the maximum input/output buffer size?

  • What API are you using for developing the host application, specifically the HID portion?

  • To summarize –

    I am using SDK 15.2. I am trying to develop host application for packet size of 20 bytes.

    1. How to I increase the no of bytes assigned for input & output reports besides the report descriptor? In which locations is the packet size actually being checked for input & output reports?
    2. What is the maximum size possible for input & output reports for Windows & MAC OS?
    3. Do you think if the host sends packet of 64 bytes, nrf chip will be in a position to handle that size? nrfConnect can send only a byte to nrf device.
    4. Is IN/OUT endpoint configured to send/receive data on receiving an IN/OUT token packet?

     The original working code-

    Steps to execution-

    1. Press button 2 to see data received on nrfConnect
    2. Send any non-zero data from nrfConnect and led glows on nrf52832 kit.

    Question - Even though the report count =1 & report size = 8 bits, how can the host receive more than a byte?

    I tried to increase the packet size to 20 bytes only for input report but the buffer can fill only first few bytes out of 20 bytes. Why so?

    The result for above code on an api other than nrfConnect- 

    I’m closely following Jan Axelson’s research and her hid api. But on her hid api I do not receive any data? I can send data to nrf device but does not seem like it is receiving any, although I get a message that output report is sent.

    I also tried https://github.com/signal11/hidapi for BLE HID, but similar behavior there as well.

    Thanks, awaiting your speedy reply.

  • Maybe I should try this for myself. Are you using nRF Connect for Desktop to monitor HID data received from the nrf device? How does that work?

  • Thanks Hakon! I receive data on nrfConnect but not after increasing packet size. I have been struggling to find answers to above questions for a while now.

Related