Comments (29)
Exactly. Disconnect the SPI wires though.
from tmc2130stepper.
Holly shit.
It works!
With Mega and ramps! Now I need to figure out what's the difference between this and my previous setups. Power is the same. It's just another Microcontroller =\
from tmc2130stepper.
shaft_dir
does not toggle the DIR_PIN
but rather uses the driver's internal register to change the rotation.
the dir value is not stable it's fluctuating between 1 and 0
That would be intentional.
SCK
line is active during a transaction, but not all the time. The max frequency is about half that of the internal frequency of the stepper driver logic; roughly 6MHz.
I was testing some new driver last night and had communication issues with the driver as well. I'm not sure what would have changed but the commands sent were not correct. I'll be looking more closely into this so stay tuned. Maybe it affected TMC2130Stepper as well.
In the mean time if you want, you can try older versions of the library, just in case something has been broken.
from tmc2130stepper.
I tested the "Simple" example from library version 2.3.0 and after setting up the correct pins, the code worked as expected.
This was with Mega + RAMPS1.4 + FYSETC v1.1 driver.
Your driver actually does look a bit smudged but it's hard to tell.
The symptoms would indicate that your driver would be configured to standalone mode where stepping works but SPI communication does not. However, your driver looks like you've what is necessary to switch the modes.
Could you add this to your code, between Serial.println("Start...");
and driver.begin();
:
pinMode(CS_PIN, OUTPUT);
digitalWrite(CS_PIN, HIGH);
Serial.print("DRV_STATUS=0x");
Serial.println(driver.DRV_STATUS(), HEX);
Then report back with the response.
EDIT: Another suggestion would be to try software SPI.
from tmc2130stepper.
They look like valid responses but you still have some error flags.
You should try running it with a RAMPS board and see if that changes anything.
from tmc2130stepper.
I have different microcontrollers, motors only one driver of this type. (have many other DriverSticks) So I could troubleshoot with those, but I don't feel it's where the problem. =\
from tmc2130stepper.
Try switching the driver to another one, like A4988. That way you can test if the issue is with SPI or the rest of the wiring.
Is your FYSETC driver version 1.0 or 1.1?
from tmc2130stepper.
it's 1.0
Are you saying I should keep the Simple example but switch to A4988? ... I mean' it should work, I guess. Just dir and step + EN pins are needed to drive it ...
from tmc2130stepper.
It took me some time to remember to connect Sleep to Reset as on this diagram:
I've used the simplest program to run it:
// defines pins numbers
const int stepPin = 8;
const int dirPin = 7;
void setup() {
// Sets the two pins as Outputs
pinMode(stepPin,OUTPUT);
pinMode(dirPin,OUTPUT);
}
void loop() {
digitalWrite(dirPin,HIGH); // Enables the motor to move in a particular direction
// Makes 200 pulses for making one full cycle rotation
for(int x = 0; x < 200; x++) {
digitalWrite(stepPin,HIGH);
delayMicroseconds(500);
digitalWrite(stepPin,LOW);
delayMicroseconds(500);
}
delay(1000); // One second delay
digitalWrite(dirPin,LOW); //Changes the rotations direction
// Makes 400 pulses for making two full cycle rotation
for(int x = 0; x < 400; x++) {
digitalWrite(stepPin,HIGH);
delayMicroseconds(500);
digitalWrite(stepPin,LOW);
delayMicroseconds(500);
}
delay(1000);
}
With all that I was able to make it run (using A4988)!
But when I switched to your simple script:
#define DIR_PIN 7
#define STEP_PIN 8
#define EN_PIN 9
#define CS_PIN 17
bool dir = true;
#include <TMC2130Stepper.h>
TMC2130Stepper driver = TMC2130Stepper(EN_PIN, DIR_PIN, STEP_PIN, CS_PIN);
void setup() {
Serial.begin(9600);
while(!Serial);
Serial.println("Start...");
driver.begin(); // Initiate pins and registeries
driver.rms_current(1000); // Set stepper current to 600mA. The command is the same as command TMC2130.setCurrent(600, 0.11, 0.5);
driver.stealthChop(0); // Enable extremely quiet stepping
digitalWrite(EN_PIN, LOW);
}
void loop() {
digitalWrite(STEP_PIN, HIGH);
delayMicroseconds(10);
digitalWrite(STEP_PIN, LOW);
delayMicroseconds(10);
uint32_t ms = millis();
static uint32_t last_time = 0;
if ((ms - last_time) > 2000) {
if (dir) {
Serial.println("Dir -> 0");
driver.shaft_dir(0);
} else {
Serial.println("Dir -> 1");
driver.shaft_dir(1);
}
dir = !dir;
last_time = ms;
}
}
With EN_PIN, CS_PIN not connected.
Motor makes high pitch sound, not turning and stepper goes hot quickly (I've disconnected before it burned)
from tmc2130stepper.
Update: Ok. I've changed delayMicroseconds
to 500
as in my other example and it spins now. But it doesn't change direction. Multimeter doesn't show change on D7 pin.
from tmc2130stepper.
I've added 1 second delay before each of driver.shaft_dir();
- didn't help. It stops and keep rotating in the same direction.
from tmc2130stepper.
Ok. I've looked what shat_dir is doing. It relies on TMC_MOD_REG, which is SPI way of controlling direction. So I assume test has succeeded - it works with A4988. Kinda.
from tmc2130stepper.
No idea how continue debugging?
from tmc2130stepper.
hey I'm getting the same problem that you have specified
-driver heats up too much ( too hot to touch )
-the motor is moving in a single direction then pauses and moves in the same direction
-also, the dir value is not stable it's fluctuating between 1 and 0
from tmc2130stepper.
Can this stepper motor library be used with the accel stepper library?
from tmc2130stepper.
@prathameshj There was an issue about that #33
Btw, The movement in one direction I've described was about trying this lib with classic pololu stick
Edit:
Also, it's ok for driver to heat up. It can be over 80 or 100 some cases. So, that's not a big problem.
from tmc2130stepper.
Ok. Here is what I've done:
I double check my SPI pin configuration. Since I switched to my old Seeeduino v2.2 (Which has arduino compatible layout)
SDI - MOSI - 11 #green
SDO - MISO - 12 #blue
SCK - SCK - 13 #orange
CS - SS - 10 #yellow
I also added driver.microsteps(0);
to my code, since I found out by deafult it goes full microsteping.
from tmc2130stepper.
I don't know how SPI works exactly, but I would assume SCK should have a constant frequency. I am not sure what it should be, but I assume anything lower than my Arduino internal clock, which is 16MHz.
I was trying to debug SPI channel with my Logic Pirate.
I tested and retested the analyzer by using test pin. I was trying to see at least clock signal on pin 13 since this is the one on Arduino is SCK one when using SPI. Just to make sure I've even run a blink program since 13 is connected to internal LED. I've made 20 ms duty cycle with 10ms on and 10ms off. I could see this clock on the analyser. All this says that it works fine.
But when I run in with Simple_TMC2130 it just shows it's always ON. I am confused at this point.
from tmc2130stepper.
Maybe ISP doesn't clock on SCK between transactions? I couldn't find a definite answer anywhere. In this case, it's ok I don't see any signal there since this only happens during setup.
I guess another option would be to use software SPI. Just because I don't have any other idea.
. + I will order some other stepper driver with v1.1. Maybe I have busted driver 🤷♂️
from tmc2130stepper.
I've tried prev. version of library. Didn't help.
When I had stealthChop
set to 0:
On the initial start after power up only V5 line I get this
DRV_STATUS=0x0
But after turning power line on and restarting I get this:
DRV_STATUS=0x60000000
# 0110000000 0000000000000000000000
I switched on stealthChop
back on and I get now these:
DRV_STATUS=0x81090000 # On initial start up with motor power on already
# 1000000100 00100 1 0000000000000000
# ^ full step active indicator, which is correct. I have driver.microsteps(0);
DRV_STATUS=0xE0090000 # On each consequative restart
# 1110000000 00100 1 0000000000000000
I have unused mega and RAMPS laying around. I can try with them. I just thought my setup with breadboard has less variables. I guess I would need to resolder headers for that.
Next thing I try is software SPI
from tmc2130stepper.
I've tried Software SPI. IT already had status printout (but after digitalWrite(EN_PIN, LOW);
line). I've added HEX output just in case.
Visual result is exactly the same as with normal SPI: it makes noise without movement with stealthChop(0)
and it doesn't do anything with stealthChop(1)
. I've also added driver.microsteps(0);
for both tests:
With stealthChop(1)
:
# 0b1100000000 00100 1 0000000000000000
# 0xD8090000
With stealthChop(0)
:
# 0b1110100000 00100 1 00000 000 0 0 0 1 0 1 1 0
# ^ short to ground? :-\
# 0xE8090016
from tmc2130stepper.
The Simple sketch was meant to be ran with native 256 microstepping, so when you're switching to fullsteps you're also asking the driver to run 256 times faster. Try increasing step delays 2560.
The driver needs to be fully powered on from +12V as well for communication to work.
from tmc2130stepper.
Ok. I c. That makes sense. I can just leave it as is without full step. For some reason I thought full step will make it cleaner experiment.
Does my debugging report tells you anything? I didn't understand from docs what first 10 bits represent. If first in order is 0th one
from tmc2130stepper.
DRV_STATUS=0x0
is because the driver has no VMOT power.
DRV_STATUS=0x60000000
would indicate triggered open load indicators. Possibly due to very high requested stepping speeds.
DRV_STATUS=0x81090000
is standstill, stallguard and CS_ACTUAL=1. Would've expected to see factive there too.
DRV_STATUS=0xE0090000
a more plausible result but there are error flags raised.
DRV_STATUS=0xD8090000
same as previous with short to ground flags switched.
DRV_STATUS=0xE8090016
still roughly the same with error flags but this time with a SG_RESULT added.
When reading the register output, the first number on the left, is the most significant bit.
So as an example 0xA
is 0b1010
and means that bits number 3 and 1 are set.
from tmc2130stepper.
I tried new delay. No spinning, but it got louder and vibrates a lot now. I will attach video in next post.
Current status is this.
0xE8090016
standstill indicator
| short to ground indicator phase B
↓ ↓
1 1 1 0 1 0 0 0 000 01001 0 00000 0000010110
↑ ↑ ↑ ↑ ^ SG_RESULT
| | | ^ reserved
| | ^ full step active indicator
| ^ CS ACTUAL
| ^ reserved
^ stallGuard2 status
Is this how I should read it then?
All that with driver.stealthChop(0);
When I turn it on, I have
DRV_STATUS=0b10000000000010010000000000000000
DRV_STATUS=0x80090000
standstill indicator
| short to ground indicator phase B
↓ ↓
1 0 0 0 0 0 0 0 000 01001 0 00000 0000000000
↑ ↑ ↑ ↑ ^ SG_RESULT
| | | ^ reserved
| | ^ full step active indicator
| ^ CS ACTUAL
| ^ reserved
^ stallGuard2 status
with no noise and no movement.
I am still using SW SPI, but I didn't change pins for it SPI cabels. I hope it's ok.
from tmc2130stepper.
Is there any nice instruction on how to wire stuff in and what pins to choose in the code etc? I guess I will have to resolder driver headers, since SPI ones should not go into RAMPS.
Ignore that. I'll figure this out.
from tmc2130stepper.
Oh, that's the video I promised before https://photos.app.goo.gl/uXvsUa5BhQqL4dRf2
from tmc2130stepper.
Thank you @teemuatlut ! Let me close this issue since I made it work. But I will report when I figure out what was wrong.
from tmc2130stepper.
@soswow I'm trying a UNO right now and I'm unsuccessful, did you find the difference ?
from tmc2130stepper.
Related Issues (20)
- Motor won't rotate if stealthChop isn't enabled HOT 3
- microsteps() takes power of two values... except at full steps?
- ESP8266 (Wemos D1) in combination with stepper motor driver tmc2310, heat problem and force hold problem. HOT 1
- StallGuard can't seems to work while in TMCL-IDE the same config works HOT 1
- setting RMS current via SPI & via ref voltage / potentiometer, difference? HOT 3
- On driver board end stops HOT 3
- Reading 256
- readme.md missing reference HOT 2
- Struggling with parameters HOT 2
- how to setup HOT 1
- StallGuard Example not working HOT 1
- Simple example only partially working HOT 3
- How to reduce motor vibrations? HOT 1
- Calibrate_spreadCycle - DRV_STATUS() returning 0xFFFFFF HOT 1
- TMC2130 Stallguard not working with Arduino UNO HOT 8
- Issue with higher current rated motors HOT 8
- Possible pull request... Use MCP23017 to multiple SPI TMC2130 HOT 7
- Is DIR pin obsolete? / verify current fraction of steps / 1 step function in SPI HOT 2
- i am not able to see LOST_STEPS. please help me ...
- I am not able to Enable LOST_STEP feature HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tmc2130stepper.