Re: P0340 code
Sorry, but my knowledge is pretty limited on the topic of cam sensors. What brand cam sensor did you install? Some aftermarket parts can trigger check engine codes. Does the truck otherwise run well, did it run well before you replaced the sensor?
Also, I assume you deleted the code after replacing the sensor? Codes should go away on their own after fixing the part, but sometimes they can take a while if you don't clear them manually.
In the end you may consider exchanging the cam sensor for another one, or an OEM one. But if others think it could be the computer, that could be a possibility too.
Good luck with it. Let us know what it turns out to be if you get it figured out.