2014-05-25 07:04 AM
I'm using F105RBT6. I'm not sure if I'm getting this right but it looks to me that I have to configure PA11, PA12 (I use host mode only so PA9 and PA10 probably isn't needed but correct me if I'm wrong) tp AF mode in order to use the USB host function.
Then this is where it gets really really confusing, as always, thanks to ST's dare I say nightmarish ambiguous tech docs: I don't know exactly what mode should I use when initializing those 2 pins. GPIO_Mode_AF_PP? GPIO_Mode_AF_OD? I'm going with GPIO_Mode_AF_PP but it doesn't work. To make the matter worse, when I referred to the F105 CL manual, I found that, when configured to AF, all these modes are available: USART1_CTS / CAN1_RX / TIM1_CH4 (7)/OTG_FS_DM So, which one am I using here exactly? I'm so confused. Does it mean if I configured it to AF, the MCU automatically detects which mode I'm using? Out of all those FOUR modes? Or is it the fact that since it's F105 CL series, my conventional F103 series wisdom no longer applies, and I have to use a whole new set of functions to enable OTG_FS_DM? To sum it up: I want to configure PA11, PA12 as USB DM and DP in Host mode, what should I do? Do I just use GPIO_Init function and chose GPIO_Mode_AF_PP mode or do I have to use a whole different function, NOT EVEN LISTED in UM0427? Any help would be greatly appreciated, thanks in advance.2014-05-26 05:04 AM
Please someone help?
2014-05-27 03:48 AM
Hi
''To make the matter worse, when I referred to the F105 CL manual, I found that, when configured to AF, all these modes are available: USART1_CTS / CAN1_RX / TIM1_CH4 (7)/OTG_FS_DM So, which one am I using here exactly? I'm so confused. Does it mean if I configured it to AF, the MCU automatically detects which mode I'm using? Out of all those FOUR modes?'' No, you must select which of the alternate functions to use. For USB : GPIO_PinAFConfig( GPIOA, GPIO_PinSource11, GPIO_AF_OTG_FS ); GPIO_PinAFConfig( GPIOA, GPIO_PinSource12, GPIO_AF_OTG_FS );2014-05-27 11:59 PM
Thank you again from your very helpful reply!
But are you sure? I'm using F105 CL, not F4 or F2 series so the function: GPIO_PinAFConfig may not even be found in the official library for F10x series MCUs?2014-05-28 01:06 AM
Hi
''But are you sure? I'm using F105 CL, not F4 or F2 series so the function: GPIO_PinAFConfig may not even be found in the official library for F10x series MCUs?'' Yes you are right, these function may not be in the library for these parts. I do not have the time to investigate the library for you. THe reference manual says : ''Alternate functions (AF) It is necessary to program the Port Bit Configuration Register before using a default alternate function. â—� For alternate function inputs, the port must be configured in Input mode (floating, pullup or pull-down) and the input pin must be driven externally. Note: It is also possible to emulate the AFI input pin by software by programming the GPIO controller. In this case, the port should be configured in Alternate Function Output mode. And obviously, the corresponding port should not be driven externally as it will be driven by the software using the GPIO controller. â—� For alternate function outputs, the port must be configured in Alternate Function Output mode (Push-Pull or Open-Drain). â—� For bidirectional Alternate Functions, the port bit must be configured in Alternate Function Output mode (Push-Pull or Open-Drain). In this case the input driver is configured in input floating mode If you configure a port bit as Alternate Function Output, this disconnects the output register and connects the pin to the output signal of an on-chip peripheral. If software configures a GPIO pin as Alternate Function Output, but peripheral is not activated, its output is not specified.''