Microcontroller Digital Input/Output Pin Protection Best Practices - Page 1
Forum section: electronics / beginners

author: josechow
author_rank: Contributor
timestamp: June 23, 2016, 03:33:55 am
content: So, my question involves a microcontroller whose firmware is established to have specific digital output and input pins that are not reconfigured because they are all on a PCB without any complex arrangements; ie fixed multiple PWM, uart, input pull up button detection circuits, etc.With that in mind, is it a waste to include input protection resistors? Like small 300 ohm resistors to limit inrush/out current? Microcontroller's should start with all pins in a high impedance state, so they will not accidentally start trying to drive ground or pull the power rail through it, right? I have not seen any appropriate guidance before, so I am not sure if its an appropriate circuit protection measure or if its just a waste of populating space on the board and adding extra components to the BOM.For obvious reason, when doing a prototype, I include current limiting resistors, but in the final design I am hesitant to get rid of them even though I know that if an intermittent failure were to occur, the voltage on the other side of a connected device would kill the pin anyway.Bonus: Should I opto-couple the TX and RX pins out of a LIN transciever? All reference circuits show that all LIN transceivers are connected without any such protection.

author: ovnr
author_rank: Frequent Contributor
timestamp: June 23, 2016, 11:38:52 am
content: If you're just routing signals on a PCB, you should not need any resistors (... unless for EMI/termination reasons, but that's another issue entirely). I would suggest adding them to anything where there's a good chance the user will touch the actual contacts, like on a bare switch.Micro pins start as high impedance unless they have some special hardware features, but in that case it'd be clearly noticeable. Think dedicated USB pins (though I imagine those are also high impedance).If you are routing signals off the board, some extra help doesn't hurt, especially if it can be touched by the end user.LIN transciever: It's still connected to the ground and voltage rails of the rest of the circuit, right? Then no, you should not isolate the signals.

author: MosherIV
author_rank: Super Contributor
timestamp: June 23, 2016, 12:17:04 pm
content: HiYou may not need 'input protection resistors' if the IO lines do not go off board.HOWEVER......You may want to use pull up/down resistors on the IO pins of the micro for default behaviour on power up.Think about what happens if the micro does not boot and the IO pins are left floating as inputs.What are the devices connected to the micro going to do with no output drive from the micro?eg I worked for a company making printers. One of the printers rebooted and the microcontroller did not boot.The micro controlled a motor which pushed toner out. This motor ran for a weekend and covered the corner wherethe machine sat with toner. Glad I did not have to clean the mess up. The postmortem did not find the reason for themicro not booting but did conclude that all output IO pins must be pulled high/low just in case the micro does not boot.