The Endstop section of my configuration.h file is listed below. I have swapped the x and y cables and the problem happens to the Y stepper also when I do it. I have also swapped out the X and Y drivers on the Ramps boards and it is still happening only on the X location.
//===========================================================================
//============================== Endstop Settings ===========================
//===========================================================================
// @section homing
// Specify here all the endstop connectors that are connected to any endstop or probe.
// Almost all printers will be using one per axis. Probes will use one or more of the
// extra connectors. Leave undefined any used for non-endstop and non-probe purposes.
#define USE_XMIN_PLUG
#define USE_YMIN_PLUG
#define USE_ZMIN_PLUG
//#define USE_XMAX_PLUG
//#define USE_YMAX_PLUG
//#define USE_ZMAX_PLUG
// coarse Endstop Settings
#define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors
#if DISABLED(ENDSTOPPULLUPS)
// fine endstop settings: Individual pullups. will be ignored if ENDSTOPPULLUPS is defined
//#define ENDSTOPPULLUP_XMAX
//#define ENDSTOPPULLUP_YMAX
//#define ENDSTOPPULLUP_ZMAX
//#define ENDSTOPPULLUP_XMIN
//#define ENDSTOPPULLUP_YMIN
//#define ENDSTOPPULLUP_ZMIN
//#define ENDSTOPPULLUP_ZMIN_PROBE
#endif
// Mechanical endstop with COM to ground and NC to Signal uses “false” here (most common setup).
#define X_MIN_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. MPCNC
#define Y_MIN_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. MPCNC
#define Z_MIN_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. MPCNC
#define X_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. MPCNC
#define Y_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. MPCNC
#define Z_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. MPCNC
#define Z_MIN_PROBE_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop.