SAMD21 target back-powered through a port pin

For Adafruit customers who seek help with microcontrollers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
nis_
 
Posts: 12
Joined: Mon Feb 13, 2017 9:28 pm

SAMD21 target back-powered through a port pin

Post by nis_ »

adaforum_nis_30jan_a.png
adaforum_nis_30jan_a.png (352.48 KiB) Viewed 459 times
adaforum_nis_30jan_b.png
adaforum_nis_30jan_b.png (91.7 KiB) Viewed 459 times
Hi.

I am concerned about the risk of damage to the Adafruit target board arising from the way in which I've connected it to the project (as described, below -- please see the two uploaded Fritzing images, as well).

I've got two laptops, each connected to an Adafruit target board via its own USB cable, which powers the board and allows it to talk to the REPL in Circuit Python. One is Trinket M0; the other is Circuit Playground Express.

(Fritzing images depict Feather M0 Basic, for reference).

The two target boards are interconnected via three wires: TX, RX and GND (to establish a 9600 baud serial connection between them).

During development, it is necessary to periodically unplug one of the two target boards from its USB connection to its respective laptop (which also removes its source of +5V DC power).

. . .

Once that happens, the unpowered board nevertheless operates, but incorrectly: it blinks a strange alert pattern on its LEDs (Trinket M0 was observed doing so, with Circuit Python 2.2.0 resident on it).

Vcc on the unpowered micro seems to be somewhere near 2.8 volts (did not write down the exact figure). That measurement combined with the LEDs blinking on a supposedly unpowered micro leads me to think the micro is being back-powered through the UART connection to the powered unit (and/or through clamping diodes, which permit normal serial communications to occur when both units are fully powered on).

Any comments on how to approach this would be much appreciated by me.

Thanks for your time taken, to read this. -nis

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: SAMD21 target back-powered through a port pin

Post by adafruit_support_mike »

Yeah, you've identified the source of power correctly.

Are you using external protection diodes as shown in the diagrams above? If so, you probably don't need to worry about it. Most of the parasitic power will flow though those.

If not, powering a microcontroller through its IO pins is kind of a party trick. It isn't great, but usually doesn't do any damage. The microcontroller doesn't draw much current, and tends to self-limit at a rate the protection diodes can handle.

The best way to handle the issue would be to run the TX/RX signals through a double-pole switch between the boards. That way you can break the signal connection between the boards when you need to remove power from one:

https://www.adafruit.com/product/3220

User avatar
nis_
 
Posts: 12
Joined: Mon Feb 13, 2017 9:28 pm

Re: SAMD21 target back-powered through a port pin

Post by nis_ »

adafruit_support_mike wrote: Are you using external protection diodes as shown in the diagrams above? If so, you probably don't need to worry about it. Most of the parasitic power will flow though those.
Yes, and from the beginning (the 1N4148 clamping diodes were present the first time the project was powered on). A former employer told me to use the diodes, connect the grounds, and call it a day.

I didn't know what would happen if I removed them -- I usually use the diodes with a single-ended supply ('master power switch'); the above scenario hadn't come up until this week.
The best way to handle the issue would be to run the TX/RX signals through a double-pole switch between the boards.
I hadn't quite arrived at this; that'll be nice insurance.

I appreciate your insights! Wasn't sure if I should continue as-is.

Thank you, Mike! -nis
Last edited by nis_ on Tue Jan 30, 2018 1:49 am, edited 2 times in total.

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: SAMD21 target back-powered through a port pin

Post by adafruit_support_mike »

The external diodes can handle more than enough current to run a microcontroller, though you will see flaky behavior because the power is badly unregulated.

You can add a little more protection by connecting the TX/RX pins through 10k resistors instead of wiring them directly. The communication signals use so little current that the resistors won't cause any problems, but parasitic power back-powering the microcontroller would create enough voltage drop to eliminate almost all of the current flowing through the GPIO pins.

User avatar
nis_
 
Posts: 12
Joined: Mon Feb 13, 2017 9:28 pm

Re: SAMD21 target back-powered through a port pin

Post by nis_ »

adafruit_support_mike wrote:The external diodes can handle more than enough current to run a microcontroller, though you will see flaky behavior because the power is badly unregulated.

You can add a little more protection by connecting the TX/RX pins through 10k resistors instead of wiring them directly. The communication signals use so little current that the resistors won't cause any problems, but parasitic power back-powering the microcontroller would create enough voltage drop to eliminate almost all of the current flowing through the GPIO pins.
Two_Micros_TX_RX_UART--r02-b_schem.png
Two_Micros_TX_RX_UART--r02-b_schem.png (109.9 KiB) Viewed 417 times
Two_Micros_TX_RX_UART--r02-b_bb-CR.png
Two_Micros_TX_RX_UART--r02-b_bb-CR.png (360.57 KiB) Viewed 417 times

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: SAMD21 target back-powered through a port pin

Post by adafruit_support_mike »

That should be plenty of protection.

Locked
Please be positive and constructive with your questions and comments.

Return to “Microcontrollers”