Showing results for 
Search instead for 
Did you mean: 

STM32 Digital Input Pullup Glitching Issue

Associate III


I have an application where I am trying to read some pulsed inputs from an optocoupler (for isolation) which consist of pulled high inputs on the STM32 MCU, the problem is it keeps crashing when connected directly to the optocouplers randomly when they change state? When I connect the digital inputs directly to the ground rail (0V) or float the input pins the software works fine and doesn't crash at all?

Is there something interfering or causing the pulled high inputs to cause this issue? Is it best to use external pull up resistors or a series resistor? Thanks


Uwe Bonnes
Principal II

Show at least a simplified schematics of your optocoup[ler setup. What do you mean by "crash"? How is your power scheme?

Hi Uwe,

I have tried attaching a simple schematic of the optocoupler circuit it is relatively simple, I am thinking perhaps the input pull up resistor might be too weak?




1. the opto will not survive your abuse . At least not long time. (need back diode ! or AC coupler.)

2. you need a cap input-pin ---cap--- gnd, to avoid EMI /spikes coupled to the cpu .

3. a pullup might be a good idea, together with a cap . (Do a simulation, to see what happens.)

If you feel a post has answered your question, please click "Accept as Solution".
Christian N
ST Employee

This post has been escalated to the ST Online Support Team for additional assistance. We'll contact you directly.