P0340: Camshaft Position (CMP) Sensor: Circuit Malfunction
ModerateQuick answer
P0340 means the engine computer is not receiving a usable signal from the camshaft position sensor, which it needs to know which cylinder is on its compression stroke for fuel and spark timing. Typical causes are a sensor that fails when hot, oil wicking into its connector, or a broken wire; a stretched timing chain or belt can cause it too. Expect long cranks and stalling.
What it means
The camshaft position sensor watches a tooth or notch on the camshaft (or its sprocket or phaser) and tells the computer where the cam is in its rotation. Combined with the crankshaft sensor, that is how the computer knows which cylinder is coming up on compression, so it can fire the right injector and coil in sequence and manage variable valve timing. P0340 sets when that signal is missing, erratic or outside the pattern the computer expects while the engine is cranking or running.
Most P0340 cases are the sensor or what it plugs into. Hall-effect sensors fail with heat and come back when they cool, which is why the classic story is a stall in traffic that restarts twenty minutes later. On several engines oil migrates up the sensor’s wiring into the connector and corrodes the terminals. Harness chafe near the valve cover and a connector knocked loose during a spark plug job cover most of the rest.
The part of P0340 that costs people money is the mechanical cause they skipped. A timing chain that has stretched, a jumped belt, or a damaged cam phaser moves the cam signal out of its expected relationship to the crank signal, and some computers report that as P0340 rather than a correlation code. If P0340 comes with P0016 or P0017, or the engine also runs rough and down on power, check timing before buying sensors.
P0340 symptoms: what you'll notice
- Extended cranking before the engine starts, because the computer waits for a cam signal before it commits to sequential injection; some engines will not start at all.
- Stalling, often when hot and often in traffic, with a restart that works only after the engine has cooled.
- A rough idle, misfires or a noticeable loss of power once running, as the computer falls back to a default injection strategy.
- Worse fuel economy and, on engines with variable valve timing, related VVT codes and a sluggish feel.
- Sometimes no symptom at all beyond the light, when the fault is an intermittent connector that dropped the signal for a moment.
Common causes
Ordered from most to least likely.
- 1.
Camshaft position sensor failing, often only when hot
The most common answer. A heat-soaked Hall-effect sensor drops its signal, the engine stalls, and it tests fine on the bench an hour later. Replace with the OEM supplier’s part.
- 2.
Oil in the sensor connector
Engine oil wicks along the sensor wires into the plug and corrodes the pins. Check for oil the moment you unplug it; on some makes this is the majority of P0340 complaints.
- 3.
Chafed, broken or pinched harness
The sensor harness runs along the valve cover or timing cover where heat, vibration and past repairs take their toll. A wire broken inside intact insulation reads open.
- 4.
Connector knocked loose or terminals spread
Often after a spark plug, valve cover gasket or intake job. Reseat and lock it before any further testing.
- 5.
Stretched timing chain, jumped belt or damaged cam phaser
Moves the cam signal out of its expected relationship to the crank. Suspect it when P0340 comes with P0016 or P0017, a rattle at start-up, or high mileage on a chain-driven engine.
- 6.
Damaged reluctor ring or debris on the sensor tip
A cracked tone ring, a bent tooth or metal fuzz stuck to the sensor magnet makes a signal the computer cannot decode.
- 7.
Lost power or ground to the sensor, or a computer input fault
Three-wire sensors need a clean supply and ground. Rare on its own; check it after the connector and the sensor.
How to fix it: diagnosis, step by step
Cheapest and most likely checks first.
-
1 Read every code and the freeze frame
P0340 alone points at the sensor circuit. P0340 with P0016 or P0017 points at timing. P0340 with P0335 (crank sensor) points at a shared power, ground or a computer problem. Note whether the code set while cranking, at idle or hot: heat-related sets are the sensor.
-
2 Unplug the sensor and look for oil
Oil in the connector, on the pins or dripping from the wire jacket is a finding. Clean both halves with contact cleaner, dry them, and inspect the terminals for green corrosion or a spread female pin. If the sensor’s own wire jacket is oil-soaked, the sensor is leaking internally and should be replaced.
-
3 Check power and ground with the key on
Back-probe the harness plug: a three-wire sensor should show 5 or 12 volts (by design) on the supply wire and a ground reading of near 0 ohms on the ground wire. A missing supply or a bad ground is a harness fault, and no new sensor will fix it.
-
4 Scope or graph the signal while cranking
With a scope or a scan tool that graphs the cam signal, crank the engine. A healthy Hall sensor produces a clean square wave; a variable-reluctance sensor produces an AC sine wave that grows with speed. No signal with good power and ground condemns the sensor. A ragged or dropping signal with heat condemns it too.
-
5 Wiggle-test the harness with the engine running
Flex the harness along its route from the sensor to the main connector while watching the signal or the RPM PID. A stall or a dropout that you can provoke has just located a broken wire or a loose terminal.
-
6 Verify cam-to-crank timing before buying sensors
If the codes or the symptoms hint at timing, check it: cam and crank correlation on the scan tool, timing marks with the covers off, or the chain slack and tensioner extension for chain-driven engines. A stretched chain sets cam codes forever, no matter how many sensors you fit.
-
7 Replace with an OEM-supplier sensor and confirm
Fit the sensor from the factory supplier (Hitachi, Denso, Bosch, Delphi and so on), a new seal if it has one, and torque the bolt gently. Clear the codes, run the engine to full operating temperature, and let it idle hot for a while: the heat-related failure this sensor is famous for should not return.
Known P0340 patterns by make
Brand-specific failure patterns from the field: find your make before parts-shopping.
Nissan / Infiniti 2002–2008 Altima, Maxima, Murano, Quest, Pathfinder, Frontier, G35, FX35, I35 with the VQ35DE V6 (and the 2.5L QR25DE) YOUR VEHICLE
The Hitachi cam and crank sensors on this generation fail hot and produce the textbook P0340 stall-and-restart-later complaint, often with P0345 or P0335 in the mix. Nissan issued a recall and technical bulletins covering these sensors on several model years, so check the VIN with a dealer first. Replace with the genuine or Hitachi part; the bank 1 and bank 2 cam sensors are the same part on the VQ, which makes a swap test easy.
Hyundai / Kia 2011–2016 Elantra, Sonata, Optima, Forte, Soul, Tucson, Sportage with the 1.8L/2.0L Nu and 2.0L/2.4L Theta II engines YOUR VEHICLE
P0340 and P0341 on these are frequently oil-related: the sensor’s wiring wicks oil into the connector, and a leaking sensor seal or valve cover gasket makes it worse. Unplug, look for oil, clean, and replace the sensor (and the seal) with the genuine part. If the intake cam sensor code arrives with a P0011 or P0014 and a rattle, look at the CVVT oil control valve and oil level before the sensor.
Ford / Mercury / Lincoln 1996–2004 4.6L and 5.4L 2-valve V8, 4.2L V6 and 3.0L Vulcan V6 (F-150, Expedition, Crown Victoria, Explorer, Taurus, Ranger) YOUR VEHICLE
On these the cam sensor rides on a camshaft synchronizer, a small driven shaft in the block that also spins the sensor. The synchronizer’s bushing wears, it starts to chirp or squeal at idle, and it sets P0340 or P0341 as the sensor wobbles. The repair is the synchronizer assembly with a new sensor, installed with the alignment tool so the sensor is timed correctly; replacing only the sensor on a worn synchronizer brings the code straight back.
Parts & tools you may need
- OBDLink MX+ (Bluetooth OBD-II scanner) ↗
- Autel MaxiCOM MK808S (full-system scan tool) ↗
- OTC 5606 (compression tester kit) ↗
- Teslong (dual-lens inspection borescope) ↗
- Fluke 88V (automotive multimeter) ↗
- OBD-II scanner (code reader with freeze frame / live data) ↗
- Digital multimeter ↗
- Electrical contact cleaner ↗
- Replacement cam sensor (exact part for your engine) ↗
Disclosure: some links are affiliate links (including the Amazon Associates program). If you buy through them, we may earn a commission at no extra cost to you.
Related codes
- P0341Camshaft Position (CMP) Sensor: Circuit Range/Performance
- P0342Camshaft Position (CMP) Sensor: Circuit Low Input
- P0343Camshaft Position (CMP) Sensor: Circuit High Input
- P0345Camshaft Position (CMP) Sensor A Bank 2: Circuit Malfunction
- P0016Crankshaft/Camshaft Position Correlation (Bank 1, Sensor A)
Frequently asked questions
- What does code P0340 mean?
- P0340 means the camshaft position sensor circuit for bank 1 (or the single sensor on engines with one) is sending no signal or a signal the computer cannot use. The sensor tells the computer which cylinder is on compression, so the code brings long cranks, stalls and rough running. It is moderately serious: driveable when it runs, but a stall in traffic is a safety problem.
- Can I drive with P0340?
- Carefully and briefly. The engine can run on the crankshaft signal alone in a default mode, but it may stall without warning and may not restart until it cools. Treat a P0340 that stalls the engine as an urgent repair, not a light to live with.
- Why does my car start after it cools down?
- Because a heat-failed Hall-effect sensor recovers as it cools. The signal drops when the engine bay gets hot, the engine stalls or refuses to start, and twenty minutes later everything works. That pattern is the sensor itself; replace it with the OEM supplier’s part.
- Is it the cam sensor or the crank sensor?
- Read the codes: P0340 family codes are cam, P0335 family codes are crank. Both together suggest a shared power or ground problem or a timing issue rather than two sensors dying at once. On engines where the two sensors are identical parts, swapping them is a quick way to confirm which one is bad.
- Could P0340 be a timing chain problem?
- Yes. A stretched chain, a jumped belt or a worn phaser moves the cam signal away from where the computer expects it relative to the crank. Suspect timing when P0340 comes with P0016 or P0017, a rattle at start-up, or a high-mileage chain-driven engine that also feels down on power.
- How much does it cost to fix P0340?
- A camshaft position sensor is $20 to $120 and most take 15 minutes to an hour, so $80 to $250 at a shop. A connector pigtail is $15 to $40. A harness repair is $100 to $250. If the cause is timing, a chain or belt job runs $800 to $2,500 depending on the engine, and a cam phaser adds $200 to $600. Most P0340 repairs are the sensor or its plug.
- What is the difference between P0340, P0341, P0345 and P0016?
- P0340 is a circuit fault on the bank 1 (or single) cam sensor: no signal or a bad one. P0341 is range/performance: the signal exists but is out of pattern. P0345 is the same as P0340 but for bank 2 on V engines. P0016 is cam-to-crank correlation: both sensors work, but the cam is not where it should be relative to the crank, which is a timing problem.