BMW fault codes P0335 and P0340: crankshaft and camshaft position sensor

The DME lost or mistrusts the crankshaft sensor signal (P0335 / P0336) or the camshaft sensor signal (P0340 / P0341 intake bank 1, P0345 bank 2); BMW tools show 2A94 / 2A95 for the crank sensor.

Viewing a BMW with P0335 stored? Run a buyer report → Paste a listing, VIN, or reg. The report folds this fault into the engine-specific verdict.

What a buyer should take from P0335

A position sensor is a £60 to £200 fix, and a hot-start or hot-stall symptom on a BMW is very often exactly that. The buyer's job is to check what the sensor is telling you about: oil in the connector means the valve cover or oil-filter-housing gasket is leaking, which is the £150 to £450 job the seller has not mentioned. And P0340 alongside a cam-crank code is a timing-chain conversation.

Symptoms that go with P0335

Causes, most likely first

Systems involved: Engine position sensing, wiring near the oil-filter housing and valve cover. Costs are indicative UK independent-specialist figures for 2026; main dealers add 30 to 60 per cent.

CauseHow likelyTypical UK cost
Sensor failed, often heat-related (crank sensor sits low near the exhaust on many BMWs)
Genuine or Bosch / VDO; avoid unbranded
Most common£60 to £200 fitted
Oil in the sensor connector from a leaking valve cover or oil-filter-housing gasket wicking down the loom
Fix the leak or the new sensor fails too
Common on N52 / N54 / N55£150 to £450 for the gasket plus a clean-up
Wiring chafed or connector corrodedOccasional£50 to £200
Timing chain stretch or VANOS fault giving an implausible cam signal (P0340 with P0016)
See the cam-crank correlation page
Occasional£60 to £2,500
Reluctor ring or cam sensor wheel damagedRare£300 to £1,000

Check the car that logged P0335

Enter its reg for the DVLA and MOT history plus the engine-specific fault check. £7 per report, no subscription. About 30 seconds.

No reg to hand? Enter the year and model instead →

How to diagnose it, cheapest first

  1. Read live rpm from the crank sensor while cranking; zero rpm with a cranking engine is a dead crank sensor
  2. Unplug the sensor connector and look for oil; if present, find the leak above it
  3. Check the loom where it passes the exhaust or the oil-filter housing
  4. If P0340 comes with P0016 / P0017, treat it as a timing conversation, not a sensor

Buy, negotiate, or walk away

Fine to buy

Sensor replaced with a branded part and a receipt, no oil in the connector, starts hot and cold on your visit.

Negotiate

Code stored, oil visible around the sensor, no gasket history: price in £300 to £600 for the leak plus the sensor.

Walk away

P0340 with P0016 / P0017 and a cold-start rattle on a chain-prone engine.

Seen P0335 on a listing or a scan?

Paste the listing, reg or VIN. Bimmer.AI identifies the exact engine, applies its known failures and costs, and tells you whether this code is a £60 part or a £2,000 conversation on that car.

Run a Bimmer.AI buyer report →

Fault-code guidance on this page is general and engine-family based. The same code can have different causes on different engines and years; a proper diagnosis with live data by a BMW specialist is the only way to be sure. Costs are indicative UK ranges that vary by region and parts supply.

Frequently asked questions

Why does my BMW stall when hot with code P0335?

Crankshaft sensors fail hot before they fail cold: the internal element opens up as it heats and the DME loses the rpm signal, the engine stalls, and it restarts after ten minutes in the shade. It is one of the most common causes of intermittent hot stalling on BMWs from the M54 era to the N55. £60 to £200 fixes it.

Where is the crankshaft sensor on a BMW?

Low on the block, near the flywheel or the crank pulley depending on the engine, usually close to the exhaust or the starter motor. On the N52 / N54 / N55 it sits at the back of the block on the driver's side (UK) and is reached from below. Cam sensors are on the front of the cylinder head under the VANOS solenoids.

Can oil in the connector cause P0340?

Yes. Oil from a leaking valve cover gasket runs down the loom and into the cam sensor connector, where it attacks the insulation and creates a poor connection. Replacing the sensor without fixing the leak means doing it again in a year. Fix the gasket, clean the loom, then fit the sensor.

Related guides

Check a car with P0335 →