The primary nerve fibers to the penis are from the dorsal nerve of the penis, a branch of the pudendal nerve. The cavernosal nerves are a part of the autonomic nervous system and incorporate both sympathetic and parasympathetic fibers. They travel posterolaterally along the prostate and enter the corpora cavernosa and corpus spongiosum to regulate blood flow during erection and detumescence. The dorsal somatic nerves are also branches of the pudendal nerves. They are primarily responsible for penile sensation. 
Causes of impotence are many and include heart disease, high cholesterol, high blood pressure, obesity, metabolic syndrome, Parkinson's disease, Peyronie's disease, substance abuse, sleep disorders, BPH treatments, relationship problems, blood vessel diseases (such as peripheral vascular disease and others), systemic disease, hormonal imbalance, and medications (such as blood pressure and heart medications).
Ejaculatory incompetence, erectile difficulty, erectile dysfunction, erectile failure, frigidity–female Medtalk The inability to achieve or maintain a penile erection adequate for the successful completion of intercourse, terminating in ejaculation; penile erection is mediated by nitric oxide Epidemiology Prevalence of minimal, moderate, and complete impotence in the Massachusetts Male Aging Study was 52%; age is the most important factor; complete impotence ↑ from 5%–age 40 to 15%–age 70; for an erection to achieve a successful outcome, it requires
The most common treatment for erectile dysfunction is drugs known as phosphodiesterase-5 (PDE-5) inhibitors. These include tadalafil (Cialis), vardenafil (Levitra), and sildenafil citrate (Viagra). These are effective for about 75% of men with erectile dysfunction. They are tablets that are taken around an hour before sex, and last between 4 and 36 hours. Sexual stimulation is required before an erection will occur. The PDE-5 inhibitors cause dilation of blood vessels in the penis to allow erection to occur, and help it to stay rigid. Men using nitrate medication (e.g. GTN spray or sublingual tablets for angina) should not use PDE-5 inhibitors.
You can also consider using a cock ring or penis ring if you are able to get an erection but have trouble maintaining it. Cock rings work by trapping the blood inside your penis so it remains harder for longer. You can purchase one in a sex store or online for about $5 and you put in on over your penis and testicles when you are half hard and keep it on until you are finished with sex. It’s a great cheap fix for erectile issues.
Begot, I., Peixoto, T. C. A., Gonzaga, L. R. A., Bolzan, D. W., Papa, V., Carvalho, A. C. C., ... & Guizilini, S. (2015, March 1). A Home-Based Walking Program Improves Erectile Dysfunction in Men With an Acute Myocardial Infarction. The American Journal of Cardiology, 115(5), 5741-575. Retrieved from http://www.ajconline.org/article/S0002-9149(14)02270-X/abstract
The lab testing obtained for the evaluation of erectile dysfunction may vary with the information obtained on the health history, physical examination, and recent lab testing. A testosterone level is not necessary in all men; however, a physician will order labs to determine a patient's testosterone level if other signs and symptoms of hypogonadism (low testosterone) such as decreased libido, loss of body hair, muscle loss, breast enlargement, osteoporosis, infertility, and decreased penile/testicular size are present.
A vacuum erection device is a plastic tube that slips over the penis, making a seal with the skin of the body. A pump at the other end of the tube makes a low-pressure vacuum around the erectile tissue, which results in an erection. An elastic ring is then slipped onto the base of the penis. This holds the blood in the penis (and keeps it hard) for up to 30 minutes. With proper training, 75 out of 100 men can get a working erection using a vacuum erection device.