simulate this circuit – Schematic created using CircuitLab
I want to interface a 5v logic signal to an input of a microcontroller (STM32G030) that operates at 3.3V. I made the attached circuit to detect the rising edge of the input 5v signal. However, whenever a nearby AC mains socket switch is flipped, I get an interrupt (I configured the input pin of the microcontroller to generate an interrupt on detection of a falling edge). Can anyone help me improve this circuit and avoid getting such false interrupt detections due to the voltage spikes?