For anyone attempting a DIY repair, first read DKDKRD's posts about not just the spur gear, but other issues like gear noise and limit switch adjustment. Point being, I'm convinced you will run into a mechanical issue before an electrical one.
That said, if you do want to mess with the electrical side, here's how the limit switches work (see schematic).
This will allow you to confirm the motor electronics works in both directions. That is, no point in going thru the trouble of replacing the spur gear if the motor or electronics is burned out!
As described earlier, the limit switches (when closed) cut off power to the motor. The switches are metal leafs (like a diving board) that press against a tip of a metal adjustment screw to close. By turning the adjustment screw, this adjusts the distance to the leaf and hence closes sooner or later in the rotation of the gate arm.
If you remove the panel as shown, the gate mechanism does not contact either leaf so both limit switches open. This means the motor is free to run in both directions. Of course you have to think about this for a second. If there is nothing to stop the motor then the gate will rise or lower and surely stall at some point possibly breaking something. But again I'm referring to case of a loose spur gear so that the motor is not engaging with the gear mechanism.
Apply red/black power to gate. You should see the crossing lights flash.
Touch Yellow to Red (or Blue). You should hear the motor spinning. This is trying to send the gate down. Take a toothpick and press the leaf switch until it touches the adjustment screw tip for the gate-bottom switch. This should shut off the motor.
Touch White to Red (or Blue). You should hear the motor spinning. This is trying to send the gate up. You should be able to detect a slight difference in the sound as the motor spins the other direction but maybe not. Take a toothpick and simulate the gate-upper switch closure. This should shut off the motor AND stop the flashing lights.