I am working to interface with an existing PCB with on-board Full Bridge PWM motor driver chips, which drive a stepper motor. The interface lacks any kind of standard step (clock) or direction signals and I can only use the input signals that are there. There are two chips to drive each stepper motor, they are Allegro A3959. I want to keep everything as is, so I can only work with what is broken out, but I can add an interface chip using the available inputs.

I would like to add a new controller to drive the chips, which can only provide the standard 'step (clock) and direction' outputs. How can I accomplish this? I have thought about using a L297 Stepper Motor Controller chip as an intermediary, but with only limited inputs (and no access to sense resistors) I don't believe I can use it. Even if I had access to the sense resistors, I don't know how I would interface it.

For simplicity's sake. I have created a very generalized diagram of what I do have available to me (the pin outs are generalized):

Power Distribution Board

As you can see, I only have the following pins available:

  • Phase A (direction)
  • VREF A (current regulation)
  • Phase B (direction)
  • VREF B (current regulation)
  • Sleep (this controls many chips on the board and can't be considered for pulsing)

It is my understanding that I can easily control the direction through the Phase A/B pins. Digital signal 0 for one direction, digital signal 1 for the opposite direction. How do I control the VREF with a clock input signal though?

The datasheet for the A3959 states the following:

"Current Regulation. Load current is regulated by an internal fixed off-time PWM control circuit. When the outputs of the DMOS H bridge are turned on, the current increases in the motor winding until it reaches a trip value determined by the external sense resistor (RS) and the applied analog reference voltage (VREF):

ITRIP = VREF / (10 * RS)

At the trip point, the sense comparator resets the source enable latch, turning off the source driver. The load inductance then causes the current to recirculate for the fixed off-time period. The current path during recirculation is determined by the configuration of slow/mixed/fast current-decay mode."

Is this similar to a clock signal? (Note: ITRIP is already calculated perfectly for the motor current when VREF is a full 5 volts.)

If I were to supply 100% VREF, would it build up to 100%, produce one single step, trip and then wait the fixed time off before going again?

Would a constant VREF keep the motor going, pulsing automatically?

Full settings for the chips in current configuration is as follows:

  • Enable pin is held constantly high.

"If enable is kept high, the current will rise until it reaches the level set by the internal current-control circuit."

  • EXT Mode is held constantly low. Decay = Fast.

"With EXT MODE low, fast decay mode, the opposite pair of selected outputs will be enabled during the off cycle."

  • Internal current-control Mode pins are held constantly high. Decay = Fast, %tOFF = 100%.
  • PWM blank timer is held constantly low. TBLANK = 6 / FOSCILATOR.
  • FOSCILATOR is to have a typical value of 4 MHz.
  • Fixed off time is typically 24 μs with a 4 MHz oscillator.
  • Sleep logic is used to minimize power consumption. It is not to be used as a substitute to enable.

I normally have a really great understanding of stepper motor drivers. However, all stepper motor drivers I interface with pretty much always have step (clock) / direction as a standard input. Since this is an phase / enable chopper circuit, it will require more expertise (or a specialized controller chip) to figure out.

What is the best approach?


1 Answer 1


The A3959 looks like it's intended for controlling a brushed DC motor, where applying voltage in one direction produces continuous rotation, so the PHASE input does act as a forward/reverse control. For a stepper motor, you need to provide the two phase signals in the right sequence to get movement in either direction enter image description here (this is figure 3 from your link - https://www.embedded.com/print/4217719

As a result you've got two of these driver chips, and need to produce this signal to both of them. The L297, with a clock and direction input, will do that. You'll only need to use two of the outputs, such as A and C in 'normal mode' since the A3959 is generating the complementary drive to the other side of the bridge.

"Is this similar to a clock signal? (Note: ITRIP is already calculated perfectly for the motor current when VREF is a full 5 volts.)" No, it is a DC voltage that sets the level at which the current limit operates.

"If I were to supply 100% VREF, would it build up to 100%, produce one single step, trip and then wait the fixed time off before going again?" Yes, see the sawtooth in the figure? That's the current rising to the limit value, and being chopped, when it falls for the fixed time period, before the bridge transistors switch on again. The current then will keep bumping up to the limit value.

"Would a constant VREF keep the motor going, pulsing automatically?" No, the motor only rotates one step with each phase actuation and will stay there, actually locked into that position if the phase current stays on, until the next step is switched. There are half step strategies (detailed in the L297 datasheet) where one phase has no current on alternate steps, but with the controls available on the A3959s you don't have that option, you have to do full step - unless you can fudge a disabled state by dropping the Vref input low. It's not meant to operate that way, there's a separate ENABLE pin intended for PWM control. At this point I'd be tempted to program a PIC to generate the pulse sequence, but the L297 will get you a working drive.

  • \$\begingroup\$ So in theory, all I need to do is set my Vref current and then manipulate the Phase A/B using L297's A/C complimentary pairs? I would ignore L297's sense resistors and set the L297's oscillator to approximately 4 MHz to match the oscillator in the A3959? I am contemplating using ATtiny85 chips to write a custom microstepping solution, but L297 would work as well. \$\endgroup\$
    – AJ Quick
    Commented Oct 3, 2018 at 4:00
  • \$\begingroup\$ Yes, just ground the sense inputs on the L297 and leave the A3959s to do the current control. Since you're not using a lot of the L297's functions it's a bit of a waste, something based on an ATtiny would be cheaper, it's a question of the time spent setting something up using a microcontroller. There's an app note on the Microchip website (they now own Atmel) about this microchip.com//wwwAppNotes/AppNotes.aspx?appnote=en591569 \$\endgroup\$
    – Phil G
    Commented Oct 3, 2018 at 19:46
  • \$\begingroup\$ I have decided to port code to an ATtiny85 which should do exactly what I'm looking for and have microstepping. I have a much better understanding of the whole Vref and Phases thing now. Thank you for your help! \$\endgroup\$
    – AJ Quick
    Commented Oct 4, 2018 at 23:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.