Ok lets start with stepper motors, you aim with the waveforms to create a rotating magnetic field. This is given in the stepping shown in the DataSheet for your motor:
Step A+ B+ A- B-
1 + + - -
2 - + + -
3 - - + +
4 + - - +
First thing it shows A- = - A+ and B- = -B+ always and no gap between so both + and - coils are bother energised at the same time, with current in opposite directions in + and -.
A and B are at 90 degrees to each other, and which goes first depends on the direction the motor is being run in, clockwise or counter clockwise.
It does say how fast you run these waveforms, and the speed you run them, is the speed the motor runs at. So to run faster you need to run these.
First problem is switching from the + state to the - state, this is Voltage one way, vs the reverse voltage. Now reversing the voltage means switching the which terminal is connected to the positive rail, and the terminal connected to 0V. Now consider that you have to switch both ends - and thats where the problem occurs what if you donāt switch perfectly - then you end up with Vdd connected to 0V; at that stage you get a short - and the circuit rapidly dies.
So your drive chip will be set up to ensure that that never happens. Often in space we had to do this with discreet power transistors, its the only thing that can handle the power flowing through it - the chips donāt want to be driving anything too strongly. When doing this switching it is often better to set up the switching with gaps, e.g. consider:
Step A+ B+ A- B-
1 + 0 0 0
2 + + 0 0
3 0 + 0 0
4 0 + + 0
5 0 0 + 0
6 0 0 + +
7 0 0 0 +
8 + 0 0 +
This has 8 steps to go round once, but notice only one state is switching at a time, and always switches to no voltage, and also Iāve always kept things +ve. Now you would need to check with the motor manufacturer that you get a full magnetic field doing that, you may not - in which case always have to drive the + and - circuits with opposite voltages, but dropping to zero voltage on both in between.
Then how to generate these signals, as stated above, you want reasonably timed signals; and want to be able to control the frequency, to get the motor speed. This is usually done using PWM circuits, and PWM is so common that many chips, including at least the AM6254 found in pocket beagle 2, and I would say is probably true in all these texas instruments chips. So first I say read up on PWM, the pocketbeagle2 has it in the main part of the CPU, so is probably accessed from the linux machine on the armv8. So just needs to be programmed. Read the TRM, so I say section 12.5.3 of spruiv7c.pdf.
What you need to do is program 2 or 4 PWM circuits, all tied together - so all tied off the same clock, but attaching the on and off periods to give one set of the waveforms above. Then use the pins those are outputted to (you may need to pinmux for this, and so load the right device tree) and feed these into your motor control chip. Do check you donāt need power circuits outside of that (e.g. the chip is design for the voltages and current that you need for the motor).
Then in linux, slowly increase the frequency - and the motor will slowly spin up. As it spins faster it will create more back EMF, and so the voltages across the motor will slowly go more and more into driving the back EMF; eventually there will be none left to drive the motor - and you wonāt be able to go any faster - unless you increase the voltage available on the power rail.
The other nasty that can happen, the stator canāt keep up with the rotating magnetic field - then it tends to jump backwards round the above cycle. That also usually gets fairly nasty and the motor stalls, and you pray that nothing burns.
So thats about the limit of my knowledge of motors ā¦