Check wiring, connector/pin fitment at sensor, and pin fitment at ECM for cam sensor circuit. See diagram
Check quality of ground at sensor and 5v power supply at sensor.
Other than the cam sensor, ground, power supply, wiring, and connectors, there is not much else to consider other than the ECM itself if you are still getting the P0340 DTC.
Does the P0340 DTC set immediately after clearing the codes and restarting the engine?
The stumble on startup you described could be a fuel issue? Have you tried pumping up the fuel primer pump before starting to see if it makes any difference?
Do you have intank fuel pump installed?

_________________
Supporting Vendor and Moderator of LOST05 Jeep Liberty CRD Limited 
Ironman Springs/Bilstein/Shocks
Yeti StgIV Hot Tune
Week's BatteryTray
No FCV/EGR
Samcos/ProVent
SunCoast/Transgo
Carter Intank-pmp
2mic.Sec.Fuel Filter
Flowmaster/NO CAT
V6Airbox/noVH
GM11 Bld.fan/HDClutch
IronrockArms/wwdieselMount98 Dodge Cummins 24 Valve