2024-04-26 04:55 AM
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 .
any solution on this ? .
Solved! Go to Solution.
2024-05-03 12:04 AM
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.
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.
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.
2024-04-26 05:53 PM
As always... Have you started from a ready example for this Nucleo?
Projects/STM32F722ZE-Nucleo/Applications/USB_Host\HID_Standalone
2024-04-26 11:08 PM
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 ?
2024-04-27 08:21 AM - edited 2024-04-27 08:35 AM
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.
2024-04-28 04:36 AM - edited 2024-04-28 04:43 AM
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:
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 .
2024-05-02 08:26 AM
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.
2024-05-02 09:49 PM
2024-05-03 12:04 AM
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.
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.
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.
2024-05-03 02:44 AM
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 .
i need 2 USB_FS line for different purpose