Skip to main content
Associate II
May 22, 2024
Question

STM32 Digital Input Pullup Glitching Issue

Hi,

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

 

This topic has been closed for replies.

4 replies

Uwe Bonnes
Chief
May 22, 2024

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

LinkpadAuthor
Associate II
May 22, 2024

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?

 

 

AScha.3
Super User
May 22, 2024

Hi,

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 on " Best Answer ".
Christian N
ST Employee
May 29, 2024

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