Wednesday, 20 July 2016

microcontroller - Is it safe to connect two MCU pins directly to each other?


I am working on an MSP430 project that requires me to route the output of one peripheral into the input of another peripheral. Thus, I have two MCU pins connected directly to each other. This looks suspicious to me since there is the possibility of a programming error causing both to be (possibly conflicting) outputs. Also, there is the issue of startup and programming states.


In the worst case, if one pin is driving HI, the other is driving LO, the GPIO pins generally have way more sink capability than source capability... so it'll be somewhat like taking a HI output and shorting it to near-ground. Which is bad... but how bad is it? Is it likely to cause damage to the MCU?


I often see examples on the web of people using Arduinos to light an LED between two pins without a resistor, and I haven't heard of any stories of anyone frying anything but the LED. Clearly you wouldn't want to do this in a product, but do manufacturers generally try to protect the MCU from GPIO pins being overloaded anyway?


Thinking about it in retrospect, putting a current-limiting resistor between the two pins would have prevented any worries, but even a minor hardware change is a very difficult thing to do at this point.


For future reference and the benefit of posterity, does anyone have any other ideas about the proper way of minimizing the risks of connecting two MCU pins together, and more generally, minimizing the risks that come from the possibility of overloading a GPIO pin?



Answer



It's not a problem but if you are worried that there maybe a conflict of outputs then connect them with a 1k ohm resistor. This will limit the current accordingly.


If however, the input needs really fast edges then when you are sure it is working, bridge the 1k ohm with a short or 100 ohms maybe.



The added bonus of having the resistor is that if you have the design commited to PCB then it gives you an easy re-wire option.


It's the same problem with unused inputs - tie them to ground or Vcc and you risk heavy current draw from the device without any easy way to work out what is going on - tie via a 1k if unused or maybe 10k.


Overload limiting is done on some chips but only by virtue that the transistors cannot inherently supply "amps" but this can work against you because if you have several o/p pins shorted to ground (or each other) and each one is limiting gracefully, you may still exceed the max rating of current into the power pins of the device.


For the MSP430 series 2 page 21 of this document says: -


enter image description here


This tells me that if the combined output currents of several pins hits a certain limit then the output capabilities of any other pins (even those that may be lightly loaded) may be impaired by the same amount or possibly worse.


No comments:

Post a Comment

arduino - Can I use TI's cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...