2024-04-28 11:56 PM
Hello ST team,
I am working on a POC for USB, in which I need to use two classes (Custom HID and CDC) both at a time. And for this I want to generate a code without using Azure RTOS.
Can anyone help me out with this to get a sample code without RTOS and to use Custom HID and CDC both at a time.
Thanks in advance
2024-04-29 12:58 AM
Check this repo on GitHub for H5 products, you can find examples of HID class for USB without AzureRTOS
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2024-04-29 02:14 AM
Hi FBL,
Thanks for the quick response. The repo which you shared is having only examples for one class. I need a reference example for usage of two classes at a time (custom hid + cdc) i.e composite examples.
please help me with this
2024-04-29 02:22 AM
2024-04-29 05:36 AM
In my experience, this is easy and very excellent solution for STM32 USB Composite devices.
I-CUBE-USBD-Composite
https://github.com/alambe94/I-CUBE-USBD-Composite
2024-04-30 02:27 AM
Hello Hardrock,
Thanks for the lead. Although I generated a code using AL94.I-CUBE-USBD-COMPOSITE.1.0.3.pack software package I am still facing some issue in device discovery. Attaching snapshot for the reference.
Kindly anyone help me to resolve this and please let me know will this AL94.I-CUBE-USBD-COMPOSITE.1.0.3.pack software package is compactible for H5 as well.
2024-04-30 03:03 AM
1. You must install "STM32 Virtual COM Port Driver" for USB CDC in your PC.
https://www.st.com/en/development-tools/stsw-stm32102.html
2. For the USB Composite CDC and HID, you have to design the custom interface respectively.
/Middlewares/Third_Party/AL94_USB_Composite/COMPOSITE/App/
[USB CDC] usbd_cdc_acm_if.c
[USB HID] usbd_hid_custom_if.c
for example, CDC_Receive() in usbd_cdc_acm_if.c
this sample interface just echo back on same channel.
* USB COM RX Interface : CDC_Receive()
* USB COM TX Interface : CDC_Transmit()
static int8_t CDC_Receive(uint8_t cdc_ch, uint8_t *Buf, uint32_t *Len)
{
/* USER CODE BEGIN 6 */
//HAL_UART_Transmit_DMA(CDC_CH_To_UART_Handle(cdc_ch), Buf, *Len);
CDC_Transmit(cdc_ch, Buf, *Len); // echo back on same channel
USBD_CDC_SetRxBuffer(cdc_ch, &hUsbDevice, &Buf[0]);
USBD_CDC_ReceivePacket(cdc_ch, &hUsbDevice);
return (USBD_OK);
/* USER CODE END 6 */
}