Skip to main content
Kuikui
Associate III
May 17, 2017
Question

STM32F4 USB FS and PA8 as output not working

  • May 17, 2017
  • 9 replies
  • 4987 views
Posted on May 17, 2017 at 15:52

Hi,

I'm using the STM32F446ZE.

I'm using PA11 and PA12 for USB FS DM and DP, but I don't need PA8 as SOF, I need it as a simple output.

USB is runing fine only if PA8 = 0 !

If I set PA8 output to 1, the USB disconnects.

It looks like the PA8 is in Alternate function mode, but after double-check, the PA8 mode is in Output mode ( MODER8 = 1, AFR8 = 0 ).

Did someone already faced this issue ?

Thanks and best regards,

Vincent.

#usb-fs #stm32f4
This topic has been closed for replies.

9 replies

waclawek.jan
Super User
May 17, 2017
Posted on May 17, 2017 at 21:36

Is this some know board such as a Nucleo or DIscovery? And the software is some of the examples?

JW

Kuikui
KuikuiAuthor
Associate III
May 18, 2017
Posted on May 18, 2017 at 09:19

Hi,

No I'm not running a known board.

But I think the problem is within the silicon of the STM32. I checked the erratasheet, but they never mention anything about USB (which is quite surprising !).

Software example :

Just setup the STM32 as USB FS device with PA11 and PA12.

Setup PA8 as output

Set PA8 output to 1, and your USB will disconnect.

waclawek.jan
Super User
May 18, 2017
Posted on May 18, 2017 at 09:43

Okay, and the USB portion of the software? Isn't it a port of some example or some 'library', which observes pin PA8 for any reason?

JW

Kuikui
KuikuiAuthor
Associate III
May 18, 2017
Posted on May 18, 2017 at 11:58

I'm using the USB library from ST ( en.stm32_f105-07_f2_f4_usb-host-device_lib )

Initially, the library setups PA8 as OTG_FS_SOF. I removed this part.

But maybe somewhere the 'OTG_FS_SOF' feature is used, but I couldn't find anything related to SOF.

Searching for 'GPIO_Pin_8' didn't give anything.

Khouloud GARSI
Technical Moderator
May 18, 2017
Posted on May 18, 2017 at 17:34

Hi

Del_Medico.Vincent

‌,

We have never encountered this strange behavior on the PA8 pin previously.

For further debug, could you please share your project or at least describe the steps leading to reproduce the issue.

Khouloud.

Kuikui
KuikuiAuthor
Associate III
May 19, 2017
Posted on May 19, 2017 at 14:03

Hi,

You will find the project here : 

https://wetransfer.com/downloads/1685d8590f0c6bbd9b484f756adcd9af20170519115436/81bab7d71e8bb8098b4846e94c52aa5020170519115436/a9b710

 

I was able to reproduce the issue, starting from scratch from ST's USB library.

I just removed from ST's library all the platform-related code ( LED, LCD, buttons ), and simplified the port A setup by just PA11 and PA12 as USB DP DM, and PA8 as output after USB init function.

Your feedback is welcome.

Kuikui
KuikuiAuthor
Associate III
May 19, 2017
Posted on May 19, 2017 at 14:02

Hi,

You will find the project here : 

https://wetransfer.com/downloads/1685d8590f0c6bbd9b484f756adcd9af20170519115436/81bab7d71e8bb8098b4846e94c52aa5020170519115436/a9b710

 

I was able to reproduce the issue, starting from scratch from ST's USB library.

I just removed from ST's library all the platform-related code ( LED, LCD, buttons ), and simplified the port A setup by just PA11 and PA12 as USB DP DM, and PA8 as output after USB init function.

Your feedback is welcome.

Khouloud GARSI
Technical Moderator
May 23, 2017
Posted on May 23, 2017 at 16:52

Hi

Del_Medico.Vincent

‌,

Using the project that you have sent and an STM32F446_EVAL board, the STM32MCU is enumerated as an HID compliant device whether the pin PA8 is set or reset.

Could you please verify your PCB. You may refer to the schematic used in the EVAL board.

Best regards,

Khouloud.

Kuikui
KuikuiAuthor
Associate III
May 24, 2017
Posted on May 24, 2017 at 17:50

Hi again

garsi.khouloud

,

ok, I got the point.

When I set PA8 as OUTPUT to1, it sets PA9 (which is set as INPUT) to 1 through another IC on my own board.

