From 50a5f1db4d87044a1d979400d2fa6d48962b7c86 Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Tue, 17 May 2022 16:50:41 +0200 Subject: [PATCH] tmc2130: Clear reset_flag by reading GSTAT on power-on This is required as power-on reset will activate DIAG0, which is used as a trigger for SG. --- src/hal/tmc2130.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/hal/tmc2130.cpp b/src/hal/tmc2130.cpp index 2e3a336..e49878f 100644 --- a/src/hal/tmc2130.cpp +++ b/src/hal/tmc2130.cpp @@ -22,7 +22,8 @@ bool TMC2130::Init(const MotorParams ¶ms, const MotorCurrents ¤ts, Mot if (((IOIN >> 24U) != 0x11) | !(IOIN & (1U << 6U))) return false; // @@TODO return some kind of failure - ///clear reset_flag as we are (re)initializing + // read GSTAT to clear reset_flag as we are (re)initializing + CheckForErrors(params); errorFlags.reset_flag = false; ///apply chopper parameters