greatscottgadgets / luna

Amaranth HDL framework for monitoring, hacking, and developing USB devices
https://greatscottgadgets.com/cynthion/
BSD 3-Clause "New" or "Revised" License
993 stars 171 forks source link

Find Substitution for AP22811, as it is FAULTY #171

Closed Seas0 closed 1 year ago

Seas0 commented 2 years ago

The AP22811 have been marked as NOT RECOMMENDED FOR NEW DESIGN by Diodes lately, shall we consider use its successor, AP22818, as USB power switch at U1, U12, U13? Edit: both of them are NOT suitable for luna's design, see my latter comment.

mossmann commented 2 years ago

Yes, AP22818AKEWT-7 looks like the drop-in replacement for AP22811AW5-7 which we have specified. AP22811AW5-7 is still expected to ship, so I don't think we need to make a change urgently. We already have AP22804AW5-7 and AP22814AW5-7 designated as acceptable substitutes.

I think we should update the part number in the schematic to AP22818AKEWT-7 and add AP22811AW5-7 to the list of substitutes.

Seas0 commented 2 years ago

Well, after some careful examination, it seems the originally used DC switch, AP22811, and the candidate one, AP22818, is FAULTY in current design. DC switch design of Luna

Currently Luna's design assumed these DC switches should maintain the OUT port at High-Z when not enabled, either disable by the pull-down resistor or by FPGA.

But my self-built Luna's DC switches, U1 and U13, were getting ~100 Celsius after plugging in power supply to the target USB type-C port with about 2 watts drew from the power supply, indicating a huge current go through them, so I looked through the datasheet of AP22811 and found this section:

Discharge Function The discharge function of the device is active when enable is disabled or de-asserted. The discharge function with the N-MOS power switch implementation is activated and offers a resistive discharge path for the external storage capacitor. This is designed for discharging any residue of the output voltage when either no external output resistance or load resistance is present at the output.

Diagram of AP22811 Output resistance of AP22811 when in discharge mode

The datasheet of AP22818 describe almost the same thing so I'd only provide a link to it for reference.

As cited in their datasheet, they both have the "Fast Discharge" functionality activated in the absence of EN signal, which is actually shorting OUT and GND with a MOSFET and/or a resistor, explained the weird overheating problem as current could flow back to the OUT port of a disabled DC switch and directly drive to ground, easily heating up the DC switch and wasting power of the USB Bus.

POSSIBLE FIX:

Change the DC switches to these ones with High-Z OUT when disabled. I'm searching for them.

mossmann commented 2 years ago

Nice find! I think you are right that the output discharge function is not ideal for our application, although I don't know that I would say that it is faulty or that it explains the U1/U13 failure you observed.

I measure discharge current at 35 to 40 mA which agrees pretty closely with the discharge resistance of 90 to 130 ohms specified in the data sheet. This is wasteful, but I don't know that it is a big problem.

If you find a more ideal part, I'd love to see it. Otherwise we could decide to accept the discharge current or we could place diodes on the outputs (which would reduce the voltage by the diode drop).

mossmann commented 2 years ago

AP22818 has a discharge resistance of 140 to 200 ohms which is slightly less wasteful.

martinling commented 2 years ago

Torex XC8107 and XC8108 are amongst the few alternatives without load discharge that currently have some stock availability. The XC8108 has the added feature that the current limit is configurable with a resistor.

Seas0 commented 2 years ago

Some possible Pin-to-Pin alternatives:

mossmann commented 2 years ago

These are great finds! Thank you both! We are in the process of increasing the PCB size, so there will be plenty of space for a larger package. It's nice to have pin-compatible parts identified that can be dropped onto existing PCBs, but changing to a new package for r0.5 would be fine. Availability is a primary concern as we would need to purchase 15k units (5k boards) within four months.

mossmann commented 2 years ago

some more options:

While going through these I'm noticing that most of them (including AP22811 and AP22818) say that their absolute maximum VOUT is VIN + 0.3 V which we sometimes exceed when VIN is 0 V.

mossmann commented 2 years ago

My best guess is that the failure you observed was caused by VOUT overvoltage when VIN was at 0 V. Because of this as well as limitations of reverse current protection, we've been looking into various options and are likely to go with a FET-based solution rather than using integrated load switches.

straithe commented 1 year ago

I'm closing this issue as there hasn't been any additional conversation in quite a while. Thanks all!

mossmann commented 1 year ago

I'm reopening this because I'm still working on it.

mossmann commented 1 year ago

I went with AP2171 on r0.5 to address the initial component lifecycle concern and self-discharge. The overvoltage issue I later identified will be addressed in r0.6.