Open MilanVDB opened 4 years ago
I have the same issue. Seems like teemuatlut is using bit manipulation to step the motor with interrupts. Such operations are much faster than using digital write. PORTF is present in Mega2560 but not in Nano (which I use) and it covers the analog pins A0-A7 on the Mega so the STEP-pin in our case. What you need to do is to either use another port and change the code, or to not use ports (and change the code).
So, how to solve it? I solved it still using ports by changing the port to PORTD (D0-D7 on my Nano) since this is present in my Nano (and in your UNO which is based on AtMega168: https://www.arduino.cc/en/Reference/PortManipulation). I connected the STEP pin to D7. Then I changed the interrupt function to do an XOR with PORTD and a bitmask.
So I changed these two lines: https://github.com/teemuatlut/TMC2130Stepper/blob/master/examples/StallGuard/StallGuard.ino#L99-L100
to
PORTD ^= (1 << 7)
or what ever pin you use as step pin on PORTD.
Hi,
Simple Sketch works fine. Now I am trying to run a Stepper with the TMC2130 and an Arduino UNO. I tried to use the StallGuard Example but when compiling it says
exit status 1 'PORTF' was not declared in this scope