2017-05-17 12:06 AM
For our application we use a USB Host to communicate with a HID class device. We've constructed a way to measure the state of the device by measuring the Impedance on the USB datalines. This requires that the datalines are in a high impedance state.
Our problem is that we cannot put the USB datalines in a high impedance state after the USB Host has been initialized.
It seems that, once the USB has been power the pull-downs can only be disabled trough a reset.
The USB de-iniitialization function does not affect the GPIO. It seems they cannot be re-configured to something else.
Is there a way to properly disable the USB and return the original GPIO functionality to these pins?
We use STM32CubeMx Together with Atollic truestudio.
#usb-host #stm32Solved! Go to Solution.
2017-10-06 09:39 AM
Arsenii has found the solution.
https://community.st.com/0D50X00009XkXJZSA3
JW
2017-05-17 03:14 AM
Changing AF in respective GPIO_AFRL/AFRH, and/or MODE to any other than AF in GPIO_MODER, does not help?
JW
2017-05-17 06:00 AM
I'm using the HAL library.
I've tried to re-initialize the pins using HAL_GPIO_Init to different modes but none of them works as expected. The datalines still have the pulldowns if the usb has been initialized.Tried input, output_pp, output_od, analog, etc.
Something like:
GPIO_InitTypeDef GPIO_InitStruct;
GPIO_InitStruct.Pin = GPIO_PIN_11|GPIO_PIN_12;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_OD; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);The USB host driver configures the alternate function as:
GPIO_InitStruct.Alternate = GPIO_AF10_OTG_FS;
Can i force remove this connection somehow?
Tried the USB_CoreReset, HAL_HCD_ResetPort.
2017-05-17 06:45 AM
I'm using the HAL library.
I don't care, neither does the chip.
I've tried to re-initialize the pins using HAL_GPIO_Init to different modes but none of them works as expected.
This is unsetling. You might be onto something not documented properly. I faintly recall seing something similar being discussed here long ago, but can't find it.
Don't you have locked the GPIO? Read back the relevant GPIO register content.
The USB host driver configures the alternate function as:
GPIO_InitStruct.Alternate = GPIO_AF10_OTG_FS;
Can i force remove this connection somehow?
As I've said, by changing the respective bits in the GPIO_AFRL/AFRH. You can do it in the debugger, no need to program.
JW
2017-05-17 08:15 AM
Thanks for the clarification!
So I've checked the registers
GPIO_AFRL/AFRH and
GPIO_MODER during the USB host initialization/de-initialization with a debugger and they do get set and reverted back to the same value as before the initialization.
The re-configuration after also set the registers correctly.... but the pull down:s are still there.
Any ideas?2017-05-17 01:50 PM
It's HUMM then.
ST: Please comment.
JW
2017-10-02 04:03 AM
Hello!
Was the problem fixed? I am facing the similar problem with Usb de-initialization
2017-10-06 09:39 AM
Arsenii has found the solution.
https://community.st.com/0D50X00009XkXJZSA3
JW