Back to Vehicles
BMW2017-2023Code Combo

P0345 Code: BMW 5-Series (2017-2023) - Causes, Symptoms & Fixes

Complete guide to P0345 diagnostic trouble code on 2017-2023 BMW 5-Series - causes, symptoms, repair costs

Get Personalized Help

Ask about specific issues with your BMW 5 Series.

Ask MechanicGPT

P0345 Diagnostic Guide for 2017-2023 BMW 5-Series (Camshaft Position Sensor B Circuit Malfunction)

Important data note: No NHTSA owner complaints found for this make/model/year/issue combination. No recalls found in NHTSA database. This guide uses general automotive knowledge supplemented by the provided data limitations. It does not cite recalls or TSBs beyond what’s in the data you supplied. Data limitations: there are no listed recalls or complaints in the supplied NHTSA data, so this guide emphasizes typical failure modes and standard diagnostic workflows for P0345 on BMW 5-Series, with repair cost estimates current to 2025 prices.

  1. CODE MEANING AND SEVERITY
  • Code definition: P0345 = Camshaft Position Sensor B Circuit Malfunction. On many BMW engines in the 2017–2023 5-Series, there are two camshaft position sensors (often referred to as sensor A and sensor B, corresponding to the two camshafts or banks). P0345 indicates a fault in the B-side sensor circuit (the sensor, the wiring, or the PCM input for that sensor).
  • Why it matters: The engine-control module (ECU/PCM) uses the camshaft position signal to synchronize ignition and fuel injection with valve timing. A faulty or unreadable B-sensor signal can cause the ECU to lose cam-crank synchronization, leading to misfires, hard starts, poor drivability, or the engine not starting at all.
  • Severity range:
    • Mild to moderate: Intermittent signal or wiring issue that won’t consistently let the engine run well; MIL (Check Engine Light) may come on intermittently.
    • Moderate to high: Persistent P0345 can cause misfires, reduced power, rough idle, or stalling; insurance of proper timing is compromised if left unresolved.
    • Critical: Inability to start or a stall with no restart can occur if the ECU can’t read any cam position signal.
  • Owner impact: You may notice rough running, reduced performance, poor fuel economy, or the engine failing to start. The car may run okay for a short time and then lose power or stall.
  1. COMMON CAUSES ON BMW 5-SERIES
  • Faulty Camshaft Position Sensor B (sensor failure or leakage, internal short, or degraded components).
  • Damaged, corroded, or loose wiring/ connector for Camshaft Position Sensor B (pins, corrosion, moisture intrusion, broken wires, or poor pin tension).
  • Oil contamination or oil leakage into the sensor housing or connector (BMW engines are sensitive to oil leaks around cam/ VANOS areas).
  • Timing-related issues:
    • VANOS solenoid fault or oil supply problems leading to incorrect cam timing perception.
    • Wear or stretching of timing chain/tensioners/ guides causing actual cam timing drift (less common but serious in engines with extended service intervals or high mileage).
  • PCM/ECU input faults (less common, but possible if the ECU’s cam sensor input is damaged or there’s an upstream electrical fault).
  • Incorrect part installation or aftermarket sensor (part quality or misfit).
  1. SYMPTOMS
  • Check Engine Light (MIL) illuminated.
  • Engine runs rough, misfires, or experiences reduced power and acceleration.
  • Hard starting or extended cranking before the engine starts.
  • Erratic idle or stalling, especially at low rpm or during idle after cold start.
  • Reduced fuel economy or unusual driving behavior (especially under load or at highway speeds).
  • In some cases, the engine may start but run poorly or stall, then restart after multiple attempts.
  1. DIAGNOSTIC STEPS
    Note: This is a practical workflow you can perform with basic shop tools and a scanner. Some steps assume access to live data (scope or advanced OBD tool) and, ideally, BMW-specific scan tools (ISTA, ISTA-P, or equivalents) for VANOS/live sensor data.

A. Confirm the code and context

  • Retrieve P0345 with a reputable OBD scanner and note freeze-frame data (engine speed, RPM, temperature, load, etc.).
  • Check for any related codes (P0340, P0341, P0342, P0335, P0300, P0010/P0011/P0014/P0011 family). Multiple CAM/CRANK-related codes suggest timing or sensor/wiring issues.
  • Note engine temperature and whether the issue is intermittent or persistent.

