cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4 USB FS and PA8 as output not working

Kuikui
Associate III
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
27 REPLIES 27
Khouloud GARSI
Lead II
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.

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 ?

Posted on May 24, 2017 at 18:21

I tried to debug, but it seems there are some mistakes in the library and the datasheet.

1. Page 1140 of the Reference Manual of STM32F446, the register 'OTG_GCCFG' does not comply with the USB_OTG_GCCFG_TypeDef structure defined in usb_regs.h

2. In USB_OTG_GCCFG_TypeDef structure, the 'disablevbussensing' should be 'enablevbussensing' regarding the definition of register 

OTG_GCCFG / bit 'VBDEN' => consequently, there are some mistakes in the library (setting 1 instead of 0 to 'disablevbussensing' variable)

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

However, if I try to 'fix' the possible msitakes, I don't manage to disable VBUS sensing feature.

Posted on May 29, 2017 at 10:07

Hi

garsi.khouloud

‌,

Did you see my answer ?

Thanks.

Best regards,

Vincent.

Khouloud GARSI
Lead II
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
Lead II
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.

Khouloud GARSI
Lead II
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.

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.

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

Posted on June 02, 2017 at 16:50

Hi,

I can't test STM32F4Cube example, but I had a look at the code.

The CustomHID example uses PA9 as VBUS sensing, and this is not what I want, I want PA9 as general purpose input.

Nevertheless, I looked deeper to see how the example handles the 'disable vbus sensing' feature, and I found that :

1. The USB register setup part is almost exactly the same as 

STM32 SPL library

2. Line 220 and 221 of stm32f4xx_ll_usb.c writes the 'B-peripheral session valid override' bits of GOTGCTL to force a valid session, BUT this bits are said 'reserved' in the reference manual, when using USB FS. So this seems wrong again

3. Even if this seems wrong, I've tested enabling 'B-peripheral session valid ovveride', and still it is impossible to enable USB if you're using PA9 as standard input with 0V on it.

All this makes me think of a hardware issue within the STM32F446 itself.