2015-09-02 02:10 PM
Hi
I have a custom board with a stm32f4 I am trying to use cubmx to generate a usb HID project but the generated code does not work. The board appears as an unrecognized device when I attach it to my computer. My board uses a 16 MHz crystal oscillator attached to PHI and PH0. Clock configuration Pin configurationI added a call to USBD_HID_SendReport in the while loop of the main function. supporting this was the only change I made to the generated code from cubemx.
Are there any other changes I need to make to the generated code to make this appear as an HID device on my computer?int
main(
void
)
{
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* MCU Configuration----------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* Configure the system clock */
SystemClock_Config();
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_USB_DEVICE_Init();
/* USER CODE BEGIN 2 */
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while
(1)
{
USBD_HID_SendReport(&hUsbDeviceFS, testReport,4);
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
}
/* USER CODE END 3 */
}
2015-09-04 07:27 AM
Hi rlong.00,
You should add these three APIs: -USBD_init() -USBD_RegisterClass() -USBD_Start() For more details, have a look at (page 19) -Shahrzad-2015-09-15 03:45 PM
Hi shahrzad
The function MX_USB_DEVICE_Init calls those functions you mentioned; It was generated by cubemx and is called in the main function.2015-09-22 09:26 AM
In
his figure
the
''System
Clock
Mux
''is set to ''
HSI''when it should be
''
PLLCLK''.
2015-09-23 11:53 AM
Hi Silvva
I switched the clock source.Now I am seeing this error message in the device manager which I have not seen before.This device is disabled because the firmware of the device did not give it the required resources. (Code 29)2015-09-23 11:53 AM
Hi Silvva
I switched the clock source. Now I am seeing this error message in the device manager which I have not seen before. This device is disabled because the firmware of the device did not give it the required resources. (Code 29) ________________ Attachments : clockConfig.png : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Htk0&d=%2Fa%2F0X0000000aWR%2FG14JZDXbkS.6TCZtfy8RYrm_kkRfFZoG2vEvuEtAGiQ&asPdf=false