it can be emotional, if you have a lot of stress currently or new partners sometimes create issues. Sometimes it might be other things in a relationship seeping into bed with you. I've read that quite often it is a performance anxiety issue, nervousness about previous failure rears up at the crucial moments. ED drugs like Viagra, Cialis etc can possibly help with this but not always or not everytime. Try to be as present in the m oment as you can be, keeping your expectations to a minimum and if something does malfunciton go back to petting and kissing or work on you partners orgasm. Often this will be enough to get you wound back up and at the very least it will show your partner that you can love them in ways that don't always have to hinge on the penis's feisty quirks.