B. Visual inspection

  • Inspect the Camshaft Position Sensor B connector and wiring harness for signs of damage, oil contamination, moisture, bent/pin damage, or loose connectors.
  • Check for oil leaks around the cam/VANOS area and along the sensor harness path.
  • Inspect the sensor body for cracks, oil ingress, or obvious contamination.
  • If accessible, ensure the sensor is properly seated and the connector lock is engaged.

C. Basic electrical checks (as applicable)

  • Verify sensor power and ground at the connector with the ignition on (engine off). Typical supplies are a 5V reference and a ground, but BMW designs vary by engine. Use a multimeter to confirm there is a stable reference voltage and ground.
  • Check for continuity between the sensor and the PCM pin using a harness/diagnostic schematic. Look for damaged wires or high resistance.
  • Inspect the 5V reference line for noise or fluctuation during cranking or running (scope can help).

D. Signal integrity test

  • With an appropriate scanner or oscilloscope, view the Camshaft Position Sensor B signal. You should see a clean, regular waveform corresponding to cam events. If the waveform is missing, erratic, very weak, or flatlined, suspect sensor, wiring, or a timing-related issue.
  • Compare live data for Cam Sensor B with Crankshaft Position Sensor A (P0335) to verify proper synchrony. Large or persistent phase/offset discrepancies point toward timing or sensor faults.

E. Rule out mechanical timing as a factor (if symptoms persist or multiple timing-related codes appear)

  • If you suspect timing drift (pulses not aligning with crank position and there are VANOS-related symptoms or oil pressure concerns), further inspection is needed. This often requires specialty tools and may necessitate removing components to inspect the timing chain/tensioners, guides, and VANOS solenoids.
  • Consider oil quality and oil change history. Inadequate oil quality or degraded oil can lead to VANOS solenoid sticking or wear that affects cam timing perception.

F. Focused sensor or wiring replacement approach

  • If the sensor shows damage, contamination, or a degraded signal after tests, plan for sensor replacement.
  • If wiring/connector shows damage or corrosion, perform harness repair or connector replacement as needed.
  • After any repair, clear codes and perform an endurance test (several drive cycles) to ensure the fault does not reappear.

G. When to escalate to professional diagnosis

  • If timing chain/tensioner/ VANOS issues are suspected, or if you lack the tools to test cam/crank phase synchrony or to inspect VANOS, seek professional service. BMW timing components are critical to engine integrity, and improper timing can cause severe engine damage.
  1. RELATED CODES
  • P0340 Camshaft Position Sensor A Circuit Malfunction (same engine family, other bank or sensor)
  • P0341 Camshaft Position Sensor A Circuit Range/Performance
  • P0342 Camshaft Position Sensor B Circuit Range/Performance
  • P0335 Crankshaft Position Sensor A Malfunction
  • P0336 Crankshaft Position Sensor A Range/Performance (or Bank/Channel variants)
  • P0300 Random/Multiple Cylinder Misfire Detected (can accompany cam timing issues)
  • P0010/P0011/P0014 (Camshaft Timing over-Advanced or over-Retarded; used when cam timing is strongly implicated)
  1. REPAIR OPTIONS AND COSTS (2025 PRICES)
    Notes:
  • Prices vary by region, shop, vehicle option (B58 vs. B46/B48 family engines), labor rates, and whether timing components are involved.
  • The figures below are approximate ranges to help with budgeting. They reflect typical aftermarket vs OEM parts and common labor times for a BMW 5-Series.

A. Camshaft Position Sensor B replacement (sensor only)

  • Parts: roughly $40–$250 (OEM BMW vs aftermarket; BMW-branded sensors tend to be toward the higher end)
  • Labor: about 0.5–1.5 hours
  • Estimated total: $150–$450
  • DIY feasibility: Moderate. If the sensor is accessible from the top or side, a capable DIYer can do it; some engine layouts on certain 5-Series variants may require more disassembly.

