cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G0B and USB Custom HID

Peaga
Senior

Hello guys!

I'm using USB custom HID on STM32G0B for an application alike the mouse demo on "STM32G0C1E-EV" HAL package. But instead a button sending the Report, a PC software sends a 64 bytes Report to get another 64 bytes as answer.

In fact, this same code worked flawless on STM32H750 but on G0, I'm always getting a "loopback" answer after "USBD_HID_SendReport()" function, with some garbage bytes. I'm suspicious of the "USB_WritePMA" function, as it put a byte pointer to word buffer...

Do you guys have any tip about this?

Thanks again!

1 ACCEPTED SOLUTION

Accepted Solutions

It turns out that I didn't set the PMA for OUT endpoint... So on "USBD_LL_Init" function, I must add a "HAL_PCDEx_PMAConfig" for address 0x01. Now it's working fine!

Thanks!

View solution in original post

2 REPLIES 2
Peaga
Senior

It looks like the "USB_WritePMA" is ok... The problem happens when the "USBD_HID_SendReport" function is inside of "USBD_HID_DataOut" routine, where I verify if the data received by PC is ok and then, send the response... But why?

It turns out that I didn't set the PMA for OUT endpoint... So on "USBD_LL_Init" function, I must add a "HAL_PCDEx_PMAConfig" for address 0x01. Now it's working fine!

Thanks!