DRV8834 command questions (sleep and enable)

I am using a a DRV8834 with an Adafruit Feather. I’ve got the unit up and running both Pololu Nema 8 and Nema 11 steppers. So far so good. I used the library that you have on github and only tweaked some of the pins as the Feather has pins 5,6,10,11 in a row, so I changed the dir and step to correspond to the 5 and 6 pins.

My question is does the library allow the use of sleep or enable? For that matter, what is the difference between the two. Currently I have sleep pulled high by having it connected to the 3V pin on the Feather, in order to get the motor to spin (this is like the example). When not spinning the motor, it sounds like the motor is still being pulsed, probably a holding torque. This heats up the motor pretty quickly. I’ve wired up the enable pin, but even though it is mentioned (in fact stating to use pin 13 as an indicator), I can’t see in the code, where or how to turn enable off and on. Manually, pulling the pin up to 3V (like slp) powers the unit down, letting it float and everything runs, and I have holding torque (which heats things up) when not spinning the motor. Now I just want to power the motor down with code. I know I can probably add the code to the program, turning a pin high or low, but it seems that it was in the code already or is it not.

Finally, and the is an aside, and perhaps if I study the library I can figure it out, but is the step command being done with digitalwrite, or port manipulation (bitset and bit clear), I am guessing digitalwrite, otherwise I probably couldn’t have changed my pin assignments so easily, and the port assignments might be different on the Adafruit Feathers.

Irrespective, this is a nice little driver board. Thanks.

Hello.

It sounds like you are referring to the library we link to in the resources tab of the DRV8834 product page. That library was written by laurb9 (a member on our forum), so we don’t have any special details about it. Several of the example sketches included in that library have commented out code for using the ENABLE pin like line 31 of the “MicroStepping” example sketch. Also, the code does appear to use the digitalWrite function for setting the mode, step and direction pins.

You can find out more about the differences between the ENABLE and SLEEP pins on the driver in the “Pin Functions” table beginning on page 3 of the DRV8834 datasheet. Pulling the ENABLE pin high will turn off the current to the motor coils.

-Nathan

Thank you Nathan. Manually touching the EN to 3V would de-energize the motor, whereas touching to ground doesn’t make an difference. I’ll review the differences between sleep and enable by reading the data sheet.

After going on the forum and seeing laurb9’s post, it crossed my mind afterwards that it was the theirs. It seems pretty okay.

Maybe this will get me motivated to make my own library, earlier attempts have failed, all probably due to newbie mistakes.

BTW, I ran the stepper up to 240 rpm and the motor was still running strong. I will likely follow up my post with what I discover.

The bar over the pin name we use in our documentation for the board can be thought of as a not symbol. For instance, the E̅͞N̅͞B̅͞L̅ pin has reverse functionality such that when the pin is logic low (or false) the board is enabled and when it is logic high (or true), it is not enabled. So, the behavior you described when connecting that pin to 3V and GND makes sense.

Also, the driver IC has a built-in pull-down resistor on the E̅͞N̅͞B̅͞L̅ pin, so if the pin is left disconnected, its logic state will be low and the board will be enabled.

-Nathan

Thanks Nathan. Got busy last night so did have much time to play with the code. Will likely work on it tonight.