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

is multi touch HID possible with nrf51822 chip?

Hi All,

       Currently i am working on nrf51822 for multi touch HID.For that i have chosen mouse HID example as a reference, in which i have changed HID descriptor(single touch) and some other things.So, that single touch has been working.

And, if i changed the HID descriptor for multi touch, touch devices(touch laptop) were showing "Bluetooth driver error".

is it possible multi touch HID over nrf51822 as a reference of mouse HID example?

if possible, what all changes are to be required to work for multi touch.

so, please guide me how to implement multi touch HID over nrf51822.

regards

akash.

Parents
  • Hi Akash

    Multi touch should definitely be possible with the nRF51 series. 

    Microsoft have some good articles on how to use multi touch with windows, such as this one. Have you had a look at that?

    If you still can't make it work, are you able to attach your HID descriptor so I can have a look at it?

    Best regards
    Torbjørn

  • Thanks for your precious reply.

    yes, i have gone through windows multi touch HID, but didn't work for me.

    so, i have taken one more multi touch HID, which has been working over USB.

    if i emulated same HID into Bluetooth stack, it was not working.

    here, i am attaching my HID

    0x05, 0x0D, // Usage Page (Digitizer)
    0x09, 0x04, // Usage (Touch Screen)
    0xA1, 0x01, // Collection (Application)
    0x09, 0x22, // Usage (Finger)
    0xA1, 0x02, // Collection (Logical)
    0x09, 0x42, // Usage (Tip Switch)
    0x15, 0x00, // Logical Minimum (0)
    0x25, 0x01, // Logical Maximum (1)
    0x75, 0x01, // Report Size (1)
    0x95, 0x01, // Report Count (1)
    0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
    0x09, 0x30, // Usage (Tip Pressure)
    0x25, 0x7F, // Logical Maximum (127)
    0x75, 0x07, // Report Size (7)
    0x95, 0x01, // Report Count (1)
    0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
    0x09, 0x51, // Usage (0x51)
    0x26, 0xFF, 0x00, // Logical Maximum (255)
    0x75, 0x08, // Report Size (8)
    0x95, 0x01, // Report Count (1)
    0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
    0x05, 0x01, // Usage Page (Generic Desktop Ctrls)
    0x09, 0x30, // Usage (X)
    0x09, 0x31, // Usage (Y)
    0x26, 0xFF, 0x7F, // Logical Maximum (32767)
    0x65, 0x00, // Unit (None)
    0x75, 0x10, // Report Size (16)
    0x95, 0x02, // Report Count (2)
    0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
    0xC0, // End Collection
    0x05, 0x0D, // Usage Page (Digitizer)
    0x27, 0xFF, 0xFF, 0x00, 0x00, // Logical Maximum (65534)
    0x75, 0x10, // Report Size (16)
    0x95, 0x01, // Report Count (1)
    0x09, 0x56, // Usage (0x56)
    0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
    0x09, 0x54, // Usage (0x54)
    0x25, 0x05, // Logical Maximum (12)
    0x75, 0x08, // Report Size (8)
    0x95, 0x01, // Report Count (1)
    0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
    0x05, 0x0D, // Usage Page (Digitizer)
    0x09, 0x55, // Usage (0x55)
    0x25, 0x0A, // Logical Maximum (12)
    0x75, 0x08, // Report Size (8)
    0x95, 0x01, // Report Count (1)
    0xB1, 0x02, // Feature (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
    0xC0, // End Collection

    is there any changes are to be required in code(like feature report, input report,output report)?

    because, single touch has been working without adding any feature reports and output reports.

    regards,

    akash.

  • Hi Ovrebekk

    I was on leave for last week, since couldn't give reply.

    I have tested 5 touches over USB.

    Here, How i am sending data...

    void send (uint8_t i, uint16_t x, uint16_t y)
    {
    uint8_t my_buff1[10] = {0};

    my_buff[0] = 0xff;
    my_buff[1] = i;

    my_buff[2] = (x & 0x00ff);
    my_buff[3] = ((x >> 8) & 0xff);

    my_buff[4] = (y & 0xff);
    my_buff[5] = ((y >> 8) & 0xff);

    my_buff[6] = 0x64;
    my_buff[7] = 0x00;

    my_buff[8] = 0x06;

    // sprintf (my_buff1,"%d\r\n",my_buff[0]);
    // HAL_UART_Transmit (&huart2,&my_buff1[i],sizeof (my_buff1),100);

    USBD_CUSTOM_HID_SendReport (&hUsbDeviceFS,
    my_buff,
    9);
    USBD_LL_Delay (100);
    }

    Above wrapper is for constructing the packet.Like this i am sending 5 packets with different touch id(i value 0 to 4), 

    x and y values.(x and y are up to 10,000).

    If i construct same packet and send over Bluetooth, i have been not getting even a single touch also. 

    I have got a reference of working multi touch, but it has been working on teensy modules.

    please go through following link...

    https://github.com/PaulStoffregen/cores/tree/master/teensy3

    so, if u get any break through please let me know, that could be helped me a lot.

    best regards

    akash.

  • Hi 

    I don't think setting contact count to 6 is correct, unless you are sending 6 packets together. 

    On an Android phone I was able to get the example to work somewhat, but I used a slightly different send function:

    typedef PACKED_STRUCT
    {
    uint8_t tip_switch : 1;
    uint8_t tip_pressure : 7;
    uint8_t contact_id;
    uint16_t x;
    uint16_t y;
    uint16_t scan_time;
    uint8_t contact_count;
    uint8_t contact_count_max;
    }digitizer_report_t;

    void digitizer_send3(uint8_t id, uint8_t c_count, uint16_t x, uint16_t y, bool tip_down)
    {
    digitizer_report_t report = {0};

    report.tip_switch = (tip_down > 0) ? 1 : 0;
    report.tip_pressure = (tip_down > 0) ? 127 : 0;
    report.contact_id = id;
    report.x = x;
    report.y = y;
    report.scan_time = 0x64;
    report.contact_count = c_count;
    report.contact_count_max = 6;
    uint32_t err_code;
    err_code = ble_hids_inp_rep_send(&m_hids,
    INPUT_REP_DIGITIZER_INDEX,
    INPUT_REP_DIGITIZER_LEN,
    (uint8_t *)&report,
    m_conn_handle);
    APP_ERROR_CHECK(err_code);
    }

    Then I tried to set 5 simultaneous touch points by calling the digitizer send function repeatedly based on a button press, with the following arguments:

    digitizer_send3(0, 5, 10000, 10000, true);
    digitizer_send3(1, 5, 20000, 20000, true);
    digitizer_send3(2, 5, 15000, 15000, true);
    digitizer_send3(3, 5, 12000, 12000, true);
    digitizer_send3(4, 5, 34000, 30000, true);
    digitizer_send3(0, 5, 13000, 13000, true);
    digitizer_send3(1, 5, 23000, 26000, true);
    digitizer_send3(2, 5, 15000, 15000, true);
    digitizer_send3(3, 5, 12000, 12000, true);
    digitizer_send3(4, 5, 34000, 30000, true);
    digitizer_send3(0, 5, 10000, 10000, false);
    digitizer_send3(1, 5, 20000, 20000, false);
    digitizer_send3(2, 5, 15000, 15000, false);
    digitizer_send3(3, 5, 12000, 12000, false);
    digitizer_send3(4, 5, 34000, 30000, false);

    For some reason the first command seems to be ignored, and after the first 5 commands I will have 4 touch points appear (I use and Android app called "Multi Touch Test" to debug it). 

    After I run the next 5 lines all the 5 touch points appear, and after the last 5 lines they are all removed again. 

    I haven't been able to test this successfully on Windows, I need to continue work on that tomorrow. 

    Best regards
    Torbjørn

  • Hi Ovrebekk

    That was good news.

    At least multi touch has been working on Android mobile.

    are u using same multi touch hid which i have shared to you?

    If possible please share your entire project, so that i can test and will try it work on windows as well.

    Best regards,

    akash. 

  • Hi 

    My HID descriptor is almost identical to the one you sent, except there is a slight change around the scan time usage. The ordering of lines was a bit non standard in your version (if you compare the two I am sure you will spot it). 

    You will find the example attached:
    ble_app_hids_mouse.zip

    Unfortunately I tested this on the nRF52832, not the nRF51822. 

    Would you happen to have an nRF52DK available that you can test on?

    If not I will try to port the code to the nRF51 so you can test it there. 

    I don't expect the HID behavior to be different on the nRF52 compared to the nRF51, as long as the BLE connection works as normal. 

    Best regards
    Torbjørn

  • Hi Ovrebekk

    Thanks for sharing the file.

    yes, i have nrf52DK and will test on it.

    On which SDK you have used to implement the project?

    if you share SDK version, so that i can download and edit the main file.Because i am using nRF5_SDK_15.0.0.

    Best regards

    Akash

Reply Children
Related