-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Driver must be reset by removing power #76
Comments
By reset, do you mean you setup the driver again? Is your step and direction controller also resetting to zero velocity and then accelerating again back up to your desired speed? Once the motor stalls and slips, the current signals will be out of sync with the motor windings. After you detect a stall, you should probably stop the controller step pulses, wait for a time for everything to stop and settle, then accelerate again back up to velocity. Even doing that, do you still need to reset power to the driver? If so, can you please include your code so I can see what might be happening with the driver? |
When I say reset, I have been using the blanket method of changing the enable pin of the esp32 which completely restarts it. Not included in this code sample (because it does not have an effect to this issue) I do have an acceleration function that allows me to get higher speeds. Here is my code #include <TMC2209.h>
HardwareSerial & serial_stream = Serial1;
const int RX_TMC = 17;
const int TX_TMC = 18;
const int EN_TMC = 4;
const int STEP_TMC = 5;
const int DIR_TMC = 6;
const uint8_t RUN_CURRENT_PERCENT = 100;
// Instantiate TMC2209
TMC2209 stepper_driver;
void setup()
{
Serial.begin(115200);
stepper_driver.setup(serial_stream, 115200, TMC2209::SERIAL_ADDRESS_0, RX_TMC, TX_TMC);
stepper_driver.setAllCurrentValues(RUN_CURRENT_PERCENT, RUN_CURRENT_PERCENT, 1000);
stepper_driver.setMicrostepsPerStep(32);
stepper_driver.enable();
}
void loop()
{
if (not stepper_driver.isSetupAndCommunicating()) {
Serial.println("Stepper driver not setup and communicating!");
return;
}
stepper_driver.moveAtVelocity(10000);
delay(5);
} Im not sure im using the term stall correctly. There are no vibrations, no movement, nothing. How would I detect such a "stall"? I have looked at the status struct, no data seems to be different from when it is moving and when it is not. |
trim.5EF3179A-538F-482C-9918-60C3EFFFFA3F.MOVHere is it in real life. |
I am not sure what is the problem exactly. Try putting a delay(4000); after stepper_driver.enable(); in the setup. Maybe the driver needs a little time to settle after stalling and then being commanded to stop before being commanded to move at a new velocity. |
Same result. Is there any reason why it would give up? Not only is it stalling but the tmc stops outputting signals when it is stopped. I know this library comes with many of the safer parameters set, is there a chance that there is some setting set to protect the hardware? |
The driver might shut itself down if it is getting too hot. The datasheet also says:
I will add a function to read the global status and another to clear the global status. Then on reset I will make it clear the global status by default. That might fix your problem, I will let you know when I update the version. |
Ok I have updated the library to version 9.4.0. This version automatically clears the drive error when it resets. You can also call clearDriveError() to clear it yourself to recover from a stall without resetting. Can you please try that version and see if it works for you? |
Apologies for the delayed response. None of the temperature statuses have been triggered when the behavior occurs. Version 9.4.0 does not solve the problem. Calling any of the new functions within the loop does not change anything. Additionally, using the code TMC2209::GlobalStatus gstat = stepper_driver.getGlobalStatus();
Serial.println("GlobalStat:");
Serial.print(" - reset: ");
Serial.println(gstat.reset);
Serial.print(" - drv_err: ");
Serial.println(gstat.drv_err);
Serial.print(" - reserved: ");
Serial.println(gstat.reserved);
Serial.print(" - uv_cp: ");
Serial.println(gstat.uv_cp); Reveals that no values change in the time that the motor is running vs the time in which it has stopped. |
|
It seems to not be an issue when stealthchop is disabled but I cant get reliable operation without stealthchop. (Especially at low speeds) |
Only stealthchop, that is interesting. I am not sure what is happening, I will have to dig through the datasheet when I have more time. Is the speed you are jumping to very fast? The datasheet does say you may need to increment the speed in steps when using moveAtVelocity. I am not sure why it would work at first and then stop working after a stall though. Does the driver seemed disabled or is it still attempting to spin the motor? Other TMC drivers have an option to stop on stall detection, but I do not think the TMC2209 has this option. |
no the speed is not fast at all, my accel function starts at 0. The driver is completely disabled, no attempt to spin. |
At lower speeds it will even give up without any torque. It will move a little bit, a couple of steps, then give up. |
This issue has been driving me crazy. I have a single driver board with an esp32 and seem to be having some weird behavior. Here is my schematic (sorry for the awful layout, I usually have time to do better)
There are a couple undesired behaviors that I have found:
Motor is being powered via a barrel jack, @24v with up to 8A at its disposal.
The text was updated successfully, but these errors were encountered: