Most modern automobile engines use one or more camshaft position sensors to determine the fuel injectors’ firing sequence. If the camshaft position sensor fails or malfunctions, the engine computer (engine control module or ECM) will, using the crankshaft position sensor signal, bank-fire the injectors instead, leading to diminished performance and fuel economy.
On the Hyundai Beta II inline four-cylinder engine, found in the third- and fourth-generation Elantra, 4-cylinder Hyundai Tiburons and Hyundai Tucsons, and most Kia Spectras and Kia Sportages, the camshaft position sensor is a Hall effect switch bolted into the cylinder head. For most of the engine cycle, the sensor output is 5 V, but when a ferromagnet on the intake cam is rotated to be near the sensor once per cycle, the switch opens, dropping the voltage to 0. If viewed on an oscilloscope, the camshaft position sensor signal would look like a 5V square wave with an approximate 90% duty cycle.
When the ECM of a Beta II-engined vehicle receives no signal from the camshaft position sensor, or the signal is out of synchronization with the crankshaft position sensor signal or otherwise faulty (Hyundai’s shop manual does not give specific conditions), DTC (Diagnostic Trouble Code) P0340 will set, and the “Check Engine” light (MIL) will turn on the next time the engine was started.
Two specific failure modes have their own codes. According to the shop manual for the 2001 Hyundai Elantra, P0342 will set if during two driving cycles (start-stop cycles in which the engine is allowed to warm up) more than one camshaft position sensor signal is reported per two revolutions of the crankshaft. P0343 will set if, in two driving cycles, the crankshaft makes 200 or more revolutions without there being a camshaft position sensor signal.
P0343 and P0342 nearly always mean that the sensor itself is faulty, although P0342 could be a sign of a broken wire and both could also indicate a failing ECM. P0340 is infamously vague and gives home mechanics fits. At the time of writing Google finds over 300,000 references to it on the Web–ten times as many as P0342 or P0343–many of which are requests for diagnostic assistance on bulletin boards. There is a tendency to “throw parts at” the problem, but more often than not P0340, a catch-all code for problems with the camshaft position sensor circuit, is caused by an underlying mechanical or electrical problem.
Hyundai’s shop manual includes a decision tree to diagnose and repair camshaft position sensor-related codes P0340, P0342, and P0343, but it was almost certainly written by an engineer before release and not a mechanic with hands-on experience with the Beta II engine. Its logic is almost correct, but a few “sanity checks” are missing and the steps are given out of order. It also fails to take into account some of the details of the vehicle’s construction, especially the inability to backprobe circuits, thanks to Hyundai’s choice of closed connectors. Moreover it recommends that the mechanic or technician to “measure voltage” while the engine is running and verify that it ranges between 0 and 5 volts. Without an oscilloscope, this is impossible.
Haynes manuals usually are better suited to the home mechanic than manufacturers’ shop manuals, but the advice given for diagnosing P0340 on the Beta II-engined Elantra is near-worthless: verify that voltage ranges between 0 and 5 volts. The Chilton books similarly give little to no diagnostic advice. Following the procedure given below, a competent do-it-yourselfer should be able to diagnose and remedy camshaft position sensor related trouble codes on Beta II-engined vehicles.
Tools needed: 10 mm socket wrench, multimeter, 16-gauge stranded wire, 10 ft of 18-gauge solid wire.
1. If you suspect that the alternator is failing, check and remedy that problem first; faulty rectifier diodes can interfere with any wave signals and are known to cause D0340 to set on many vehicles. If you have recently changed or adjusted the timing belt, verify that crankshaft-to-camshaft timing is correct; if the timing belt slips by a tooth, P0340 is likely to set and is sometimes the only DTC that will set.
2. Open the hood, remove the cosmetic (dress-up) cover from the top of the engine, locate the camshaft position sensor in the right-hand (passenger side) rear of the cylinder head (see illustration), and visually inspect it and its wiring harness. If there are any obvious problems, remedy these, clear trouble codes using a scan tool, start the engine, and verify that the codes do not reset.
3. Remove the sensor from the cylinder head and visually inspect it. If it appears melted, cracked, or otherwise damaged, replace it with a new component and check whether or not the problem has been resolved. If it appears normal, replace it in the cylinder head and proceed to the next step.
4. Check the power and ground terminals of the wiring harness using a multimeter. Holding the connector with the notch up, the power terminal will be on the right and the ground terminal will be on the left. The center terminal is the output. Turn the ignition to “on” but do not start the engine and check the power terminal, which should be at battery voltage relative to ground. Using the multimeter’s ohmmeter, check that the ground terminal is grounded. If either of these tests fail, repair the wiring harness and check whether or not the problem has been resolved.
5. Check the output for a short circuit to ground. Disconnect the negative battery terminal. Disconnect the ECM, which is usually located under the dashboard on the driver’s side. It’s easy to spot, as it is the component connected to the largest bundle of wires. If you do not disconnect the ECM, this test will give a false positive, and some (high-power, low-impedance) ohmmeters may even damage the ECM.
The ECM connector is held in place by a slide. Pull the slide toward the harness and the connector should come loose easily. Do not pull or yank the wires. Remove the kick panel, if necessary, to facilitate access. Check for continuity between the center terminal of the camshaft position sensor connector and ground; the correct result is an open circuit. The left-hand terminal will no longer be grounded; use the engine block or a ground point in the engine compartment as reference. If the middle terminal is grounded, repair the harness and check whether or not the problem has been resolved.
6. Verify that the sensor is operating as expected. Re-connect the ECM, followed by the negative battery terminal. Raise the right-hand (passenger side) front corner of the vehicle and remove the wheel, to gain access to the crank pulley bolt. Remove the upper timing cover.
Cut the 16-gauge stranded wire to a 4″ (10 cm) length. Strip 1¼” (3.2 cm) of insulation from one end and enough to facilitate connection to your multimeter’s probes from the other. Insert the tip of the long section “on top of” the center terminal of the connector so that it is wedged between the metal and plastic. It should not be in the space that will be occupied by the prong of the (male) terminal on the sensor, but rather on the opposite side of the metal leaf that forms the female terminal. Snap the connector back on to the camshaft position sensor, taking care to not short the terminals with the wire you inserted. Attach the positive probe of your multimeter to the other end of this wire.
Turn the ignition “on” but do not start the engine. Rotate the engine slowly by turning the crankshaft pulley bolt clockwise with a socket wrench. If this is too difficult, removing that spark plugs will make it easier. As the engine rotates, monitor the voltage of the center terminal with respect to ground. For most of the cycle, it should be 5 V or slightly less. When the timing hole of the camshaft sprocket is approximately 60 degrees before its corresponding mark on the bearing cap, the voltage should drop to near 0. If you cannot find this point, remove the valve cover and verify that when the magnet on the intake cam is at its closest approach to the camshaft position sensor, voltage is 0.
If this test fails, proceed to step 7. If it passes, go on to step 8.
7. Test the sensor with another magnet. Remove the sensor from the cylinder head, leaving it connected to the harness and the voltmeter. Bring both poles of a household magnet near it; one pole should cause the voltage to suddenly drop. If neither pole causes a voltage drop, the sensor is faulty and should be replaced with a new part. If the sensor works properly outside of the cylinder head, replace it in the head verifying that it is tight and sealed with only a single O-ring, and repeat the test in step 6; if it passes, check whether or not the problem has been resolved. If it fails again, remove the valve cover and verify that the magnet on the intake cam is intact and remains magnetized. If the magnet is broken or demagnetized (both unlikely), replace the intake cam with a new part.
8. Check crankshaft-to-camshaft timing. Align the hole in the cam sprocket with the mark on the bearing cap. If the mark on the crank pulley–a deep scoring–is more than a few degrees away from the TDC on the lower timing cover, correct the timing. 18 degrees rotation of the crank pulley corresponds to a being off by a single tooth on the cam pulley.
Absurd as it seems, it is possible to be off by “half a tooth” or a fraction of a tooth (significantly less than 18 degrees). A few thousand references to this can be found on the Web at the time of writing, pertaining to vehicles including Hondas and BMWs; it is not an uncommon problem nor is it unique to Hyundai. If off by half a tooth, first verify that the timing belt is properly tensioned, then, if the problem remains, move the belt over a single tooth on the cam sprocket so that the error is now in the other direction. For example, if the crankshaft was ahead of the camshaft by 9 degrees, move one tooth over so the crankshaft is retarded by 9 degrees. When my Elantra set P0340, this turned out to be the remedy. If leaving timing off by a few degrees makes you uneasy (as it should), adjustable cam sprockets are available from aftermarket suppliers. After adjusting timing, clear codes and check whether or not the problem has been resolved.
9. Check camshaft-to-camshaft timing. Since the intake cam is driven by the exhaust cam and the magnet is on the intake cam, relative misalignment of the intake cam will cause P0340 to set even if crankshaft-to-camshaft timing looks alright. Remove the valve cover and verify that the center of the timing marks on the chain co-align with the center of the timing marks on the sprockets, with four links in between. Some early shop manuals had an erroneous illustration, that was known to cause P0340 to set, in which the ends, and not the centers, of the marks were aligned with the marks on the sprockets. If camshaft-to-camshaft timing is off, it will almost certainly be the cause of the trouble code; adjust it and check whether the problem has been resolved.
10. Check continuity of the signal wire. This can be done either of two ways. Disconnect the battery and the ECM and ground the center terminal of the connector, then check continuity between ground and pin 72 of the ECM connector, or run the long solid wire from the center connector to the passenger compartment and check continuity between the long wire and pin 72. Holding the ECM connector with the 5 large pins on the left and the regular array of small pins on the right, pin 72 is the tenth from right in the top row. If the signal wire is not continuous, repair the harness and check whether the problem has been resolved.
11. Replace the ECM with a unit known to work correctly. If this does not resolve the problem, “throw in the towel” and take the car to a dealership or a reputable shop.