I want to dim an LED and have connected a P-channel MOSFET to switch the high side. I added a N-channel MOSFET as a driver. The schematic is attached below. I'm applying a PWM sine signal from an STM32.
Problem: If I measure the voltage on the drain of the N-channel SI2302 to ground, I see that the voltage is increasing from 0 to around 1.5 V and after that it's saturated at 5 V for the rest of the cycle until the duty cycle drops again. So instead of a nice oscillating sine curve from 0 to 5 V, I get a partial sine curve which is somehow clipped... The voltage between drain of the P-channel MOSFET and ground is always at 5 V except for a short drop to 0 V.
How do I prevent the circuit from saturating?