I am having tough time while driving PNP transistor with optocoupler to generate 1KHZ PWM signal. my circuit consists of micro controller which will generate 1KHZ pwm signal which will go to base of PNP transistor(Q2) and the collector terminal of PNP transistor(Q2) will go to optocoupler input. and the optocoupler collector terminal is going to base of PNP transistor(Q1). the collector terminal of PNP transistor(Q1) is going to microcontroller pin. when i probe at micro pin or Q1 transistor collector the turn off time i am seeing 400ms. because of this i am getting error in PWM signal measurement which is 1KHZ.
output of R4 is connected to micro controller in the below circuit but not grounded like below