Skip to main content
Moamen Ayman
Associate III
December 10, 2016
Question

USB circuit

  • December 10, 2016
  • 5 replies
  • 964 views
Posted on December 10, 2016 at 13:32

Hello, I'm trying to use the usb peripheral embedded in stm32f407vgt6 as device. I connected D+(from host) to D+(of my MC) through 22Ohm resistor and 

D-(from host) to D-(of my MC) through 22Ohm resistor also Vbus(from host) to Vbus(of my MC) without resistor and left ID pin(of my MC) floating. I read that I should connect Vbus to D+ through 1.5KOhm resistor in order for the host to recognize when device is connected, is that correct? and is my circuit correct?

    This topic has been closed for replies.

    5 replies

    shingadaddy
    Senior
    December 10, 2016
    Posted on December 10, 2016 at 18:06

    Vbus?( 5V ) or MCVDD (3.3v)? Where did you read you 'should connect Vbus to D+ through 1.5KOhm resistor in order for the host to recognize when device is connected'. 

    Doesn't sound right?

    Circuit-

    That looks TYPICAL but the user manual for the F4 might have more details.. VBUS (The host supplied USB 5V) goes straight into an L4 on PA9

    Your pulling D+  high to let the HOST know there is a FULL SPEED DEVICE on the line. If it is in fact a HIGH SPEED device, the host and device initially talk at FULL and then switch to HIGH. Meaning sometimes the pull up needs to be able to be REMOVED (switched in and out) programmatically to operate at high speed so the line impedance is a lttle more friendly than with the pull up connected. The L4's have this resistor magic internally. Check the manual for the F4 and make sure if there is a separate VDDUSB pin for USB power, that it is in fact powered. The L4 has that and if you miss that, its a no go. My dev board DID have it connected to VDD as default. But if you did your own board and missed it, get out the blue wire wrap wire and your finest soldering iron tip. Plus FLux wouldn't hurt.   :\

    Moamen Ayman
    Associate III
    December 10, 2016
    Posted on December 10, 2016 at 21:50

    well, so the pull up resistor is just for the host to recognize full speed device and could be ignored if I will work on high speed. Vbus should goes directly to Vbus.

    shingadaddy
    Senior
    December 10, 2016
    Posted on December 10, 2016 at 22:18

    'well, so the pull up resistor is just for the host to recognize full speed device'

    Yes. At least partly during recognition.

    'and could be ignored if I will work on high speed.'

    Not exactly. When you plug in to the PC the PC has to recognize A DEVICE.

    If you have D+ pulled up, the PC thinks a FULL SPEED device got plugged in.

    If you have D- pulled up, the PC thinks a LOW SPEED device got plugged in

    If you have a device that can do HIGH SPEED, the PC needs to see a FULL SPEED device during initial plug in time (You need the resistor) and then the device/PC negotiate to the HIGH SPEED if both sides are capable. Then the resistor *might* be switched out.

    'Vbus should goes directly to Vbus.'

    We'll define 'Vbus' here: The 5VDC supplied by a USB HOST to a DEVICE. Whether it USES it (BUS POWERED) or NOT (SELF POWERED).

    Check the manuals for your specific part. It varies.

    For the STM32L476 port PA9 will take the USB 5VDC direct in and will allow you to detect that your micro device has been plugged in to a HOST(PC maybe) if you have VBUS SENSE enabled on the micro. Handy in SELF POWERED applications. In bus powered applications, you don't need VBUS SENSING necessarily since by virtue of your processor actually running at ALL means it has power and therefor can maybe assume it MUST be plugged into a HOST. Then it yanks the pull ups on or off as needed.

    shingadaddy
    Senior
    December 11, 2016
    Posted on December 11, 2016 at 01:00

    Sorry no experience with those. I was looking at the device the ST Eval board had on it. Hopefully the above is helpful and if so, if you don't mind clicking the Helpful star or the Thumbs up 'Like' I would appreciate it.

    Good luck with your project.