cancel
Showing results for 
Search instead for 
Did you mean: 

I can't initialize PB12 (STM32H743ZIT6) for Input NoPull if I would initialize USB HS to.

PBere
Associate

I generated the code with cubeIDE.

PB12 would be a digital input. I pulled down this an 100kOhm resistor to GND.

I don't connect any else to this pin yet.

I measured this pin around 2,6V-2,8V.

I tried several panels and the promlem is the same.

Somebody met this bug before?

Thanks

7 REPLIES 7

In some STM32 models, USB PHY overrides the GPIO settings. This is undocumented and unacknowledged by ST, but has been reported here several times already, I'm lazy to look it up now. This may be the same case.

JW

flyer31
Senior

Well, USB-HS uses ULPI interface, and PB12 is used for data exchange in ULPI, so your question sounds a bit stupid... .

This stems from ST's inability to establish a solid nomenclature for the USB OTG modules and their PHY. In 'H7 datasheets (the pinmux table), they kinda' started in the right direction by marking them OTG1 and OTG2, but then they ignore this nomenclature in names of individual signals in the very same table. No wonder they also in CubeMX ignore this own nomenclature, adding more and more names, promoting further the confusion they introduced in earlier models.

In 'H743, OTG1 - which in CubeMX is apparently called USB_HS - can use both external ULPI (which traditionally is called HS but may be capable of FS, too) and its internal PHY for FS-only. PBere obviously chose using the internal PHY, as witnessed by DP/DM being assigned to PB14/PB15, leaving PB12 free - unless the 'H7 suffers from the plague of PHY overriding the GPIO settings (PB12 is OTG1 PHY's ID pin).

JW

In any case, read out the GPIOB registers and check their setting for PB12.

JW

PBere
Associate

Thanks every answers!

I configurated USB-OTG-HS with Internal FS Phy in Device_Only.

I did not set up PB12 ULPI-D5 manually. (But I checked the code if I will set up. Just in this case I saw PB12 setup for ULPI-D5 in USB config function.)

I checked the GPIO registers in Debug:

Before USB init: (PB12 initialised input-floating)

MODER.MODE12==0 -->INPUT

OTYPER.OT12==0   -->OUT PP (reset state)

PUPDR.PUPD12==0   -->FLOATING

IDR.IDR12==0   -->0V

ODR.ODR12==0   -->0V

LCKR.LCK12==0   -->NOT LOCKED

AFRH.AFSEL12==0   -->AF0

After USB init: (PB12 initialised input-floating -- excepd PB12 pin measured voltage:2.7V)

MODER.MODE12==0 -->INPUT

OTYPER.OT12==0   -->OUT PP (reset state)

PUPDR.PUPD12==0   -->FLOATING

IDR.IDR12==1   -->2.7V

ODR.ODR12==0   -->2.7V

LCKR.LCK12==0   -->NOT LOCKED

AFRH.AFSEL12==0   -->AF0

After USB init and reinitialise PB12: (PB12 initialised input-floating -- excepd measured voltage:2.7V)

MODER.MODE12==0 -->INPUT

OTYPER.OT12==0   -->OUT PP (reset state)

PUPDR.PUPD12==0   -->FLOATING

IDR.IDR12==1   -->2.7V

ODR.ODR12==0   -->2.7V

LCKR.LCK12==0   -->NOT LOCKED

AFRH.AFSEL12==0   -->AF0

Can you please

  • try to switch on the internal pulldown, and measure the output (don't need to write code, you can do it in the debugger alone); perhaps also try to attach an external pulldown, various values, try perhaps 10kOhm and 1kOhm
  • try to change the pin to GPIO Output and observe if it follows changes in ODR
  • try to disable USB's PHY (set OTG_GCCFG.PWRDWN to 0) and measure the pin's output

Thanks,

JW

Sorry, I neither like nor use STMcube ... I cannot give you answers on such detail questions ... STMcube has "deep and tricky dungeons" in the software, it is always difficult to judge what is happening there ... .

But I use USB-HS in HiSpeed mode together with much other peripherals ... and all running VERY nice - STMH7 is really a very nice controller family (STMcube free :)).