cancel
Showing results for 
Search instead for 
Did you mean: 

Is USB_OTG_BSP_Init ''eval-board specific''/non-essential?

StephanMair
Senior
Posted on April 15, 2014 at 08:14

When I was trying to use the official USB host library I came by this func:

USB_OTG_BSP_Init

And it has some of these components:

/* Configure SOF Pin */

  GPIO_InitStructure.GPIO_Pin = HOST_OVRCURR_LINE;

  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;

  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;

  GPIO_Init(HOST_OVRCURR_PORT, &GPIO_InitStructure);

 

  /* Connect Button EXTI Line to Button GPIO Pin */

  GPIO_EXTILineConfig(HOST_OVRCURR_PORT_SOURCE, HOST_OVRCURR_PIN_SOURCE);  

 

  /* Configure Button EXTI line */

  EXTI_InitStructure.EXTI_Line = HOST_OVRCURR_EXTI_LINE;

  EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;  

  EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling;

  EXTI_InitStructure.EXTI_LineCmd = ENABLE;

  EXTI_Init(&EXTI_InitStructure);

   USB_OTG_BSP_TimeInit();

Are the above mentioned configurations necessary? And by that I'm referring to

/* Configure SOF Pin */

  /* Connect Button EXTI Line to Button GPIO Pin */

  /* Configure Button EXTI line */

those parts.

And by necessary I mean do I have to have them, even if I'm not using the official evaluation board from ST at all? I don't want to have any button involved. My guess is no, but it may be a good idea to utilize the same design/setup as ST did.

Any help would be greatly appreciated.

5 REPLIES 5
chen
Associate II
Posted on April 15, 2014 at 10:42

Hi

''When I was trying to use the official USB host library I came by this func:

USB_OTG_BSP_Init ''

Yes, this function must be tailored for each specific application.

''Are the above mentioned configurations necessary?''

Not if they are not part of the board you are working on.

The function USB_OTG_BSP_Init() must configure the USB port (at a bare minimum).

StephanMair
Senior
Posted on April 16, 2014 at 02:25

Thank you, I'm customizing it for my own project now.

Anymore suggestions from anyone would be appreciated still.

StephanMair
Senior
Posted on April 16, 2014 at 03:15

Hello, Since I'm not using ST's official board,  I haven't found much useful inside. However I did find two func that maybe crucial to my porject:

RCC_OTGFSCLKConfig(RCC_OTGFSCLKSource_PLLVCO_Div3);

  RCC_AHBPeriphClockCmd(RCC_AHBPeriph_OTG_FS, ENABLE) ;

And it appears that both lines are configuring the OTG FS clock, do I need them? I'm using F105 connective line chips as HOST, Do I need to have OTG FS clock configured and started? I'm guessing yes. Please, do help me! Thank you in advance.

Also, I'm skipping all the rest codes since I don't need EXTI_button or overcurrent detection, I hope it's OK. The EXTI button described in the function is a button soldered on the official board, right?

chen
Associate II
Posted on April 16, 2014 at 10:27

Hi

''  RCC_AHBPeriphClockCmd(RCC_AHBPeriph_OTG_FS, ENABLE) ;''

This command enables the clock from the 'clock bus' to the USB peripheral.

''RCC_OTGFSCLKConfig(RCC_OTGFSCLKSource_PLLVCO_Div3);''

I am not 100% certain but it looks like this selects the clock source and the clock divider for the USB peripheral.

Both are needed.

StephanMair
Senior
Posted on April 17, 2014 at 12:17

Thank you, the  AHB clock is definitely needed, and since I'm using host mode, I suppose the OTG clock is a necessity too. Thank you very much! You have been a great help to me!