Code P0335 / P0340, crankshaft and camshaft position sensors: the car stalls or will not start

What the codes mean

To know when to inject and ignite, the control unit must know the position and speed of the engine at every moment. Two sensors take care of this:

  • the crankshaft position sensor (also used to find top dead centre), facing a toothed target on the crankshaft or the flywheel: it gives the engine speed and the position of the pistons. Codes P0335 (circuit), P0336 (implausible signal), P0337 / P0338 (signal low / high), P0339 (intermittent);
  • the camshaft position sensor (or phase sensor), facing a target on the camshaft: it tells whether cylinder no. 1 is on its compression or exhaust stroke. Codes P0340 (circuit), P0341 (implausible signal), P0342 to P0344, and P0345 on bank 2 of a V engine.

The control unit also compares the two signals: if they do not “line up” at the right moment relative to each other, it can store a correlation code (P0016 to P0019), which points to the timing.

Is it serious? Can I drive?

  • P0335: yes, it is serious. Without an engine speed signal, the control unit cuts the injection. A sensor that gives out while driving stalls the engine: the steering can become heavy and the brake assistance runs out after a few presses. If the car still starts, limit yourself to the trip to the garage.
  • P0340: less urgent on many engines, which synchronise on the crankshaft signal alone after a few turns of the starter. Long cranking, jerking, reduced power. On some engines (diesels in particular), starting becomes impossible.
  • With a P0016 to P0019 as well, do not insist: on some engines, out-of-phase timing can make the valves hit the pistons.

The most common causes

  1. Connector or wiring: corroded plug, loose pin, wire chafed against the block or cooked by the exhaust. Very common, and the cheapest check.
  2. Faulty sensor: often sensitive to heat (stalls when hot, restarts when cold). A classic case on cars with more than 150,000 km.
  3. Dirty or badly positioned sensor: metal filings stuck to a magnetic sensor, sensor refitted after a clutch job without respecting the air gap.
  4. Damaged target: damaged teeth on the ring, target loose on the pulley or the camshaft.
  5. Timing: belt or chain that has jumped a tooth, worn tensioner (often with a correlation code).
  6. Voltage too low when starting: weak battery, corroded engine earth. The sensor signal collapses with the voltage.

What to check first

  1. The rev counter test: ask someone to crank the engine and watch the needle. On most cars, it rises to around 150 to 300 rpm. Stuck at zero: the control unit is probably not receiving the crankshaft signal. This test does not apply to all cars (some rev counters stay at zero while cranking); compare with an engine that starts normally if you can.
  2. Read all the codes, including the pending codes: a P0335 alone does not have the same implications as a P0335 together with a P0016 or a voltage code.
  3. Look at the connector of the sensor concerned, with the engine off and cold: plug properly engaged, no green corrosion, wire intact along its whole visible length.
  4. Measure the battery: below about 12.4 V with the engine off, charge it before drawing any conclusion.
  5. For a 2-wire inductive sensor, a garage or an equipped DIYer can measure its resistance with an ohmmeter (often from a few hundred ohms to a little over 1,000 ohms depending on the model, to be compared with the manufacturer's data). A 3-wire Hall effect sensor cannot be tested this way: it requires an oscilloscope or a check of the power supply.

What the app reads at that point

  • Confirmed, pending and permanent codes: a pending P0335 or P0339 after a stall is a strong clue, even if the light is off.
  • Data at the time of the fault: engine speed, load, coolant temperature and road speed at the moment the code was stored, depending on what the car records. A code that appears every time with the engine hot (90 °C and above) points to a sensor that weakens with heat. A very low engine speed (cranking) at the time of the code rather points to a starting problem: battery, earth, sensor.
  • Sensors screen: the engine speed in real time, at idle and then with the engine warm. A value that suddenly drops to 0 just before a stall, while the engine was running smoothly, points to a loss of the crankshaft signal. While cranking, the voltage drops and the adapter can lose the connection: use the dashboard rev counter for the cranking test instead.
  • Explain with AI: the AI receives the code, its meaning, the data at the time of the fault and the vehicle information, and suggests leads in a logical order. You can look up each code in the fault code dictionary.

Should I clear the code?

Clear it after checking the connector or replacing the sensor, with the standard OBD2 command (DiagAuto AI does not reprogram anything). Then drive and read the pending codes again: if the code comes back quickly, it points to the wiring or the target rather than the sensor. Clearing without doing anything does not protect you from a stall. See the code statuses to understand why a code can stay displayed.

Indicative cost (France, 2026)

WorkIndicative range
Cleaning or repairing a connector€40 – €120
Crankshaft sensor, part + fitting (easy access)€80 – €200
Crankshaft sensor, part + fitting (difficult access)€150 – €350
Camshaft sensor, part + fitting€80 – €250
Timing kit, if involved€400 – €1,000 and more

A stall while driving can also come from elsewhere: see loss of power and limp mode if the engine does not stall but limits its power.

Frequently asked questions

Can I drive with a P0340 code?

Often yes, carefully: many engines start and run without the camshaft sensor, with longer cranking and sometimes reduced power. But the engine can also stall or fail to restart: do not go far and have it checked quickly.

My car stalls when hot then restarts once it has cooled down, is it the crankshaft sensor?

That is the typical scenario of a crankshaft sensor that weakens with heat, even before a code appears. Read the pending codes right after the stall: a pending P0335 or P0339 confirms the lead.

Should I replace the sensor as soon as the code appears?

Not before looking at the connector and the wiring: a chafed wire or a corroded plug gives exactly the same code. A new sensor fitted to damaged wiring fixes nothing.