02 sentra cam/crank sensor codes

car runs good and starts good but after 10 min drive will suddenly shut off but wont start back up for hours and does this everytime! check engine light is on codes are p0335 & p0304, got crankshaft replaced and still same problem and same codes, any suggestions on what it can be making both codes go off and what is making car shut off

I don’t see anything for p3040, I presume you mean p0304. If so you are correct, those are crank and camshaft position sensor codes. They are saying the computer doesn’t detect the engine is turning during cranking. But the engine is cranking ok, it starts and runs. If you just had one of those codes, you’d think it would be the sensor or the thing it sensed. But that seems unlikely with both codes. I’m guessing you have some kind of electrical problem, like a bad battery, bad alternator, or something that is preventing full battery voltage from getting to the ECM. If not that, some kind of connector or wiring. problem from the ECM to those two sensors. Start by measuring the battery voltage at the posts with the engine off (after sitting overnight), and again with the engine started and idling. Let us know what you measure.

These sensors often reported as failed here (not just on Nissan, but all makes) due to heat. But it seems unlikely for both the crank and cam to fail due to heat. Has it been really really hot where you live? You don’t live in Pheonix or Las Vegas, right? Any indications of the car overheating?

yes p0304 is the code, I was kind of in the same boat thinking it was somthing beyond either part its self since both codes are being thrown. I will check into battery voltage tomorrow & pray that will fix the problem. I am in Ny so i dont heat would be a problem.

Yeah, in NY, it doesn’t sound like would be due to extreme ambient temperatures. Could still be heat related, but hard to believe both sensors would fail due to heat at the same time. Absent other ideas, focussing on the electrical system is the best path forward at this point.