0

USB_VCC SELECTION CIRCUIT METRO M4
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

USB_VCC SELECTION CIRCUIT METRO M4

by StanHemphill on Sat May 01, 2021 9:12 am

Please explain the purpose of this switching circuit on the Metro X M4. The circuit uses a single gate, a FET, and 5V0, 3V3, and VIN. It's just a messy circuit and I would like to know the reason for it and it's intended method of function. I've been building Satelite, Cable, and Terrestrial Set-top Boxes for 20 years upon which we have the traditional USB. IIRC there were 4 pins Vcc, D+, D-, and Gnd. There was no "ID" to the best of my recollection. Please clarify this circuit for me. I'm making a version of this which will operate from Vin at the 2.1mm Jack. No options for powering thru the USB or Boards pins. I would like to simplify this circuit without compromising the USB operation.
Adafruit Metro M4 Express (modified).png
Adafruit Metro M4 Express (modified).png (83.12 KiB) Viewed 105 times

StanHemphill
 
Posts: 7
Joined: Wed Apr 14, 2021 9:00 am

Re: USB_VCC SELECTION CIRCUIT METRO M4

by adafruit_support_mike on Sat May 01, 2021 8:46 pm

There's a lot happening in there.

The P-mosfet is a fairly common reverse polarity protection circuit: the drain is connected to 5V so the body diode is forward biased when VBUS is positive relative to GND, but reverse biased if GND is positive relative to VBUS. Assuming power is connected right, currrent through the body diode provides enough of a connection to make a DC path between the mosfet's source and GND. That pulls the voltage divider at the gate low, turning the mosfet on with enough Vgs to drop Rds.on to the milliohm range. The result is a polarity-protected connection with no forward voltage loss from a diode.

The 100k-100k voltage divider from Vin provides hot-swapping and voltage checking between USB-5V and the DC barrel jack. The DC barrel jack is the upstream power source for the NCP1117 5V regulator. That's a linear reg, with a headroom requirement of about 1.2V, so it needs at least 6.2V to maintain regulation.

The DMP3098L has a nominal Vgs.th of -1.8V. Subtracting that from 5V at the source, the mosfet will turn on when its gate voltage is below 3.2V and turn off when the voltage is higher than 3.2V. With the 100k-100k divider, the voltage at Vin has to be at least 6.4V to shut the mosfet off.

The DC barrel jack is also polarity protected with an MBR120 low-Vf Schottky diode. The nominal drop across that is 200mV, so adding that to the 6.4V requirement from the voltage divider, external power only takes over when the voltage is higher than 6.6V.

Both supplies are hot-swappable, and the circuit will take 5V from the correct source for any in-spec USB voltage on USB-5V and any voltage at the DC barrel jack between 0V and 12V.

The 74LVC1G125 is there for USB-OTG support. In a USB micro-A connector, the ID pin is grounded. That disables the buffer and tristates its output so it doesn't interfere with the 100k-100k divider.

In a micro-B connector, the ID pin floats. That puts the 74LVC1G125 under control of USB_HOSTEN, connected to PORTB[7] on the SAMD51. The microcontroller can decide whether to isolate USB-5V completely, take power from USB-5V, or take power from the DC barrel jack and send power out through USB-5V to a peripheral device.

You also have the option to power the board from an external 3.3V source. If that's connected and the USB_HOSTEN pin is floating, the external 3.3V will enable the 74LVC1G125 and send its output high, cutting off USB-5V.

That's mostly a protective measure. A lot of 3.3V devices have absolute maximum supply voltages between 3.6V and 4.5V, and it's depressingly easy to kill a bunch of external hardware plugging a USB cable in to tweak some code. The microcontroller does still have the option to enable USB-5V by pulling USB_HOSTEN low.

The mosfet-and-voltage-divider is a standard piece of circuit furniture. The 74LVC1G125 is a newer addition to support the option of using USB-OTG.

It all works, but we're always willing to learn. If you have a better circuit that meets all the requirements, we'd love to see it.

adafruit_support_mike
 
Posts: 62799
Joined: Thu Feb 11, 2010 2:51 pm

Re: USB_VCC SELECTION CIRCUIT METRO M4

by StanHemphill on Sun May 02, 2021 2:17 am

Yikes, Mike, yeah there's a lot going on in there. I see what your doing and given all that your trying to do I can't think of a better way just off hand. I'm retired now, 3~4 years, so I'm not deep in the day to day design of STB anymore, but I remember that our Traditional USB (micro A and Micro B not yet common in those days) provided some protection, but there was a little SOIC we used for protecting the STB from what stupid things might be happening in the outside world. Maybe I can find out from one of my former colleagues what we did, I remember it was clean, but I don't have any of the schematics or BOMs from those days.

Meanwhile, suppose, for arguments sake that you're not trying to support all the various optional ways of supplying power to the Metro. Suppose that power will be provided always to the Metro via the Barrel Jack (Vin 9V0 or thereabouts), that Vin will be regulated by the VREG to 5V0 and then further regulated by the VREG to 3V3. Suppose all the 5V0 pins and 3V3 pins around the periphery will ALWAYS BE OUTPUTS and supply power for peripheral purposes. Those power pins will NEVER be inputs to which power will be applied from external.

