cancel
Showing results for 
Search instead for 
Did you mean: 

32F417 PA8 usable as GPIO if USB FS (non OTG) is being used?

PHolt.1
Senior III

Googling around, this is unclear. The data suggests it is polled by USB code (using the ST library) for slave device presence (USB ID) but in my project I am not supporting OTG mode.

The reason OTG is not supported is because a) you need to provide adequate power for what customers might plug in and b) it is hard/impossible to fulfil customer expectations regarding what will actually work.

4 REPLIES 4
TDK
Guru

Yes, you can use PA8 as a GPIO if USB is not used. You will need to ensure the USB library doesn't reconfigure it or depend on it.

If you feel a post has answered your question, please click "Accept as Solution".
PHolt.1
Senior III

That is why I asked here : - )

I am not sure there is any way to check the huge ST USB library to find out what it does with it in a given situation.

What one can do is find out how it initialises it.

PHolt.1
Senior III

Does anyone know how this bit of STM software works?

PA8 is SOF output, this has nothing to do with OTG.

If it is not set to the OTG_FS's AF in respective GPIOx_AFR, then it's not controlled by OTG and is free to use. The GPIOs, as per UM1725 chapter 3.12 How to use HAL drivers are set up in HAL_PPP_Mspinit() (where PPP is abbreviation of peripheral, USB in peripheral mode is in Cube/HAL called PCD, so HAL_PCD_MspInit(), see https://github.com/STMicroelectronics/STM32CubeF4/blob/4aba24d78fef03d797a82b258f37dbc84728bbb5/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pcd.c#L159 ) - that function is provided by *you*, so you know exactly which pins do you set up for OTG_FS.

You can also check if the OTG stack sets OTG_FS_GCCFG.SOFOUTEN - if not, there's no point in setting up PA8.

I don't use Cube.

JW