Skip to main content
Visitor II
October 26, 2023
Question

USB composite (HID & CDC)

  • October 26, 2023
  • 4 replies
  • 3499 views

I am trying to use the usb COMPOSITE library. (AL94.I-Cube-USBD-COMPOSITE.1.0.3)
Followed the instruction How to generate the code from MXcude for USB CDC and USB HID.
the code compile successfully. and I can see those devices when I attach my NUCLEO bord to the computer.
But I could not find any documentation how to send information to the CDC or receive.
also for the HID Keyboard.
where can I find information how to use this library?

To receive and send information for both devices.

    This topic has been closed for replies.

    4 replies

    ZarissAuthor
    Visitor II
    October 26, 2023

    I tried : USBD_HID_Keybaord_SendReport (&hUsbDevice,buffer,8);

    but I didn't receive anything on the computer. I assume I need to specify the interface number, or the end point number. 

     

    Technical Moderator
    November 2, 2023

    Hello @Zariss and welcome to the Community :),

     

    I think DualCore_Standalone example available in STM32F4 package can help you.

    In fact, this example describes how to use USB device application based on the STM32F4xx multi core support feature integrating the Device Communication Class (CDC) and Human Interface (HID) in the same project.

    Also, Composite CDC-HID example is available in the STM32CubeH7 MCU package.

    So, you can get inspired from these examples to create USB Composite application with STM32F4.

    I hope this help you!

    Kaouthar

    ZarissAuthor
    Visitor II
    November 6, 2023

    Thank you for your reply.

    In the example Composite CDC-HID works fine with CDC and HID mouse.

    but when I try to use it in HID keyboard. it does not work. When I send a key pressed to the computer.  there is a message received by the computer. But it is not recognised as a keyboard. is it possible that it is a bug in the firmware?

     

    ZarissAuthor
    Visitor II
    November 6, 2023

    I am using this function call:

    statusReportSend=USBD_HID_SendReport (&hUsbDeviceFS,&keyBuffer[0],8);