Nodemcu: generate 38khz frequency with interrupts


Can someone please help me with an easy to use code example on how to generate 38khz on a Nodemcu?
I'd like it to be asynchronous, because there is a server running and delays would ruin that.

I tried tone(D2, 38000) but, even if the IR LED lights up (visible on a phone camera), it doesn't trigger the IR sensor. This works on a Nano or a Micro, just not on a NodeMcu.

Can anyone help? I've been stuck on this for days ;(

Thank you,