B. Wiring harness/connector repair or replacement

  • Parts: $10–$100 (connectors or small harness pieces)
  • Labor: 0.5–2.0 hours depending on accessibility
  • Estimated total: $100–$400
  • DIY feasibility: Moderate. Cleaning and reseating connectors can help; more extensive wiring repairs should be done by a pro to ensure proper resistance and grounding.

C. VANOS solenoid clean/replacement (if related to the fault)

  • Parts: $80–$350 per solenoid
  • Labor: 1–2 hours per solenoid
  • Estimated total: $250–$800 (for one or two solenoids)
  • Note: If the solenoid is sticking due to oil sludge or pressure issues, service may require oil changes and sensor testing.

D. Timing chain/tensioner/guide service (major repair)

  • Parts: $200–$700 (timing kit, tensioners, guides; could include gaskets)
  • Labor: 3–8 hours (often more if timing system is accessed from difficult locations)
  • Estimated total: $1,000–$2,000+ (could be higher if more components are involved)
  • When this is required: If diagnostic steps indicate actual timing deviation rather than a sensor/wiring fault, this is typically the necessary repair.

E. PCM/ECU-related fault (rare)

  • Parts: $0–$800 (reprogramming or replacement)
  • Labor: 1–3 hours
  • Estimated total: $100–$1,000
  • Note: Most P0345 cases are sensor or wiring related; ECU fault is uncommon and typically a last-resort diagnosis after other causes are ruled out.

F. Total cost considerations

  • If you catch it early and replace the sensor or fix wiring, costs are usually modest.
  • If timing components are involved, expect a substantial increase in both parts and labor.
  • Always obtain a firm diagnostic quote before authorizing major work, especially for timing-related repairs.
  1. DIY VS PROFESSIONAL
  • DIY-friendly scenarios:
    • Replacing Camshaft Position Sensor B when easily accessible and wiring is straightforward.
    • Cleaning or reseating a damaged-but-unbroken connector.
    • Basic sensor signal verification with a multimeter/oscilloscope if you have the tools.
  • Professional scenarios:
    • Suspected timing chain/tensioner/guide problems or VANOS solenoid issues that require specialized tools and timing alignment procedures.
    • When the live data in BMW-specific diagnostic software is needed to verify cam/crank synchronization and VANOS oil pressure.
    • If the vehicle is still under warranty or if you need precise timing correlation data from ISTA or other BMW diagnostic suites.
  1. PREVENTION
  • Regular oil changes with the manufacturer-recommended synthetic oil and viscosity. Clean, consistent oil pressure helps VANOS solenoids and timing components operate reliably.
  • Use high-quality, correct-grade oil and filters; avoid long intervals beyond BMW’s recommended service schedule.
  • Address oil leaks promptly; oil contamination around cam/ VANOS areas can degrade sensors and solenoids.
  • When performing maintenance around the camshaft area, ensure connectors are seated properly, pins are straight, and weather seals are intact.
  • If you replace a cam sensor, use the proper part number for your engine variant and install torque specs; verify sensor alignment and seating.
  • Routine diagnostic scans to catch intermittent P0345 early and confirm whether it’s sensor/wiring or timing-related.
  • If you have a history of VANOS complaints or oil pressure concerns, consider checking oil quality and changing oil more frequently, as well as inspecting VANOS solenoids and oil passages.

Data limitations and closing notes

  • Based on the provided NHTSA data: No owner complaints and no recalls found for the 2017–2023 BMW 5-Series with this issue. If new data becomes available (recalls, TSBs, or complaints), the guide should be updated to reflect those findings.
  • This guide relies on general automotive knowledge for cam/crank sensing and BMW VANOS timing behavior. Engine variants (B58, B48, N55, etc.) can have different sensor placements and electrical schemas. When in doubt, refer to the specific engine service information for your car (ISTA, OEM manuals, or BMW TechData) for exact sensor locations, wiring colors, voltages, and timing specifications.

Frequently Asked Questions

The 2017-2023 BMW 5 Series has several known issues that vary by model year. See our detailed guide for specific problems, causes, and repair costs.

Vehicle Info

MakeBMW
Model5 Series
Years2017-2023

DISCLAIMER: This information is for educational purposes only. MechanicGPT is not a licensed mechanic. Always consult a certified mechanic for diagnosis and repair. Improper repairs can be dangerous.