cancel
Showing results for 
Search instead for 
Did you mean: 

Serious Bug in USB - Keyboard - Stm32f722ze nucleo board

MMARI.1
Senior

hi, i am trying to connect USB keyboard with STM32F722ze nucleo board but nothing worked out .

Not getting any output .

Before a year  i have tested STM32f401ccu6 with USB keyboard and it's works fine .

looks like software package issue .

https://community.st.com/t5/stm32cubemx-mcus/hid-keyboard-not-working-on-stm32f722ze-nucleo-f722ze-board/td-p/607188

 

any solution on this ? .

 

 

 

 

 

 

 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
KDJEM.1
ST Employee

Hi @MMARI.1 ,

Go on the GitHub - STMicroelectronics/stm32_mw_usb_host: Provides the USB Host library part of the STM32Cube MCU Component "middleware" for all STM32xx series and download as zip.

KDJEM1_0-1714719170975.png

 

Unzip the files and copy all folders to   \Repository\STM32Cube_FW_F7_V1.17.1\Middlewares\ST\STM32_USB_Host_Library  by replacing the old files.

KDJEM1_2-1714719561308.png

KDJEM1_3-1714719671727.png

Then, open your HID_Standalone project in Repository\STM32Cube_FW_F7_V1.17.1\Projects\STM32F722ZE-Nucleo\Applications\USB_Host\HID_Standalone and Run.

I hope this help you.

Thank you.

Kaouthar 

 

 

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.

View solution in original post

8 REPLIES 8
Pavel A.
Evangelist III

As always... Have you started from a ready example for this Nucleo? 

Projects/STM32F722ZE-Nucleo/Applications/USB_Host\HID_Standalone

Projects/STM32F722ZE-Nucleo/Applications/USB_Host\HID_Standalone/core folder : usbh_conf_template.h file & usbh_conf_template.c file  not found in CUBE IDE  core folder 

should i need to manually include the usbh_conf_template.h file & usbh_conf_template.c file into cube ide core folder ? .

 

Projects/STM32F722ZE-Nucleo/Applications/USB_Host\HID_Standalone  usbh_conf.c file 

 

USBH_StatusTypeDef USBH_LL_Init(USBH_HandleTypeDef *phost)
{
/* Set the LL Driver parameters */
hhcd.Instance = USB_OTG_FS;
hhcd.Init.Host_channels = 11;
hhcd.Init.dma_enable = 0;
hhcd.Init.low_power_enable = 0;
hhcd.Init.phy_itface = HCD_PHY_EMBEDDED;
hhcd.Init.Sof_enable = 0;
hhcd.Init.speed = HCD_SPEED_FULL;
hhcd.Init.vbus_sensing_enable = 0;
hhcd.Init.lpm_enable = 0;

/* Link the driver to the stack */
hhcd.pData = phost;
phost->pData = &hhcd;

/* Initialize the LL Driver */
HAL_HCD_Init(&hhcd);

USBH_LL_SetTimer(phost, HAL_HCD_GetCurrentFrame(&hhcd));

return USBH_OK;
}

Cube ide / project/ USB Host / Target / usbh.conf.c

