More data for Apple fans, and a slight rant about "defensive product design". This time it's a capture from an Apple 87w charger. (2016 Macbook Pro 13 w/ Bar + 2m cord)
tl;dr: There's some shonky business here... some of it makes sense, other parts may be bugs or "compatibility hacks".

https://plus.google.com/102612254593917101378/posts/BowoRMfDAAS

In my previous post above, I looked at the OEM behavior of the Apple 61w charger. This time it's the 87w. I wanted to go over this one in-depth since: (a) it is one of the only production >3a (>60w) supplies on the market, so its behavior is worth scrutiny. And (b) this very same behavior is causing the +Nintendo Switch to crash. (To be brief: the same behavioral quirks I discovered with the 61w still exist here. So I'll skip describing them again, and instead focus on more educational issues.)

https://plus.google.com/+BensonLeung/posts/71FgNerD8TB

Per the USB-C "Power Rules" as explained by +Benson Leung, USB-PD power supplies are supposed to advertise >3a (>60w @ 20v) only if the USB-C cord is (1) eMarked and (2) the eMarker flags the cable as meeting the resistance requirements to carry 5a of current. (Remember: power losses are calculated as P = I^2 * R... the voltage V doesn't appear in this equation.)

If the above is true, how should a USB-PD supply tell a device how much it can take as soon as it is connected? There may not even be an eMarker to respond. How do you do negotiations in reasonable amount of time? Consider if the eMarker is slow to reply. If you use a hard-coded timeout, or the timing is at or above the maximum permissible values due to a glitch, the device may assume you aren't a USB-PD supply at all -- since you didn't speak up fast enough.

Apple chose to address this issue in a very.... interesting... way. Please see the first picture. The Apple 87w will feign it is only a 12w (5v/2.4a) supply.

It will first negotiate a 12w contract with the device (in this case, the Macbook 13 w/ Bar), and the device more than likely complain. (CAP_MISMATCH.) Once settled, it will ask the eMarker in the background for the cable's capacity. If it gets a favorable response, (in this case, the Apple 2m "rectangular box" cable is 5a rated,) the Apple 87w charger will RE-ADVERTISE its capabilities and include all the levels it supports. (5v, 9v, and 20v... the 20v being at 4.3a.) If the cable was a 3a cable, or not eMarked at all, it will claim 20v/3a instead. (Note: this is completely different to how the Apple 61w adapter behaved. That one doesn't even query the eMarker, since all cables are supposed to be good for 3a [60w], so it doesn't matter.)

This re-advertisement behavior is problematic for two major reasons:

First, let me clarify: readvertisement is perfectly OK by the spec if the charger needs to "spool up its circuits". However in the Apple 87w adapter's case, that readvertisement appears to be a workaround -- likely not because of circuit design necessity. Nothing says the adapter couldn't first advertise 5v/9v/20v@3a in one go, then switch to 5v/9v/20v@4.3a (if-and-only-if) the cable responds appropriately in the background. In fact, this is how some other power supplies I've tested handle it. (Note: this is likely why the Switch doesn't crash with the Apple 61w charger, but does with the 87w!)

Second, this readvertisement directly resembles the "Split PDO" issue some chargers have. This in turn causes problems for "sketchy" USB-PD sinks. As painfully evident, not all USB-C products on the market right now are coded properly; many have significant errors. Some will "latch onto" the first advertisement they see and go down a poorly-coded path in their finite state machine logic... ignoring all subsequent advertisements. This is bad since USB-C requires devices honor any changes in negotiated power and restrict themselves QUICKLY.... within 60ms or something like that.

I presume Apple did it this way to "screen out" any devices that are poorly coded. Such devices will "get stuck at the kiddie table" and only ever see 5v/2.4a (12w). It is a lot safer if something goes wrong at 12w, than goes wrong at 20v/3a (60w). Some people have made EZ-Bake ovens powered by USB-C.... so I can understand Apple's excessive caution. (Note: I wonder how it will interact with a device that DOESN'T send a CAP_MISMATCH at 5v/2.4a?)

https://www.reclaimerlabs.com/blog/2017/3/14/usb-c-easy-bake-oven

However, there is some additional compatibility behavior that Apple seems to have implemented on the Macbook Pro side. (This could also be a bug, but I'm operating under the assumption "Apple does not play dice.")

During my traces I noticed my family member's Macbook, after the initial 12w-87w shuffle, overwhelmingly "juggled" its request from 20v/3a BACK down to 5v/2.4a then BACK up to 20v/3a. I've highlighted this behavior in the second picture. (The highlighted packet is common to both, for legibility/scrolling.)

This drop-down-then-back-up behavior seems to be pointless and would appear to tax the Apple 87w charger and Macbook circuits unnecessarily. Therefore, I must conclude this behavior is intentional. I presume this is a workaround with some product I haven't tested yet, that was either not charging, or "got stuck" as described above. I say this because Apple prides itself in "It just works".... even if said product is known to be buggy. Apple appears to invest the labor to get it working on their side.... or worst-case.... will blacklist it. (I cite the Intel TB3 chipset driver fiasco.)

https://9to5mac.com/2016/11/21/tb3-enabler-enable-unsupported-thunderbolt-3-devices-hack-macbook-pro/

In my opinion, this "compatibility hack" illustrates the problems of coding around known-bad products in the ecosystem -- rather than calling them out. Apple may know about this issue, and take steps to correct, but other companies will not. This will result in confusion for users when one product works but another doesn't, with no clear reason why. Since "it seems to work fine" for a juicy segment of the consumer base, the manufacturer will feel no pressure to fix their mistake.

Another hazard: some companies may emulate this behavior without knowing why. Instead of adhering strictly to the spec or best-practices, or bringing flaws to attention through the proper channels, they will do whatever the 800lb Gorilla is doing. Or, will validate only against the Gorilla's products; ergo, the flaws go undiscovered during limited pre-production testing.

Call me a stick in the mud, but someone's going to have to take the hard-line approach on things like this. Else everything will devolve into lowest common denominator "defensive product design". (Some single out +Microsoft's Surface Pro 2017 here... rightly so.) My commentary may be viewed as "bad PR for USB-C" by some, but in reality it should be viewed as an "engineering watchdog" --
keeping a protective eye out for their products.

I do admit I have a great deal to learn from others more experienced than I. However, I sincerely hope I will eventually be able to apply this type of passion professionally, while preserving the core message. "Ethical engineering" has seen a resurgence due to the VW scandal, but is still viewed as a luxury (or an excess) in consumer products.

#USB #TypeC #USBC
Photo
Photo
6/2/17
2 Photos - View album
Shared publiclyView activity