My intention is to have a display for debugging/configuring the project which is most of the time disconnected (flying project). I'm using a Nokia 3310 SPI display from Adafruit with software SPI, and the whole thing works splendidly.
Then I came across this SPI article stating damage from induced transients killing chips. Is there a danger killing an arduino by removing and replugging the display?
The display is atleast connected through a level shifter. Is there any way to protect the display (capacitors, maybe?) I can of course write any gathered data to EEPROM, then disconnect the power, plug in the display and then view those, but as the project is a flight controller for a RC plane, hotplugging the display would be so much more handy.
Hot plugging connectors - such as USB - are designed so that the first pin to be connected and the last to be disconnected, is the ground, then the (positive) supply pin, while the data pins are the last to connect and the first to disconnect.
Actually, given that there is no other connection to the device being connected, it is sufficient that both ground and supply pins are reliably connected before any data pins. That is how the USB plug is designed; the data pins are shorter than the supply pins. You can modify your own connectors accordingly.
That is all that is required for electrical protection from damage.
The other consideration, is "data damage". The software must be designed such that partial connection or disconnection - at any time - will not adversely affect the operation of your code.
If the device is display-only, then a garbled display is not a great problem. Your code must either refresh the display from time to time without caring that the display is connected at all, or perform a check to see that the display responds correctly and only then send the information. The code must not fail (crash) if the display does not respond; it must simply wait some period (a couple of seconds) and try the full initialisation again without affecting the operation of any other part of the overall system.
As long as (all) these requirements are met, hot-plugging is safe.
Yes, shortening the data pins is a good idea, I have seen this done in the internal SATA plugs that also support hotswapping. I understand why the ground pin must connect first, but the supply also? If the devices are at the same potential but without power to the other one, won't any data connections simply do nothing?
The code already takes care of reinitializing the display whenever it detects it being plugged in, and as was said it's output only anyway so there should be no danger in that.
Jopj:
I understand why the ground pin must connect first, but the supply also? If the devices are at the same potential but without power to the other one, won't any data connections simply do nothing?
Because if the host is attempting to communicate with the pluggable device - in order to initiate communication - it does so by putting voltages on the data lines.
In general, putting voltages on data lines to chips with no voltage on the supply line ("parasitic powering") is not a good idea. (Frequent topic here.)
Paul__B:
Because if the host is attempting to communicate with the pluggable device - in order to initiate communication - it does so by putting voltages on the data lines.
In general, putting voltages on data lines to chips with no voltage on the supply line ("parasitic powering") is not a good idea. (Frequent topic here.)
Thanks, makes sense. Let the power pin stay long then as well
Hmm.. I guess this means my MAX4619 analog switche's tendency to run off it's inputs even when the power source cuts out isn't nice. I was wondering what that was about, and since it's the safety switch for my plane, I guess I should somehow make sure it doesn't do that.