Why is my IRL540 slow to turn off?

The IRL540 has a parasitic capacitor between drain and source so, when you "turn off" the MOSFET, that capacitor (\$C_{OSS}\$) takes time to charge via the 1 kohm drain pull-up resistor. To add a little misery/complication, \$C_{OSS}\$ changes with \$V_{DS}\$ as per this graph: -

enter image description here

So, when you initially turn-off the gate voltage (\$V_{GS}\$), \$V_{DS}\$ starts at 0 volts and \$C_{OSS}\$ is about 2200 pF - this has an RC time-constant of 2.2 μs (1 kohm pull-up) and so the output rises relatively slowly initially. As \$V_{DS}\$ rises to (say) 3 volts, \$C_{OSS}\$ drops to around 1400 pF and things start to speed up but, it's a law of diminishing returns when charging a capacitor from a resistor and, despite \$C_{OSS}\$ falling to about 800 pF when \$V_{DS}\$ is 10 volts, there is still an overall time period of several micro seconds involved.

If you used a 100 ohm load you would see \$C_{OSS}\$ charge much more quickly.

Even though \$C_{ISS}\$ (gate capacitance) is circa twice the value of \$C_{OSS}\$, I suspect that your gate driving impedance is no more than 50 ohms therefore, \$C_{ISS}\$ isn't a significant issue. Its effect will be about ten times less than a 1 kohm drain resistor and \$C_{OSS}\$.


Your micro output has to supply the gate charge, so maybe it behaves like a 100 ohm resistor, and 30-40mA flows, so 64nC (max) will take 1.8usec.

If you want it to switch snappily at 100kHz you will need a gate driver capable of much more peak current. There are many gate driver chips available, or you could use a couple BJTs for less performance but lower cost.