teemuatlut / TMC2130Stepper

Arduino library for Trinamic TMC2130 Stepper driver
MIT License
159 stars 50 forks source link

Stealtchop stops motor working #59

Open SteveWCoder opened 5 years ago

SteveWCoder commented 5 years ago

Hi,

I've got a 2130 connected to an adafruit arduino(bluefruit LE). I've changed the various pins(en, cs, dir, step) to ones on the board and have(it has dedicated pins) MOSI -> SDI, MISO -> SDO, SCK -> SCK.

I've tried getting the simple example to work but it doesn't work unless I comment out the line

driver.stealthChop(1);

Worked this out by trial and error. Without this line the motor turns and changes direction, though is noisy as if using a normal stepper driver. I've tried 3 different stepper motors and the same thing happenes for all of them.

Any ideas how I can resolve this ?

Thanks.

EDIT: Another thing I just noticed is that sometimes it doesn't change direction, it sort of stalls for a short time then continues in the same direction, then this behaviour either continues or it goes back to switching direction.

SteveWCoder commented 5 years ago

Hi,

to follow up. I have a 2100 board as well so used that to check the motor connections, with the 2130 board replaced with the 2100 and using the simple example the motor spins correctly(and pretty silently). I realise that it's ignoring all the actual 2130 driver stuff just using the step commands.

I then set up the stallguard example with correct pins and added

digitalWrite(STEP_PIN, HIGH);
delayMicroseconds(10);
digitalWrite(STEP_PIN, LOW);
delayMicroseconds(10);

When I ran it the motor ran really erratically and this was the output in serial monitor

Start... 0 318 305 0 0 581 0 0 581 0 0 581 0 252 581 0 244 581 0 0 581 0 0 581 0 0 581 0 253 581 0 225 581 0 243 581 0 0 581 0 0 581 0 0 581 0 256 581 0 240 581 0 0 581 0 0 581 0 241 581 0 251 581 0 228 581 0 0 581 0 0 581 0 244 581 0 249 581 0 236 581 0 0 581 0 0 581 0 247 581 0 253 581 0 0 581 0 0 581 0 245 581 0 251 581 0 0 581 0 0 581 0 0 581 0 0 581 0 0 581 0 235 581 0 240 581 0 235 581

So it seems that it is reading something via SPI though what this means I don't know.