2017-05-17 06:52 AM
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 #stm32f42017-05-23 07:52 AM
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.2017-05-24 10:50 AM
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 ?
2017-05-24 11:21 AM
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.
2017-05-29 03:07 AM
Hi
garsi.khouloud
,Did you see my answer ?
Thanks.
Best regards, Vincent.2017-05-30 06:05 AM
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.
2017-06-01 04:45 AM
Hi Vincent,
Khouloud.
2017-06-01 07:05 AM
Hi,
The related reference manual will be updated. The SOFOUTEN bit shouldn't have been mentioned.
The GCCFG register definition is correct.
Please, refer to the USB example found under the cube package. It's already tested using the STM32F446 device.
Khouloud.
2017-06-01 08:31 AM
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.
2017-06-01 09:58 AM
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
2017-06-02 09:50 AM
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.