From a71e8045b15dcab51e5e73eb66f24c833c33e6ec Mon Sep 17 00:00:00 2001 From: Alex Voinea Date: Sun, 9 Oct 2022 22:42:22 +0200 Subject: [PATCH] Clear tmc error flags on init --- src/hal/tmc2130.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/hal/tmc2130.cpp b/src/hal/tmc2130.cpp index da281af..8dc4b14 100644 --- a/src/hal/tmc2130.cpp +++ b/src/hal/tmc2130.cpp @@ -29,6 +29,9 @@ bool TMC2130::Init(const MotorParams ¶ms, const MotorCurrents ¤ts, Mot ///clear reset_flag as we are (re)initializing errorFlags.reset_flag = false; + // clear all error flags if possible ny reading GSTAT + ReadRegister(params, Registers::GSTAT); + ///apply chopper parameters const uint32_t chopconf = (uint32_t)(TOFF_DEFAULT & TOFF_MASK) << 0U //toff | (uint32_t)(5U & 0x07U) << 4U //hstrt