TMC2130 Stepper Motor on Raspberry Pi. SPI issue?
For the last few days I’ve been struggling to get a NEMA17 (1.5 rated current) stepper motor to function with TMC2120 driver (vref = 1.0) and I’m all out of options now to try, so I’m here looking for some help. I think it may be SPI related due to me not getting back expected results on statuses…stepper-motorstepper-drivertlfong011. I think your SPI hardware and software looks more or less OK. 2. But why frequency set so low? 3. Have you ever tried to use a square wave sig gen to move the motor?4. Of course you also need to use jumper wires to manually config the driver first. john17521. thanks, it’s nice to know that matches what I think it should be. 2. The frequency is low because that’s all that seemed to get the correct output on PISCOPE, but I think that might be an issue with Piscope than anything else from what I’ve read recently. 3. I haven’t tried this no, I presume it’s software based so I’ll give it a google to try today (feel free to point me to any scripts/resources on it if you have any handy) tlfong016880Ha, when I started playing with my tmc2209 a while ago, I skimmed the data sheet and used jumper wires to config, and a sig gen to send the steps, and the motor started moving happily.You might like to go to Rpi SE and search tmc2209 to find my tldr answer!Two more things. (1) You seem to forget to initialize the ENABLE pin. (2) When you clean up GPIO, all GPIO output pins would automatically return to INPUT mode. This is a trap to many newbies. john1752Thanks. I’ve been tying the ENABLE pin to ground which is 0 I believe? The SPI screengrab above doesn’t seem to say that though so I’ll double check. I have tried via a GPIO pin too though. The response issue I was having looks like it’s due to it being sent on the next request for reads, so I’m playing with that now to check outputs and errors now I can. tlfong016880Yes, I am reading the tmc2130 datasheet and now understand why you missed the “pin operation mode”. In tmc2209 datasheet, this “standalone or pin mode” is clearly explained. (4) Ref: TMC2130 DATASHEET (Rev. 1.10 / 2018-MAY-09) Page 5 trinamic.com/fileadmin/assets/Products/ICs_Documents/… Section 1 – Principles of Operation THE TMC2130 OFFERS THREE BASIC MODES OF OPERATION: / to continue, …(1) In Step/Direction Driver Mode, the TMC2130 is the microstep sequencer and power driver between a motion controller and a two phase stepper motor. Configuration of the TMC2130 is done via SPI. (2) In Standalone Mode, the TMC2130 can be configured using pins. In this mode of operation CPU interaction is not necessary, … (3) The third mode of operation is the SPI Driver Mode, …Perhaps what is confusing is that, in standalone/pin mode, no cpu/mpu is necessary, but you do need a square wave pulse/PWM/(Step) signal generator to send the step signal.(1) My enable pin function is something like this: def tmcStartMotor(enblPin): setGpOutPinLow(enblPin) return (2) This is a complete listing of my still buggy Pico MicroPython program: penzu.com/p/6f3b4f94. john17520:52I’ve tried with the enable pin and still no luck. Running DRV_STATUS after each step is showing s2ga as 1 though? Any idea what that could be?Looking at my chip it’s a SPI version so I should be able to use operation mode 1 or 3 in the datasheet I presume. Another thing to add it that when I run my stepping script, sometimes it ends with the motor being in an active state (hard to move) and sometimes it’s free to rotate. It seems strange that it’d be doing that to me, but I dont know how to debug the issue. 10 hours later… tlfong01688010:49@john (1) “my chip it’s a SPI version”. Does this mean that it is hardwired only for SPI operation, while the “DIY” version is hardwired for standalone/manual jumper wire pin and cannot be used for SPI?(2) Now I am browsing the BigTreeTech’s shop where they are selling two versions: (a) Step/Dir version, (b) SPI version. So you are sure yours is a SPI one. (3) Can I have the link to your product, hopefully not from eBay? 🙂TMC2130 Version 3 42 stepper motor driver (silent for 3D printer DIY kit) – BigTreeTech, Tmall ¥53
detail.tmall.com/…tlfong01688011:20(4) Are you sure your tmc2130 module is hardwire to do SPI operation?
1 hour later… tlfong01688012:40There are two versions of TMC2130, V1.1 and V3.0. Which one are yours?TMC2130 V1.1 SPI stepper motor driver for 3D printer – ¥28
item.taobao.com/…Version 1.1 a,d 3.0 seems compatible.
tmc2130 datasheet says there are 3 modes of operation: Spi/Dir, (2) standalone, (3) SPI. Modes 1 and 3 uses a “motion controller” TMC429, TMC4369. I assume you are NOT using those controllers. Please confirm.
And you are not using any current sensing resistors. tlfong01688013:24tmc2130 datasheet says to transmit/receive the 40-bit datagram, CS line MUST stay Low for the complete transmission. Are you sure you meet this condition?
4 hours later… john16:56Thanks for the continued help on this, I appreciate it.Here’s the link to the product I bought: amazon.co.uk/gp/product/…john17:10It’s v3 version, SPI. I’ve checked the pins on the chip and there doesn’t seem to be a resistor/bridge at the SPI bit, or the CFG4 and CFG5 bits. I’m struggling to work out if that’s correct or not from their docs… grobotronics.com/images/…john175217:43I’m also not using TMC4… controllers, with no current sensing resistors. It’s straight out of the box config. I’ll upload my wiring diagram shortly just in case. I’ve also tried SPI config wirte/reads and I can change the config, and read it later in the code chain and my changes are saved, so I think SPI is working in that respect.I have a Raspberry PI Zero 2 W now too so I’ll try that later just in case the Pi is to blame. I’m running out of things I haven’t tried at this point. tlfong01688018:10Thanks for the updated info. I am still reading the references, and might give more comments later. I am glad that you are usning V3. It is good that you are not using TMC4xxx controller, and no sensing resistors. It makes things less complicated.Yes, good idea to use RpiZ2W for swap troubleshooting.Now I am making some reading summary.
Ah, locking up supper time. See you later. The last message was posted 4 hours ago.
Leave a Reply