P0504 -- Brake switch – A/B correlation Wiring, mechanical fault
Found this, maybe it can be of help in finding your problem? The item below
(**) in bold red text is most likely key to the problem.
HINT: I would also check all voltages, fuses, signals, grounds, etc... at their respective locations with a voltmeter, while operating the brake pedal to ensure they are providing the ECM with the correct signal for their respective positions. Quote:
The P0504 code means there's a correlation fault between the two signals from the vehicle's brake switch, indicating a problem with the switch, its wiring, or the brake pedal adjustment. This can cause symptoms like a check engine light, non-functional cruise control, and incorrect brake light operation.
**The underlying issue is that the vehicle's computer (PCM) receives contradictory signals that the brake pedal is both pressed and released at the same time.
Causes of a P0504 code
Faulty brake light switch: The switch itself may be damaged or malfunctioning, leading to incorrect signal output.
Brake pedal adjustment: If the brake pedal is out of adjustment, it can prevent the switch from functioning correctly.
Wiring issues: A short circuit, open circuit, or damaged wiring harness connected to the brake switch can cause an improper signal.
Blown fuse: A blown brake light fuse can interrupt the circuit and cause this code.
Mechanical obstruction: Debris or dirt can physically prevent the brake switch from operating properly.
You can watch this video to learn how to diagnose and fix P0504 code:
Quote:
How to diagnose and fixInspect the brake light switch:
Check the switch for any visible damage or signs of wear.
Inspect the wiring harness and connectors for any breaks, corrosion, or loose connections.
Verify the brake pedal is properly adjusted, as this can cause switch issues.
Check the electrical system:
Inspect the brake light fuse and replace it if it is blown.
Use a multimeter to test the brake switch's signal wires to ensure they are sending correct voltage signals.
Repair or replace:
Adjust the brake pedal or replace the brake light switch and/or any damaged wiring harness.
Replace the blown fuse
_________________
Supporting Vendor and Moderator of LOST05 Jeep Liberty CRD Limited 
Ironman Springs/Bilstein/Shocks
Yeti StgIV Hot Tune
Week's BatteryTray
No FCV/EGR
Samcos/ProVent
SunCoast/Transgo
Carter Intank-pmp
2mic.Sec.Fuel Filter
Flowmaster/NO CAT
V6Airbox/noVH
GM11 Bld.fan/HDClutch
IronrockArms/wwdieselMount98 Dodge Cummins 24 Valve