Given the above assumptions as to simplified power supply expectations, the Metro USB will always be a Slave USB, connected to a Master USB on a computer, yes? Further I have no expectation that the USB will be used to power nor operate any externally connected devices like mouse or keyboard. There is therefore no need to supply power to the USB VCC pin as it is not expected to supply USB power out to anything, that Vcc would be already on the pin from the PC. Hypothetically, the USB Vcc pin could be left unconnected internally. What's important for the purposes of pushing the sketch from the PC to the Metro is for D+ and D- be working and properly, and for there to be a good clean ground.

You may remember from my other questions that the purpose of my Metro M4 is to drive an RA8875 and a 5" TFT display.

Sincerely,

Stan

P.S. Check this URL : https://www.nxp.com/products/power-mana ... X18P3001UK

USB-OTG Power Management.png
USB-OTG Power Management.png (49.18 KiB) Viewed 90 times

StanHemphill
 
Posts: 7
Joined: Wed Apr 14, 2021 9:00 am

Re: USB_VCC SELECTION CIRCUIT METRO M4

by adafruit_support_mike on Mon May 03, 2021 9:44 pm

i
StanHemphill wrote:Meanwhile, suppose, for arguments sake that you're not trying to support all the various optional ways of supplying power to the Metro.

That gets into the difference between consumer electronics and development hardware.

All design is a process of migrating the requirements and the hardware toward each other until you have a working solution. In the design of a commercial product, you always want to minimize the production cost, and in general, experienced designers prefer simpler designs over more complex ones.

In consumer electronics, all of those facts lead the designer to prune the list of requirements aggressively. One way to do that is to set a fairly narrow range of acceptable operating conditions, then make sure those conditions are enforced. A fair part of the designer's job involves just that: creating a power supply, filters, signal isolation, and any other boundary circuits necessary to keep the environment inside the enclosure under control. That's why so many devices have tamper-evident stickers on the case: opening the case exposes the guts of the system to unspecified conditions that could damage something.

Development hardware's main requirement is to survive the user's imagination. We've set some design limits on boards like the Feather, but people have other ideas. A reliable fraction of posts here in the forum begin, "the documentation says to do X or Y, but I want to do Z", or "I was reading the datasheet and found [feature we never even considered supporting]". A few days ago I told someone how to tack fly wires to the SAMD21 on a Trinket M0 so they could run multiple strings of NeoPixels after they ran out of existing pins.

Our job is to build devices people want to use, not to tell people what they're allowed to make, so we treat those cases as market research. Among other things, we've learned that people want as much flexibility with power as they can get.

We also have our own roadmap for things we want to support, and occasionally build support for things well before we announce them.

adafruit_support_mike
 
Posts: 62799
Joined: Thu Feb 11, 2010 2:51 pm

Re: USB_VCC SELECTION CIRCUIT METRO M4

by StanHemphill on Tue May 04, 2021 8:55 am

Well said. Some 40+ years doing exactly what you just described. Some 20+ with these digital mpeg2/h.264 set-top boxes.

None of what I said in my mail is intended to imply that the Metro M4 should be done differently, but rather to understand what is or is not needed in my application, not that the M4 should have been done that way, or any other way in particular. I hope you get that as the reply sounded rather defensive.

I’m still interested in your opinion on winnowing the USB Port down to just upload sketch capability (for that case where) one decides to do your own PCB. I have a Metro, but I want it to be my tinkering and development hardware exactly as you said, but the board to connect the RA8875 and 5inch display will eventually be mounted inside a computer housing for some hardware and cooling management. The display is for displaying information. I don’t want to sacrifice my Metro to an actual application.

There’s another project with a similar requirement for streamlined D21, but connected to altitude, and acceleration sensor; and possibly a camera for video capture. That goes inside the avionics bay of a high power sounding rocket, so you don’t put your Metro in there either.

OK, bedtime here. Goodnight,

Stan

StanHemphill
 
Posts: 7
Joined: Wed Apr 14, 2021 9:00 am

Re: USB_VCC SELECTION CIRCUIT METRO M4

by adafruit_support_mike on Wed May 05, 2021 4:58 pm

StanHemphill wrote:None of what I said in my mail is intended to imply that the Metro M4 should be done differently, but rather to understand what is or is not needed in my application, not that the M4 should have been done that way, or any other way in particular. I hope you get that as the reply sounded rather defensive.

Sorry about that. It happens sometimes.

StanHemphill wrote:I’m still interested in your opinion on winnowing the USB Port down to just upload sketch capability (for that case where) one decides to do your own PCB. I have a Metro, but I want it to be my tinkering and development hardware exactly as you said, but the board to connect the RA8875 and 5inch display will eventually be mounted inside a computer housing for some hardware and cooling management. The display is for displaying information. I don’t want to sacrifice my Metro to an actual application.

For your own design, I'd say that's an excellent choice.

We often say, "a feature only makes a [board, device, etc] 'better' if you actually use it", and the KISS principle exists for a reason. Dev boards like ours are good for building a proof of concept, and then you can trim the hardware down to what suppports the specific application.

StanHemphill wrote:There’s another project with a similar requirement for streamlined D21, but connected to altitude, and acceleration sensor; and possibly a camera for video capture. That goes inside the avionics bay of a high power sounding rocket, so you don’t put your Metro in there either.

Oh yeah.. for that you'd want something light and battery powered. I'd probably lean toward an ItsyBitsy or one of Paul Stoffregen's Teensy boards for that. There are also some purpose-built boards for model rocketry:

https://hackaday.com/2018/02/24/these-s ... -rocketry/

adafruit_support_mike
 
Posts: 62799
Joined: Thu Feb 11, 2010 2:51 pm

Please be positive and constructive with your questions and comments.