2016-01-19 09:35 AM
Hello everybody,
I've configured with CubeMX the standard pinout of the STM32F429I-DISCO. In Cube I've added the USB_OTG_HS peripheral with Internal PHY set to Host Only. I've then activated the USB_HOST Class for HS IP parameter set to Human Interface Host Class. In Configuration Tab I've only modified the Debug Level to 3. Then I've compiled the project and brought to True Studio. In True Studio I've ported in my discovery board the FW example of STM324x9I-EVAL_USBH-HS put in the \Projects\STM324x9I_EVAL\Applications\USB_Host\HID_Standalone\TrueSTUDIO\STM324x9I-EVAL_USBH-HS\ directory. I've removed all the LCD settings and send the debug output to UART5 with hyperterminal. When I connect a mouse, the library seems to recognize it correctly:USB Device AttachedPID: c05ah
VID: 46dh
Address (#1) assigned.
Manufacturer : Logitech
Product : USB Optical Mouse
Serial Number : N/A
Enumeration done.
This device has only 1 configuration.
Default configuration set.
Switching to Interface (#0)
Class : 3h
SubClass : 1h
Protocol : 2h
Mouse device found!
HID class started. Then I simulate the joystick button forcing the hid_demo.state (in menu.c) variable to HID_DEMO_STATE. But when the SW arrive to this point:case HID_DEMO_START:
if(Appli_state == APPLICATION_READY)
{
if(USBH_HID_GetDeviceType(&hUsbHostHS) == HID_KEYBOARD)
{
hid_demo.keyboard_state = HID_KEYBOARD_IDLE;
hid_demo.state = HID_DEMO_KEYBOARD;
}
else if(USBH_HID_GetDeviceType(&hUsbHostHS) == HID_MOUSE)
{
hid_demo.mouse_state = HID_MOUSE_IDLE;
hid_demo.state = HID_DEMO_MOUSE;
}
}
else
{
LCD_ErrLog(''No supported HID device!\n'');
hid_demo.state = HID_DEMO_WAIT;
}
the APPLI_STATE variable is watched to APPLICATION_START (the callback never set it to APPLICATION_READY) so the hyperterminal send No supported HID device!
message and I can't see the mouse push button and mice moving. Following the main() and SystemClock_Config() routines: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_FMC_Init();
MX_LTDC_Init();
MX_UART5_Init();
/* Init HID Application */
HID_InitApplication();
MX_USB_HOST_Init();
/* USER CODE BEGIN 2 */
// GM 19/01/16
MX_UART5_TX(u8TxBuf,strlen((char*)u8TxBuf),5000);
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
MX_USB_HOST_Process();
/* USER CODE BEGIN 3 */
/* HID Menu Process */
HID_MenuProcess();
}
/* USER CODE END 3 */
}
-----------------------
void SystemClock_Config(void)
{
RCC_OscInitTypeDef RCC_OscInitStruct;
RCC_ClkInitTypeDef RCC_ClkInitStruct;
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct;
__PWR_CLK_ENABLE();
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
RCC_OscInitStruct.PLL.PLLM = 8;
RCC_OscInitStruct.PLL.PLLN = 336;
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
RCC_OscInitStruct.PLL.PLLQ = 7;
HAL_RCC_OscConfig(&RCC_OscInitStruct);
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK|RCC_CLOCKTYPE_PCLK1
|RCC_CLOCKTYPE_PCLK2;
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2;
HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5);
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_LTDC;
PeriphClkInitStruct.PLLSAI.PLLSAIN = 49;
PeriphClkInitStruct.PLLSAI.PLLSAIR = 2;
PeriphClkInitStruct.PLLSAIDivR = RCC_PLLSAIDIVR_2;
HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct);
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000);
HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
/* SysTick_IRQn interrupt configuration */
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
}
What can be the problem? Thanks and best regards.