Hi.. Erection in a male are dependent on multiple factors.. Equally important among those factors are the emotional and psychological factors.. May be the loss of interest in you either due to pain or not, may be pulling him down.. Get to your doctor to know what is causing the pain.. Good lubrications may help for the time being.. See a doctor for examination..