teemuatlut / TMCStepper

MIT License
479 stars 188 forks source link

Not initialized for current sensing with TMC2209 #280

Open berkut0 opened 11 months ago

berkut0 commented 11 months ago

I have a Lerdge TMC2226 that seems to be fully compatible with all tmc2209 libraries. I'm trying to read SG_RESULT() to make measurements of the current for calibration purposes (and some features, but that's not important for now).

And there is apparently some kind of bug in the initialization. With cold load, any combination of options shown in the examples does not lead to success with readings. BUT! If I use another TMC2209 library that reads the values easily, I have a interesting situation — after uploading my sketch which using original library right after flashing the example I have very noisy stepper (loud humming noise) and surprisinhly I have measurments and readings!

If it matters, I use esp32-c3. And it connects to the UART.

berkut0 commented 11 months ago

https://github.com/teemuatlut/TMCStepper/issues/87 https://github.com/teemuatlut/TMCStepper/issues/272 These may be related, but the example from the comments does the same thing - returns zero at SG_RESULT()

berkut0 commented 11 months ago

After diving in a bit, I realized that it seems to be my fault. Calculation only happens "while driving", right?