teemuatlut / TMC2130Stepper

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

StallGuard example on nano #12

Closed kevoc69 closed 6 years ago

kevoc69 commented 6 years ago

Hi,

thanks for your library and examples. I'm trying to get your StallGuard example to work on a arduino nano but (obviously) PORTF isn't defined. Actually, I'm only just learning about port manipulation so I'm still a little unsure what your are trying to achieve with

ISR(TIMER1_COMPA_vect){ PORTF |= 1 << 0; PORTF &= ~(1 << 0); }

is this setting the STEP pin? Any help would be gratefully received. Best regards, Kevin

teemuatlut commented 6 years ago

PORTF is the Arduino pins 54..61. Basically I'm writing (bitwise OR) a one to the first bit position (0) of the pin register to toggle it high. And then I drive it low again with bitwise inverse AND. The left shift determines the bit position; here it's 0.

For nano you could use pin 18 which would be PORTC and bit position 4. Search for Arduino Nano pinout and look for PC4.

kevoc69 commented 6 years ago

thanks for the clarification - much appreciated.