Nema 17 on Dm542t driver wont reverse direction using GRBL

I rebuilt an older desktop CNC machine to run on Arduino/Grbl. Everything was working ok until it wasnt. The X axis will no longer switch directions. I did find a loose connection from a stepper driver to the motor. could that have blown only the Xdir pin? if i switch the motor to a different axis, it works as expected.
I have had this happen once before and I replaced the Arduino- which fixed it. I would like to know what is causing it, (the loose wire?) and I can just replace the chip.
I'm not great at writing arduino programs, but if there is a diagnostic I can run to test the pin, that would be great too.

thanks for the help!

Grab an LED and a suitable resistor and run the blink sketch that comes with the IDE. You'll need to adjust it of course to use your xdir pin. That should tell you whether it's the Arduino or the stepper driver.

I found it! it was the -xdir pin. It had a loose connection at the driver.

The best way is to solder everything and/or use good commercial plugs. Writing the diagnostic would help you sharpen your skills and make your next project easier.