P0340 Hyundai Elantra: Diagnose the Circuit Before Replacing Parts
13 min read · by Nicole Bennett · Last updated: November 25, 2026
The code p0340 hyundai elantra identifies a fault in the camshaft position sensor A circuit, not proof that the sensor itself has failed. The engine computer has detected a missing, implausible, or otherwise incorrect camshaft-position signal. A failed sensor is one possibility, but damaged wiring, a poor connector, a power or ground problem, or a timing-related signal issue can produce the same code.
The right diagnosis depends on the Elantra’s model year and engine. Hyundai service information for different generations describes different sensor layouts and test procedures. Start by saving the code and freeze-frame data, then check the circuit and compare camshaft and crankshaft signals before buying parts. This approach helps avoid replacing a good sensor while the actual fault remains in the harness or engine timing system.
What P0340 Means on a Hyundai Elantra
P0340 is the generic SAE code for “Camshaft Position Sensor A Circuit (Bank 1 or Single Sensor).” It means the powertrain control module has detected a problem with the electrical signal or operation of the designated camshaft sensor circuit. The code points to a monitored circuit; it does not identify a failed part by itself.

P identifies the powertrain; 0 marks a generic SAE code rather than a manufacturer-specific P1xxx code. Bank 1 is the side containing cylinder 1. An inline-four Elantra has one cylinder bank, although an engine may use separate intake and exhaust cam sensors.
| Code element | Value | Meaning |
|---|---|---|
| First character | P | Powertrain fault category |
| Second character | 0 | Generic SAE diagnostic code |
| Full code | P0340 | Camshaft position sensor A circuit fault |
The CMP sensor reports camshaft position. The computer compares it with the crankshaft position sensor (CKP) signal to establish engine position and coordinate sequential fuel injection and ignition timing. P0340 may set when crankshaft activity is detected but the expected camshaft signal is absent or incorrect.
Specifications vary. The 2010 Elantra 2.0L procedure describes a Hall-effect CMP signal that switches between about 0 and 5 volts. The 2010–2015 Elantra MD procedure identifies separate Bank 1 intake and exhaust sensors and calls for comparing CMP and CKP waveforms with Hyundai GDS equipment. Do not apply those details to another engine without checking its service information. If a second code shows up during the scan, P0300 Hyundai Elantra could be the next stop.
Symptoms and Driveability Changes
P0340 can cause anything from a check-engine light to a no-start. Symptoms depend on whether the signal fails constantly or drops out during cranking, heat soak, or engine vibration.
Possible symptoms include:
- Long cranking before the engine starts, especially after the car has been parked or heat-soaked.
- An engine that cranks normally but will not start because the computer cannot establish the position signal it needs.
- Rough idle, uneven engine speed, hesitation, or a stumble when accelerating from a stop.
- Intermittent stalling at idle or while slowing for a turn or stoplight.
- Reduced power, sluggish throttle response, or an engine that feels less consistent than usual.
- A check-engine light with no obvious change in how the car runs.
A failed CMP signal can disrupt engine synchronization, but symptoms do not prove the sensor is bad. A loose connector may open with engine movement; heat-damaged wiring or a heat-sensitive sensor may fail only after warm-up. Incorrect mechanical timing can also disturb the cam-to-crank relationship.
During cranking, check whether the scanner displays engine RPM. A nonzero reading shows the computer is recognizing a crankshaft speed signal, though it does not prove the CKP circuit is perfect. A zero reading means the CKP signal also needs investigation.
P0340 alone does not always mean the Elantra must be towed. If the check-engine light is steady, the engine starts and idles normally, and there is no loss of power or stalling, a short, gentle trip to a repair facility may be reasonable. Avoid heavy acceleration and long trips. If the engine stalls, will not restart, runs severely rough, or the check-engine light flashes, pull over safely and arrange a tow; a flashing light signals an active misfire that can damage the catalytic converter.
Record whether the fault occurs cold, after a hot restart, at idle, or during acceleration. These conditions help reproduce an intermittent fault and distinguish it from a constant no-start.
Common Causes Behind P0340
Separate a failed sensor from a wiring fault and a mechanical signal problem. Hyundai procedures call for connector, power, ground, signal, and waveform checks because several faults can interrupt the CMP signal.

A faulty camshaft position sensor
The sensor can fail internally, create a weak waveform, or stop switching. A Hall-effect design reads a target on the camshaft; heat, age, contamination, or physical damage can disrupt its output. Even when P0340 returns immediately, check the sensor supply and wiring before replacing it.
Damaged wiring, connector, power, or ground
An open or shorted signal wire, weak terminal tension, corrosion, or a loose connector lock can interrupt the circuit. Check for bent or backed-out pins, oil, heat damage, and rubbed insulation. Use the exact wiring diagram: pin numbers and supply arrangements vary, and a cold continuity test can miss a heat- or vibration-related open.
Camshaft target or crankshaft signal problems
A damaged target, incorrect air gap, debris, or timing fault can distort the CMP signal even when power is present. Since the computer compares CMP and CKP signals, a faulty crank sensor or its wiring can complicate diagnosis. Rule out a weak CKP waveform before blaming the cam sensor alone.
Related variable valve timing faults
Variable valve timing (VVT) uses oil pressure, an oil control valve (OCV), and a cam actuator to change cam timing. Hyundai’s 2010 Elantra 2.0L procedure says to address a stored OCV-related P0011 before continuing with P0340 diagnosis. That is a model-specific sequence, not proof that P0011 always causes P0340.
An ECM fault is possible but should be considered only after the sensor, connector, wiring, supply, ground, and mechanical signal pass testing. Record related codes such as P0335, P0011, or P0016 and diagnose the pattern instead of replacing parts one code at a time. If you want to see how the same fault shows up on another make, read our guide to P0340 Chevy Malibu.
How to Diagnose P0340 With an OBD2 Scanner
A basic OBD2 scanner identifies P0340 and displays useful data, but usually cannot prove the CMP sensor is defective. Use it to document the event and check related codes before electrical testing.
- Connect before clearing anything. Use the 16-pin J1962 connector, usually below the driver-side dashboard near the steering column. Follow the scanner’s ignition instructions and establish communication.
- Read every powertrain code. Record stored, pending, and permanent codes. Look for P0340 with P0335, P0011, or P0016. A pending code has been detected but is not yet confirmed; do not assume it is the only fault.
- Save freeze-frame data. Record RPM, coolant temperature, vehicle speed, calculated load, and any available voltage or camshaft parameter. A fault at 2,500 RPM under load differs from one recorded at 0 RPM during cranking.
- Check live RPM during cranking. Keep clear of moving components. A nonzero reading means the computer sees crankshaft speed; a zero reading requires CKP circuit investigation before CMP replacement.
- Check CMP or sync data if supported. Enhanced scanners may show cam position or cam/crank synchronization. Compare it with the correct service specifications; missing data on a generic reader does not prove sensor failure.
- Review Mode 06 cautiously. It may show on-board monitor results when supported, but not every Elantra or scanner exposes a CMP-specific test. Use it as supporting evidence, not as a replacement for circuit and waveform checks.
- Preserve the evidence. Do not clear codes or reset readiness before saving freeze-frame data. Erasing information removes diagnostic clues and can leave emissions monitors incomplete.
Fuel trims are not a CMP test. Combined short- and long-term trim beyond roughly plus or minus 10 percent can indicate a mixture issue, but it does not explain P0340 by itself. Use those readings to identify a separate lean or rich condition. A related problem on the same vehicle is explained in P0715 Hyundai Elantra.
The U.S. Environmental Protection Agency’s overview of OBD scan-tool functions explains the difference between current data, freeze-frame information, stored trouble codes, clearing functions, and on-board monitor test results. Review the EPA overview of standardized OBD scan-tool modes for context on what generic diagnostic data can and cannot show.
Confirming the Sensor and Circuit Fault
Use the correct wiring diagram and service procedure to confirm whether the sensor has proper supply and ground, whether its signal reaches the ECM, and whether the waveform aligns with the crankshaft signal.
Inspect the harness before testing the sensor
With the ignition off, inspect the connector and accessible harness for a broken lock, loose fit, bent pin, corrosion, oil, rubbed insulation, or chafing at a bracket. Do not tug on wires or force probes into sealed terminals.
A digital multimeter can test supply, ground, and signal when used under the manufacturer’s specified conditions. Use a high-impedance meter and correct back-probing method. Never borrow a pin number, wire color, or voltage from another Elantra engine.
Compare camshaft and crankshaft waveforms
A two-channel oscilloscope displays CMP and CKP waveforms together. It can reveal missing pulses, electrical noise, an irregular switching pattern, or incorrect timing between signals that a multimeter cannot show.
The 2010 Elantra 2.0L procedure expects a smooth square wave and places the CMPS edge at the third through fifth CKP tooth after the longer missing-tooth reference. This is not a universal spec. The Hyundai Elantra MD camshaft-position-sensor service procedure also calls for comparing the two waveforms with Hyundai diagnostic equipment.
Check mechanical timing when the electrical tests pass
If electrical tests pass but waveform alignment is wrong, investigate mechanical timing. A stretched or incorrectly installed timing chain, damaged target, or cam actuator fault can affect correlation. P0016 may support a timing investigation, but follow the engine-specific test.
Timing inspection may require cover removal and alignment checks. Incorrect timing can cause serious engine problems, so use the exact repair procedure or have a qualified technician do the work.
Repair Options, Cost Factors, and Verification
Repair the confirmed cause. Replace the sensor only when testing identifies it as faulty; a new sensor will not fix a damaged connector, harness, target, or timing system.
- Sensor fault confirmed: Replace the correct CMP sensor for the engine and sensor position, then follow the specified installation procedure and torque value.
- Connector fault found: Repair damaged terminals, restore the lock or connector body as required, and make sure the terminal tension and seal are correct.
- Harness fault found: Repair an open, short, or damaged section using an automotive wiring repair method that preserves insulation, routing, and strain relief.
- Target or timing fault found: Repair the mechanical issue using the engine-specific timing procedure. A sensor cannot correct a damaged target or incorrect camshaft timing.
- Related OCV or VVT code found: Diagnose the oil control and cam timing system in the order specified for that engine before returning to the P0340 test.
Cost depends on diagnosis time, sensor access, parts quality, labor hours, shop rates, and engine layout. An accessible sensor may be a short job; an intermittent harness fault takes time to locate, while timing repairs can require more labor and components. DIY work may reduce labor expense but requires the correct tools and procedure. Ask the shop to separate diagnostic time, parts, and labor rather than approving a sensor based only on P0340.
Tip: Do not remove a CMP sensor while the engine is running or immediately after shutdown. Hyundai’s 2010–2015 Elantra MD service procedure warns that hot engine oil can cause a scald. For that application, the procedure calls for the ignition to be off and the battery negative cable disconnected before sensor removal. Follow the exact safety instructions for the vehicle being serviced, and let hot components cool before working near them.
After repair, clear codes only after saving the original data. Restart the engine, check whether P0340 returns, and complete the manufacturer’s verification drive cycle. The 2010 Elantra 2.0L procedure uses more than 10 minutes of idle and oil temperature from 20°C to 110°C for its monitor check; this is not a universal drive cycle.
Recheck stored, pending, and permanent codes after the monitor runs. A permanent DTC clears only after the fault is fixed and the system monitor passes. Check readiness before an emissions inspection; a car may run normally while monitors remain incomplete after a reset. Shops often compare notes across makes for this code, and P0340 Ford Explorer is a good reference.
Frequently Asked Questions
Does the A in P0340 always mean the intake camshaft sensor?
No. “A” is the standardized sensor designation in the generic code description. Hyundai’s sensor naming and code mapping depend on the year and engine, so confirm the correct sensor in the exact vehicle’s DTC chart rather than assuming that A always identifies the same physical location.
Can P0340 be stored before the check-engine light turns on?
Yes. A pending code can record a fault seen during an initial monitoring event before the computer confirms it and commands the malfunction indicator lamp on. Check pending and confirmed codes rather than relying only on whether the dashboard light is illuminated.
Can a weak battery cause a misleading sensor fault?
Low system voltage or a poor battery connection can create electrical problems that complicate diagnosis, although a low reading does not prove the cause of P0340. A healthy fully charged battery is about 12.6 volts at rest, while a typical charging-system reading with the engine running is about 13.5 to 14.7 volts. Check battery and charging condition if cranking is slow or several unrelated electrical codes appear.
Will a Hyundai Elantra with P0340 pass an emissions inspection?
It may fail an OBD-based inspection if the malfunction indicator is commanded on or the test detects an emissions-related fault. Inspection rules differ by state and county. Some programs also check readiness monitors, so clearing the code just before the test can leave the vehicle unready rather than make it compliant.
How is P0341 different from P0340?
P0340 identifies a camshaft position sensor A circuit fault. P0341 identifies a camshaft position sensor A circuit range or performance problem, meaning the signal is present but does not meet the expected operating pattern. The two codes call for related but not identical diagnostic checks.
P0340 on a Hyundai Elantra is a circuit diagnosis, not an automatic sensor replacement order. Save scanner data, verify the sensor supply, ground, wiring, and cam-to-crank signal relationship, then repair the fault confirmed by testing. If the engine stalls, will not start reliably, or has a flashing check-engine light, stop driving and arrange prompt diagnosis.
-
Nicole Bennett, Technical Content Editor at BestOBD2Picks Nicole turns OBD-II standards, service bulletins, and repair data into step-by-step diagnostic guides anyone can follow. Technical Content Editor
Related guides
LearnP0301 Hyundai Elantra: Diagnose Cylinder 1 Without Guessing
LearnP0606 Hyundai Elantra: Diagnose the Computer Fault Before Replacing Parts
LearnP0700 Hyundai Elantra: Find the Transmission Fault Before Replacing Parts
LearnP0135 Hyundai Elantra: Diagnose the Oxygen Sensor Heater Fault
LearnP0302 Hyundai Elantra: Find the Cause Before Replacing Parts
LearnP0155 Nissan: Diagnose the Heater Circuit Before Replacing Parts