USBH_StatusTypeDef USBH_LL_Init(USBH_HandleTypeDef *phost)
{
  /* Init USB_IP */
  if (phost->id == HOST_FS) {
  /* Link the driver to the stack. */
  hhcd_USB_OTG_FS.pData = phost;
  phost->pData = &hhcd_USB_OTG_FS;

  hhcd_USB_OTG_FS.Instance = USB_OTG_FS;
  hhcd_USB_OTG_FS.Init.Host_channels = 12;
  hhcd_USB_OTG_FS.Init.speed = USB_OTG_SPEED_FULL;
  hhcd_USB_OTG_FS.Init.dma_enable = DISABLE;
  hhcd_USB_OTG_FS.Init.phy_itface = HCD_PHY_EMBEDDED;
  hhcd_USB_OTG_FS.Init.Sof_enable = DISABLE;
  hhcd_USB_OTG_FS.Init.vbus_sensing_enable = DISABLE;
  if (HAL_HCD_Init(&hhcd_USB_OTG_FS) != HAL_OK)
  {
    Error_Handler( );
  }

  USBH_LL_SetTimer(phost, HAL_HCD_GetCurrentFrame(&hhcd_USB_OTG_FS));
  }
  return USBH_OK;

 

Projects/STM32F722ZE-Nucleo/Applications/USB_Host\HID_Standalone  usbh_conf.c file 

hhcd.Init.Host_channels = 11;
hhcd.Init.speed = HCD_SPEED_FULL;

vs

Cube ide / project/ USB Host / Target / usbh.conf.c

hhcd_USB_OTG_FS.Init.Host_channels = 12;
hhcd_USB_OTG_FS.Init.speed = USB_OTG_SPEED_FULL;

can you confirm which is right ?

Pavel A.
Evangelist III

Strange, files with "template" in filenames should never be copied from the repository to the user's project and be included into build. They are used as templates for actual project files.

Btw - there's no "core" subfolder in this example and no "template" files. Check that you have good sources.

https://github.com/STMicroelectronics/STM32CubeF7/tree/master/Projects/STM32F722ZE-Nucleo/Applications/USB_Host/HID_Standalone/

 

 

 

 

 

USBH_StatusTypeDef USBH_LL_Init(USBH_HandleTypeDef *phost)
{
  /* Init USB_IP */
  if (phost->id == HOST_FS) {
  /* Link the driver to the stack. */
  hhcd_USB_OTG_FS.pData = phost;
  phost->pData = &hhcd_USB_OTG_FS;

  hhcd_USB_OTG_FS.Instance = USB_OTG_FS;
  hhcd_USB_OTG_FS.Init.Host_channels = 8;
  hhcd_USB_OTG_FS.Init.speed = HCD_SPEED_FULL;
  hhcd_USB_OTG_FS.Init.dma_enable = DISABLE;
  hhcd_USB_OTG_FS.Init.phy_itface = HCD_PHY_EMBEDDED;
  hhcd_USB_OTG_FS.Init.Sof_enable = DISABLE;
  if (HAL_HCD_Init(&hhcd_USB_OTG_FS) != HAL_OK)
  {
    Error_Handler( );
  }

  USBH_LL_SetTimer(phost, HAL_HCD_GetCurrentFrame(&hhcd_USB_OTG_FS));
  }
  return USBH_OK;
}

 

 

 

hi, Again re-tested keyboard with stm32f401ccu6 it's working fine .

1. stm32f401:

from USB_HOST folder -> usbh.conf.c ->

 

 

 

USBH_StatusTypeDef USBH_LL_Init(USBH_HandleTypeDef *phost)
{
  /* Init USB_IP */
  if (phost->id == HOST_FS) {
  /* Link the driver to the stack. */
  hhcd_USB_OTG_FS.pData = phost;
  phost->pData = &hhcd_USB_OTG_FS;

  hhcd_USB_OTG_FS.Instance = USB_OTG_FS;
  hhcd_USB_OTG_FS.Init.Host_channels = 8;
  hhcd_USB_OTG_FS.Init.speed = HCD_SPEED_FULL;
  hhcd_USB_OTG_FS.Init.dma_enable = DISABLE;
  hhcd_USB_OTG_FS.Init.phy_itface = HCD_PHY_EMBEDDED;
  hhcd_USB_OTG_FS.Init.Sof_enable = DISABLE;
  if (HAL_HCD_Init(&hhcd_USB_OTG_FS) != HAL_OK)
  {
    Error_Handler( );
  }

  USBH_LL_SetTimer(phost, HAL_HCD_GetCurrentFrame(&hhcd_USB_OTG_FS));
  }
  return USBH_OK;
}

 

 

 

 

Tested with keyboard not working & not sucess 

2. stm32f722ze:

from USB_HOST folder -> usbh.conf.c ->

 

 

 

USBH_StatusTypeDef USBH_LL_Init(USBH_HandleTypeDef *phost)
{
  /* Init USB_IP */
  if (phost->id == HOST_FS) {
  /* Link the driver to the stack. */
  hhcd_USB_OTG_FS.pData = phost;
  phost->pData = &hhcd_USB_OTG_FS;

  hhcd_USB_OTG_FS.Instance = USB_OTG_FS;
  hhcd_USB_OTG_FS.Init.Host_channels = 12;
  hhcd_USB_OTG_FS.Init.speed = USB_OTG_SPEED_FULL;
  hhcd_USB_OTG_FS.Init.dma_enable = DISABLE;
  hhcd_USB_OTG_FS.Init.phy_itface = HCD_PHY_EMBEDDED;
  hhcd_USB_OTG_FS.Init.Sof_enable = DISABLE;
  hhcd_USB_OTG_FS.Init.vbus_sensing_enable = DISABLE;
  if (HAL_HCD_Init(&hhcd_USB_OTG_FS) != HAL_OK)
  {
    Error_Handler( );
  }

  USBH_LL_SetTimer(phost, HAL_HCD_GetCurrentFrame(&hhcd_USB_OTG_FS));
  }
  return USBH_OK;
}

 

 

 

3.stm32f746betx:

https://community.st.com/t5/stm32-mcus-products/hid-host-usb-for-getting-barcode-from-a-scanner/td-p/633004

community member was success in usb  using stm32f746

from USB_HOST folder -> usbh.conf.c ->

 

 

 

USBH_StatusTypeDef USBH_LL_Init(USBH_HandleTypeDef *phost)
{
  /* Init USB_IP */
  if (phost->id == HOST_FS) {
  /* Link the driver to the stack. */
  hhcd_USB_OTG_FS.pData = phost;
  phost->pData = &hhcd_USB_OTG_FS;

  hhcd_USB_OTG_FS.Instance = USB_OTG_FS;
  hhcd_USB_OTG_FS.Init.Host_channels = 8;
  hhcd_USB_OTG_FS.Init.speed = HCD_SPEED_FULL;
  hhcd_USB_OTG_FS.Init.dma_enable = DISABLE;
  hhcd_USB_OTG_FS.Init.phy_itface = HCD_PHY_EMBEDDED;
  hhcd_USB_OTG_FS.Init.Sof_enable = DISABLE;
  if (HAL_HCD_Init(&hhcd_USB_OTG_FS) != HAL_OK)
  {
    Error_Handler( );
  }

  USBH_LL_SetTimer(phost, HAL_HCD_GetCurrentFrame(&hhcd_USB_OTG_FS));
  }
  return USBH_OK;
}

 

 

 

 if compare three of usbh.conf.c file

1.stm32f401ccu6 - > speed = HCD_SPEED_FULL; Host_channels = 8;

HCD_SPEED_FULL-> Open Declaration -> stmf4xx_hal_hcd.h file getting opened . 

2.stm32f722ze -> speed = USB_OTG_SPEED_FULL ; Host_channels = 12;

USB_OTG_SPEED_FULL-> Open Declaration -> stmf7xx_II_usb.h file getting opened . 

3.stm32f746 -> speed = HCD_SPEED_FULL; Host_channels = 8;

HCD_SPEED_FULL-> Open Declaration -> stmf47xx_hal_hcd.h file getting opened . 

usb working controller stm32f401ccu6 & stm32f746 are calling proper Heder file .

usb not working controller stm32f722ze is calling improper Header file .

i believe  stm32f722ze having USB software bug . please help me to use this board stm32f722ze .

Just modifying USB_OTG_SPEED_FULL to HCD_SPEED_FULL will not work looks USB file having lot of link which is out of my limit .

 

KDJEM.1
ST Employee

Hello @MMARI.1 ,

Could you please try to upgrade the USB middleware to 3.5.2 version.

Please let me know if the issue is solved or not.

Thank you.

Kaouthar

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.

hi @KDJEM.1 @Pavel A. 

i couldn't find any middleware update option menu in ioc or in the project file.

can you please tell me small procedure .

 

KDJEM.1
ST Employee

Hi @MMARI.1 ,

Go on the GitHub - STMicroelectronics/stm32_mw_usb_host: Provides the USB Host library part of the STM32Cube MCU Component "middleware" for all STM32xx series and download as zip.

KDJEM1_0-1714719170975.png

 

Unzip the files and copy all folders to   \Repository\STM32Cube_FW_F7_V1.17.1\Middlewares\ST\STM32_USB_Host_Library  by replacing the old files.

KDJEM1_2-1714719561308.png

KDJEM1_3-1714719671727.png

Then, open your HID_Standalone project in Repository\STM32Cube_FW_F7_V1.17.1\Projects\STM32F722ZE-Nucleo\Applications\USB_Host\HID_Standalone and Run.

I hope this help you.

Thank you.

Kaouthar 

 

 

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.

hi, after USB middleware update keyboard started working with USB_FS via PA12 & PA 11.

then i disabled USB_FS (pin PA12 & PA 11) and enabled Internal_Phy_Fs via PB15&PB14 found keyboard not working .

MMARI1_0-1714729341164.pngMMARI1_1-1714729398167.png

i need 2 USB_FS line for different purpose