Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

RustyShackleford

macrumors newbie
Original poster
Oct 19, 2015
12
0
I've been using a 2017 Macbook Air (Intel silicon) to connect to an Arduino via USB. The Arduino is embedded in a system which has a 5vdc power supply which powers the Arduino during normal operation. When I connect via USB to the laptop (to download a new sketch or monitor the system status), there is a potential conflict between the system's 5vdc supply and the 5vdc power from the USB. To handle this, I put a diode between the system's supply and the USB power pin. When the system is operating normally, the Arduino is powered from the system's 5vdc, with a 0.5v or so diode drop. When I connect the USB, the diode is turned off, since there's 5vdc at both terminals, and the Arduino is powered from the USB port. This has been working well.

However, I recently upgraded to an Apple-silicon Macbook Air. Now, if I connect the laptop to the Ardiuno, while the system is powered (from it's own 5vdc supply), the Macbook's USB port turns off; the 5vdc signal from the USB port to the Arduino is disabled, and the port is not seen from within the Arduino development environment (running on the Macbook). If I turn off the system's 5vdc supply, the USB connection works as expected. Evidently, the Macbook detects that there's power on the Arduino end of the USB connection and shuts the port off. This is unacceptable, as I need to be able to monitor the Arduino's status, without first powering it down and losing any volatile state.

I seek suggestions for how to deal with this. Is there a way to disable this USB port behavior from the Macbook's settings ? Would an isolator such as https://www.amazon.com/DEVMO-USB-AD...-1-spons&sp_csd=d2lkZ2V0TmFtZT1zcF9hdGY&psc=1 help ?

P.S. For more detail on this, a couple of threads at the Adafruit forums may be of interest: https://forums.adafruit.com/viewtopic.php?p=1008130#p1008130 and https://forums.adafruit.com/viewtopic.php?t=142737&hilit=usb
 

RustyShackleford

macrumors newbie
Original poster
Oct 19, 2015
12
0
Turned out there was a simple fix: a hacked USB cable with the +5vdc wire (red) severed. So the Macbook's USB port has no indication that there is voltage present at the Arduino end of the cable. But the UART on the Arduino is still powered (by the system's 5vdc supply) and since the ground/negative reference is connected, the data rx/tx works. Of course, this also means that the system's 5vdc must be powered up in order for USB communication to occur (or use an un-hacked USB cable).
 
Last edited:

mr_roboto

macrumors 6502a
Sep 30, 2020
856
1,869
For what it's worth I don't think the diode advice you were being given in that Adafruit forums thread was good. Or at least, it was good once, but it isn't any more with a modern computer. (Sad to think that a 2017 Air doesn't qualify as modern any more, but there it is.)

The issue is that USB-C with power delivery complicates everything about USB power a lot. Power sources can now source DC voltages considerably higher than 5V (as high as 48V @ 5A = 240W in the latest PD 3.1 spec). 9V, 12V, 15V, and 20V are other possible modes. There's digital handshaking between PD source and sink to negotiate the highest common denominator voltage between the pair.

If you plug in a device which doesn't implement PD handshaking, and that device also just puts ~5V on VBUS (which devices are not, AFAIK, supposed to do, even in USB 1.0), that's going to be a red flag to the host port's PD controller. It probably can't sense the presence of a diode to block reverse current flow, and has to assume there's something non-standard going on, so the safest thing is to just isolate everything on that port. Designers have to be more paranoid with this stuff now.
 

RustyShackleford

macrumors newbie
Original poster
Oct 19, 2015
12
0
Ah, thanks for that explanation - makes perfect sense why I was having trouble.

So no reason to even have that diode anymore. If I want to do serial communication with the Arduino while it's powered up, I'll just the hacked cable (with the red +5v wire severed). If I want to be able to communicate with the Arduino when it's not powered up, use an un-molested USB cable.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.