2018-10-04 06:02 AM
Hello All and thank you in advanced
I have a pplication that we use two host usb connected to flash disks , one uses PORTA usb and other uses PORT B usb .
i have test every usb seperatlly with file system after modifie usb_diskio and all work with no problems
but when I use together and same time only one host work !
I have been debuging and testing for 4 days and no result , could you guide me to find the problem please .
if((FATFS_LinkDriver(&USBH_Driver, USBDISKPath) == 0) && (FATFS_LinkDriver(&USBH_Driver1, USBDISKPath_1) == 0))
{
// /*##-2- Init Host Library ################################################*/
// USBH_Init(&hUSB_Host, USBH_UserProcess, 0);
//
// /*##-3- Add Supported Class ##############################################*/
// USBH_RegisterClass(&hUSB_Host, USBH_MSC_CLASS);
//
// /*##-4- Start Host Process ###############################################*/
// USBH_Start(&hUSB_Host);
/*##-2- Init Host Library ################################################*/
USBH_Init(&hUSB_Host1, USBH_UserProcess, 0);
/*##-3- Add Supported Class ##############################################*/
USBH_RegisterClass(&hUSB_Host1, USBH_MSC_CLASS);
/*##-4- Start Host Process ###############################################*/
USBH_Start(&hUSB_Host1);
}
while(1)
{
USBH_Process(&hUSB_Host1);
USBH_Process(&hUSB_Host);
}
//-------------------------
only host hUSB_Host1 work and the hUSB_Host stile ideal state
what could be the problem here please ?
Thank you
2018-10-04 06:03 AM
I post here
static void USBH_UserProcess(USBH_HandleTypeDef *phost, uint8_t id)
{
if(phost==&hUSB_Host)
{
switch(id)
{
case HOST_USER_SELECT_CONFIGURATION:
break;
case HOST_USER_DISCONNECTION:
AppliState = APPLICATION_IDLE;
// f_mount(NULL, (TCHAR const*)"", 0);
break;
case HOST_USER_CLASS_ACTIVE:
AppliState = APPLICATION_START;
break;
default:
break;
}
}
if(phost==&hUSB_Host1)
{
switch(id)
{
case HOST_USER_SELECT_CONFIGURATION:
break;
case HOST_USER_DISCONNECTION:
AppliState1 = APPLICATION_IDLE;
//f_mount(NULL, (TCHAR const*)"", 0);
break;
case HOST_USER_CLASS_ACTIVE:
AppliState1 = APPLICATION_START;
break;
default:
break;
}
}
}
2018-10-04 06:04 AM
only AppliState1 work and change to APPLICATION_START;
2018-10-04 07:47 AM
Haven't we already discussed this recently?
-- pa
2018-10-04 10:13 AM
no
2018-10-04 02:28 PM
Please look at this thread. Can it help?
-- pa
2018-10-05 12:29 AM
Thank you Pavel alot , it really helps alot ;
now I can see the TWO host in start mode
but I still have problem in File fatfs
It return a disck error when i work with the two usb ; but when i test one host seperattly with its disckio no problems .
maybe a mistake in my settings here ?
USBH_StatusTypeDef USBH_LL_Init(USBH_HandleTypeDef *phost)
{
/* Set the LL driver parameters */
if(phost== &hUSB_Host)
{
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;
/* 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;
}
//---
if(phost== &hUSB_Host1)
{
/*Set LL Driver parameters */
hhcd1.Instance = USB_OTG_HS;
hhcd1.Init.Host_channels = 11;
hhcd1.Init.dma_enable = 1;
hhcd1.Init.low_power_enable = 0;
hhcd1.Init.phy_itface = HCD_PHY_EMBEDDED;
hhcd1.Init.Sof_enable = 0;
hhcd1.Init.speed = HCD_SPEED_HIGH;
hhcd1.Init.use_external_vbus = 1;
/* Link The driver to the stack */
hhcd1.pData = phost;
phost->pData = &hhcd1;
/*Initialize LL Driver */
if (HAL_HCD_Init(&hhcd1) != HAL_OK)
{
return USBH_FAIL;
}
USBH_LL_SetTimer (phost, HAL_HCD_GetCurrentFrame(&hhcd1));
return USBH_OK;
}
return USBH_OK;
}
should i use seperate channels ? both now 11 .
Thank you alot
2018-10-05 04:39 AM
Pavel thank you alot ; now the file sytem work
but I still have a small problem ; that host 2 some times still idle state ; i dont know why its happened.
what could be the channel?
2018-10-05 05:27 AM
Then there are even more shared variables. Maybe, even a timer,,,
-- pa
2018-10-07 11:21 PM
Thank you again Pavel ;
I still not find it ;
I hope spme one from ST could help here