cancel
Showing results for 
Search instead for 
Did you mean: 

f407 usb host problem

jimmjimmshen
Associate III
Posted on December 24, 2014 at 09:32

im trying use usb host and device same time

but the host totally not functional

i tried to use USB HS port as FS host only DM and DP pin used

use internel PHY , 5V power source checked

the interrupt have no response 

there are some init codes here

void USBHost_Init()

{

 USBH_Init(&USB_OTG_Host,

USB_OTG_FS_CORE_ID, 

&USB_Host, 

&USBH_MSC_cb,

&USR_Callbacks);

}

void USB_OTG_BSP_Init(USB_OTG_CORE_HANDLE *pdev)

{

GPIO_InitTypeDef GPIO_InitStructure;   

RCC_AHB1PeriphClockCmd( RCC_AHB1Periph_GPIOB , ENABLE);  

  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_15 | 

                                GPIO_Pin_14;

  

  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;

  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;

  GPIO_Init(GPIOB, &GPIO_InitStructure);  

  

  GPIO_PinAFConfig(GPIOB,GPIO_PinSource15,GPIO_AF_OTG2_FS) ; 

  GPIO_PinAFConfig(GPIOB,GPIO_PinSource14,GPIO_AF_OTG2_FS) ;

 

  RCC_AHB1PeriphClockCmd( RCC_AHB1Periph_OTG_HS, ENABLE) ;

  RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);

  RCC_AHB2PeriphClockCmd(RCC_AHB2Periph_OTG_FS, ENABLE) ; 

}

void USB_OTG_BSP_EnableInterrupt(USB_OTG_CORE_HANDLE *pdev)

{

  NVIC_InitTypeDef NVIC_InitStructure; 

  

  NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);

  NVIC_InitStructure.NVIC_IRQChannel = OTG_HS_IRQn;

  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;

  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 3;

  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;

  NVIC_Init(&NVIC_InitStructure);  

}

im very appreciate if someone can help
0 REPLIES 0