Comments (8)
If CS should be below 16, then set vsense to true.
If CS should be over 16, then vsense should be false, so we test and reset it if it was set. If vsense was not set, then there's no need to write it.
Sure a mere write is faster than a read and write and that's why it was removed in TMCStepper.
My first suggestion is to move on to the newer TMCStepper library that superseded this one.
If you want to stick with this library, after setting the current, read back the chopconf and ihold_irun registers.
The motor should react to step inputs if toff > 0, irun > 0 and en pin is low.
Vsense itself doesn't prevent the motor from spinning but when reading back the value with vsense(), the read operation will overwrite the cached register value which is then modified and pushed to the register. If the read fails and reads 0, then you'll be writing toff = 0 to the driver, effectively disabling it. When you removed the vsense() call, the cached register was no longer overwritten with an invalid value and it seemed to be fixing everything.
So the likely cause for now is an issue with read operations.
from tmc2130stepper.
Migrated to the new TMCStepper library. Got it working fine with my setup.
Good that you added the note to ReadMe to help anyone use the newer library from now.
Thanks again for all the help. 😃
from tmc2130stepper.
Thanks for the fast response.
I didn't know about the overwriting of the register on a failed read. I presume that's what is happening here. When I am reading vsense(), I was always getting a zero.
I had tried the newer TMCStepper library but couldn't get it working with my setup. But I didn't spend any time trying to figure out why it wasn't working. Let me try the new library once again and report back. If it works, I can get going with that. I presume the same initialization commands and functions should work for the new library as well?
from tmc2130stepper.
Seems the same issue of vsense
persists in the newer library too.
For IRMS<=872mA(CS<16 limit for Rsense = 0.12Ω
), driver.rms_current()
still returns a wrong value. vsense
seems to be stuck at zero.
But the motor runs in both cases though.
I just saw that someone else has opened an issue on this same problem in the new library too. I will post there from now on if there is a fix.
from tmc2130stepper.
Arduino Nano 33 IOT
with TMCStepper@master
#include <TMCStepper.h>
#define EN_PIN 3 // Enable
#define STEP_PIN 2 // Step
#define CS_PIN 10 // Chip select
#define R_SENSE 0.11f // Match to your driver
// Select your stepper driver type
TMC2130Stepper driver(CS_PIN, R_SENSE); // Hardware SPI
void setup() {
delay(2000);
pinMode(EN_PIN, OUTPUT);
pinMode(STEP_PIN, OUTPUT);
digitalWrite(EN_PIN, HIGH);
Serial.begin(9600);
while(!Serial);
Serial.println("########## " __TIME__ " ########");
SPI.begin();
driver.begin();
driver.rms_current(600); // Set motor RMS current
Serial.print("vsense = ");
Serial.print(driver.vsense());
Serial.print("\trms_current = ");
Serial.print(driver.rms_current());
Serial.print("\tirun = ");
Serial.println(driver.irun());
driver.rms_current(1000); // Set motor RMS current
Serial.print("vsense = ");
Serial.print(driver.vsense());
Serial.print("\trms_current = ");
Serial.print(driver.rms_current());
Serial.print("\tirun = ");
Serial.println(driver.irun());
}
void loop() {}
For me returns:
########## 23:44:04 ########
vsense = 1 rms_current = 581 irun = 18
vsense = 0 rms_current = 994 irun = 17
from tmc2130stepper.
Thanks for taking the time to check this.
I tried your same code on my first setup(Custom TMC2130 + Atsamd21 board) changing only the pin numbers. I got the following
vsense = 0 rms_current = 1077 irun = 20
vsense = 0 rms_current = 974 irun = 18
which corresponds to the fact that vsense is not getting set(or not getting read properly)
To explore why this was happening, I went back to a normal Atsamd21 M0 Adafruit feather board and original TMC SilentStepStick SPI board setup. Made wire connections between them. For the same connections and the same code, I get the output the same as you reported.
vsense = 1 rms_current = 581 irun = 18
vsense = 0 rms_current = 994 irun = 17
It seems then that the TMCStepper library is working and I am starting to suspect that it might be a hardware issue in my custom board. I don't think its an SPI connection issue as its soldered on. Now when I am rechecking the TMC SilentStepStick schematic and mine(Attached below), seems that I left AIN_IREF
open. But I am unsure if that will cause this issue which we are discussing.
Any tips on debugging this issue on my custom board? It's a TQFP48 package. I am unclear why there might be a read/write issue (as the motor is configured and running).
from tmc2130stepper.
Hardware design is not really my strong suite. My first thought was the unconnected SPI_MODE pin but according to the datasheet that should have a pullup resistor and so should be fine. Maybe you can try pulling it to 3.3 none-the-less.
AIN_VREF is only used if I_scale_analog is enabled in gconf register.
Can you successfully read the IOIN register?
Also you may need to get into debugging with a logic analyzer or an oscope if there are no obvious issues.
from tmc2130stepper.
I tried reading IOIN register with driver.IOIN()
but it keeps returning zero. So I am guessing it's not reading(It's reading fine in Feather M0 + TMCsilentstep setup).
I am unclear as to how a write( for configurations) is possible and yet read keeps failing.
Regarding the 3V3 pullups, I didn't give that for the same reasons you mentioned. I am unsure about AIN_VREF though as there is no pullup there. But I am using that in my code also.
I have to really dig deep into checking what's wrong.
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
- 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.