Ok, so I JUST spent a month chasing my tail on a crank, no start, no spark condition in my TJ. When it shit the bed, I had an ignition coil code and the same P0340 for camshaft position sensor as you. I changed both plus crankshaft position sensor and lots of others. Here's the kicker, my gut told me from jump that it was the distributor, but I kept talking myself out of that being the problem. In my testing, I was able to immediately eliminate the dreaded ASD relay circuit because I found that my ignition coil was getting the 12v at key on, then again while cranking. Timing was right, grounds good, 45psi at fuel rail, etc. All my sensors had 5v reference, signal back to pcm, and good ground. What I also found is that even though I had voltage at the coil, my PCM wasn't sending a pulsed ground to the coil, which is what makes the spark happen. The PCM will only send this pulse when it's happy with the camshaft and crankshaft signals. Both those were new, and NTK brand sensors, so I went on to change igntion components, tear into wiring harness, pull my hair out, and attempt to deal with the devil..all to no avail. Finally, I pulled the cap off my distributor, checked that the rotor spins during cranking, pulled new camshaft position sensor/pick up coil, and with it came the pulse ring. The pulse ring is supposed to be attached to the distributor and it shouldn't come out attached to the sensor or anything else. Bingo. There it was. A month of frustration and headache for that. New distributor and running strong.