@@ -15,7 +15,7 @@ Arduino library for DRV8825 stepper motor driver.
1515
1616** DRV8825** is a library for DRV8825 stepper motor driver.
1717
18- ** Warning: experimental**
18+ ** Warning: experimental** needs testing.
1919
2020The DRV8825 stepper motor library controls a stepper motor with
2121a direction signal and a step pulse.
@@ -44,8 +44,10 @@ const uint8_t DRV8825_COUNTERCLOCK_WISE = 1; // HIGH
4444### Constructor
4545
4646- ** DRV8825()** Constructor.
47- - ** bool begin(uint8_t dirPin , uint8_t stepPin )** set the direction pin and step pin.
47+ - ** bool begin(uint8_t DIR , uint8_t STEP, uint8_t EN = 255, uint8_t RST = 255, uint8_t SLP = 255 )** set the direction pin and step pin.
4848Both pins are set to LOW. For direction this means DRV8825_CLOCK_WISE.
49+ Optional the enable, reset and sleep pin can be set.
50+ If these are set to 255 the related functions won't do anything.
4951
5052
5153### Direction
@@ -109,9 +111,72 @@ Normally these need not to be changed.
109111Default the value = 2.
110112
111113
114+ ### Enable (EN)
115+
116+ - ** void enable()** sets the enable line LOW.
117+ - ** void disable()** sets the enable line HIGH.
118+ - ** bool isEnabled()** reads back the line state.
119+ True means enabled.
120+
121+ After ** enable()** the system needs 650 ns before ** step()**
122+ can be called. See 7.6 Timing Requirements.
123+
124+
125+ ### Reset (RST)
126+
127+ - ** void reset()** sends a reset pulse to the device.
128+
129+
130+ ### Sleep (SLP)
131+
132+ - ** void sleep()** sets the enable line LOW.
133+ - ** void wakeup()** sets the enable line HIGH.
134+ - ** bool isSleeping()** reads back the line state.
135+ True means enabled.
136+
137+ After ** wakeup()** the system needs ** 1700 us** before ** step()**
138+ can be called. See 7.6 Timing Requirements.
139+
140+
141+ ### MicroSteps
142+
143+ The pins M0, M1 and M2 are to be used to set micro steps.
144+ This library does not allow them to be set from code as
145+ normally these won't change in a project.
146+
147+ | STEP MODE | M2 | M1 | M0 |
148+ | :-----------:| :----:| :----:| :----:|
149+ | full | 0 | 0 | 0 |
150+ | half | 0 | 0 | 1 |
151+ | 1/4 | 0 | 1 | 0 |
152+ | 1/8 | 0 | 1 | 1 |
153+ | 1/16 | 1 | 0 | 0 |
154+ | 1/32 | 1 | 0 | 1 |
155+ | 1/32 | 1 | 1 | 0 |
156+ | 1/32 | 1 | 1 | 1 |
157+
158+ Check datasheet for details.
159+
160+
161+ ### Fault (FLT)
162+
163+ The FLT pin indicates that an error has occurred.
164+ The library does not monitor this pin as that would need a background process.
165+ The user is advised to check this pin at regular intervals
166+ or connect the FLT pin to an interrupt pin of the processor.
167+
168+ - LOW == fault condition (overtemp, overcurrent)
169+ - HIGH == OK
170+
171+ The device does not provide means to interpret the type of
172+ error, but one could at least call ** disable()** .
173+
174+ Check datasheet for the details.
175+
176+
112177## Operational
113178
114- The base functions are :
179+ The minimal code is :
115180
116181``` cpp
117182DRV8825 stepper;
@@ -143,19 +208,12 @@ Some will only be worked on if requested and time permits.
143208
144209#### must
145210
211+ - test test test
146212- add examples
147213- update documentation
148214- investigate other pins
149- - M0..M2 8.3.5 micro steps
150215 - decay mode 8.3.3 there are 3 modi)
151- - fault pin FLT input to detect errors
152- - sleep pin SLP 8.3.6
153- - enable pin EN 8.3.6
154- - reset pin RST 8.3.6
155216 - other?
156- - if stepsPerRotation is set to zero, should pos be set to zero?
157- - NB it will not be updated any more.
158- - do we need steps counter?
159217
160218#### should
161219
@@ -164,10 +222,8 @@ Some will only be worked on if requested and time permits.
164222 - blocking
165223 - max 1 rotation?
166224 - optimize "position admin"
167- - gotoPosition(pos)..
168- - needs steps(n) above.
169- - investigate other similar STEP/DIR controllers
170- - DRV88xx series?
225+ - should begin return bool?
226+
171227
172228#### could
173229
@@ -176,11 +232,20 @@ Some will only be worked on if requested and time permits.
176232 - only when needed?
177233 - 8825 as derived? or as base class?
178234 - which others are similar?
179- - investigate controlling a DRV8825 with an PCF8574
180- - pins needed (M0..M2, SLP, RST, EN, DIR, STEP)
181- - first need a decent basic library.
235+ - A4988, DRV8824, more?
182236
183237#### wont
184238
185239- left() + right();
240+ - if stepsPerRotation is set to zero, should pos be set to zero?
241+ - NB it will not be updated any more.
242+ - leaving it as is, could allow "creative calibration"
243+ - investigate controlling a DRV8825 with an PCF8574
244+ - pins needed (M0..M2, SLP, RST, EN, DIR, STEP)
245+ - first need a decent basic library.
246+ - would be a class on its own.
247+ - gotoPosition(pos)..
248+ - needs steps(n) above? for loop!
249+ - shortest angle/path or via current CW/CCW mode.
250+ - user can implement his own strategy.
186251
0 commit comments