I designed this circuit to work as a buck converter, using atmega32a as a controller to get PWM with 500k HZ and 47% duty cycle, my problem is that I am not sure how to connect between the control side and the buck circuit, I am using optocoupler 6n137 it can handle the frequency but the output is only 5 volts(which can't drive the MOSFET).
the opto controls a n-mosfet irf3205 with the 5 volts (it won't be fully opened and will have high resistance) then it controllers p MOSFET IRF5305 with the right Vgs, so the Ron of the p mosfet stays low, does it seems like a good design?
ps1: the control and power sides are using different supplies and independent grounds
ps2: I saw this answer, and I will consider it if this design doesn't work. Level shift circuit MCU to MOSFET
ps3: i am realizing the irony of using an oppto that need 5 volt supply to get a 5 volt o/p from the converter but i am very beginner and all my focus is on the converter itself.