And PA9 is the 'VBUS sensing pin'.

I commented the '#define VBUS_SENSING_ENABLED', but it doesn't really disable VBUS sensing, and it still senses PA9 input to start USB connection.

Could you have a look at this ?

Khouloud GARSI
Technical Moderator
May 30, 2017
Posted on May 30, 2017 at 15:05

Hi Vincent,

I confirm that there is a misalignment between the reference manual and the USB library.

I have highlighted this internally for review and I will get back to you with any update on this point ASAP.

Sorry for any inconvenience this may have caused.

Khouloud.

Khouloud GARSI
Technical Moderator
June 1, 2017
Posted on June 01, 2017 at 13:45

Hi Vincent,

  • The STM32F446 MCUs are not completely supported using the STM32 SPL library.

    Enabling or disabling the VBUS sensing is not correctly managed.

    A new release of the library V2.2.1 will be available in coming weeks.
  • The project that you have previously sent does not use the PA9 pin (OTG_FS_VBUS). That's the reason no issue was detected from my side.
  • For the moment, I would advise you to download the

    http://www.st.com/content/st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32cube-embedded-software/stm32cubef4.html

    package.

    There is an application titled 'CustomHID_Standalone' .The application describes how to use USB device application based on the Custom HID Class on the STM32F446 device. 

    You may found it under the path below:

    STM32Cube_FW_F4_V1.16.0\Projects\STM32446E_EVAL\Applications\USB_Device\CustomHID_Standalone
  • Sorry for any inconvenience you have faced.

Khouloud.

Kuikui
KuikuiAuthor
Associate III
June 1, 2017
Posted on June 01, 2017 at 15:31

Hi

garsi.khouloud

‌,

Thank you for your answer and for confirming the issue.

You didn't answer about a problem in the datasheet itself (not related to the library) :

3. In the Reference Manual, page 1100, it talks about the SOFOUTEN bit of OTG_GCCFG register, bit this bit is not defined regarding page 1140

What I need to do is to disable VBUS sensing because my PA9 pin is used for another purpose (USART).

But now that I know the library is incorrect, I'm still not sure if the datasheet is correct or not.

Based on what is written in the datasheet, I couldn't manage to disable VBUS sensing.

I'll have a look at STM32F4Cube to see how they do to disable VBUS, supposing this part is working.

Vincent.

Khouloud GARSI
Technical Moderator
June 1, 2017
Posted on June 01, 2017 at 16:05

Hi,

The related reference manual will be updated. The SOFOUTEN bit shouldn't have been mentioned. 

The GCCFG register definition is correct.

0690X00000607ChQAI.png

Please, refer to the USB example found under the cube package. It's already tested using the STM32F446 device.

Khouloud.

waclawek.jan
Super User
June 1, 2017
Posted on June 01, 2017 at 16:58

Khouloud,

The related reference manual will be updated. The SOFOUTEN bit shouldn't have been mentioned. 

I am now completely confused.

Does that mean that SOF is not available on PA8 for OTG_FS and PA4 on OTG_HS?

And that they both are not available as optional input to TIM2_ITR1 ?

Or does this mean that SOF is available out from OTG_FS/OTG_HS at all times, regardless of how OTG_GCCFG bit 20 is set; and it is gated only at the GPIO/TIM2 level?

Is this a 'F446-specific change, as compared to other 'F4 and 'L4 and 'F2 and 'F7?

Thanks,

Jan

Khouloud GARSI
Technical Moderator
June 8, 2017
Posted on June 08, 2017 at 15:02

Hi

Waclawek.Jan

‌,

Does that mean that SOF is not available on PA8 for OTG_FS and PA4 on OTG_HS?

And that they both are not available as optional input to TIM2_ITR1 ?

->The OTG_FS_SOF and OTG_HS_SOF are available as alternate functions respectively on PA8 and PA4 pins.

Or does this mean that SOF is available out from OTG_FS/OTG_HS at all times, regardless of how OTG_GCCFG bit 20 is set; and it is gated only at the GPIO/TIM2 level?

-> Correct.

Is this a 'F446-specific change, as compared to other 'F4 and 'L4 and 'F2 and 'F7?

->The modification is for devices where GCCFG configuration register is different from:

0690X00000607H9QAI.png

The register is defined differently, so a new configuration should be applied.

Khouloud.