Skip to content
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

TMC2130 drivers not working with Arduino Due MCU #435

Closed
jakep82 opened this issue Jun 28, 2018 · 27 comments
Closed

TMC2130 drivers not working with Arduino Due MCU #435

jakep82 opened this issue Jun 28, 2018 · 27 comments

Comments

@jakep82
Copy link
Collaborator

jakep82 commented Jun 28, 2018

I'm using an OULWare board (http://www.oulware.org/index.php/Printer_Controller) with a Due as the MCU. I have everything working except my TMC2130 drivers on X and Y. I've tested these same pin definitions on Cruwaller's fork and they work fine there, but I'm unable to get these drivers to work on the main Klipper branch. G28 for X and Y simply times out with no movement or indication that the drivers have initialized. Perhaps I'm doing something wrong? Log file attached.

klippy.log

@StefanMeGit
Copy link

Same for me... has anybody the TMC2130 running with SPI on the DUE with Klipper?

@jakep82
Copy link
Collaborator Author

jakep82 commented Jun 29, 2018

My TMC2130 drivers work fine with the DUE on the Cruwaller fork of Klipper, but I would really like to run the main branch. I assume it's something simple, but I haven't been able to figure it out.

@StefanMeGit
Copy link

U can acknowledge that the main branch is not working with SPI?

@jakep82
Copy link
Collaborator Author

jakep82 commented Jun 29, 2018

If I run the Cruwaller fork my drivers work fine with SPI. If I run the main branch with the appropriate changes to printer.cfg but the same driver and CS pin definitions, the drivers do not work with SPI.

@StefanMeGit
Copy link

@KevinOConnor do you have any idea? Did it maybe never worked with the DUE?

@jakep82
Copy link
Collaborator Author

jakep82 commented Jun 29, 2018

For reference, this is the basic config file that works on the Cruwaller fork.

oulware.cfg.txt

@hg42
Copy link

hg42 commented Jun 30, 2018

@jakep82 could you provide a log of such a non-working session?
Kevin cannot do much without real facts.

What means "do not work"?
There are a lot of possibilities.
No movement at all?
Or some unexpected behavior?
etc.
To be sure, you know that cruwaller's config differs a lot from Kevin's?

@KevinOConnor
Copy link
Collaborator

KevinOConnor commented Jun 30, 2018 via email

@KevinOConnor
Copy link
Collaborator

FYI, I've pushed the new DUMP_TMC command to the master branch and I have removed the work-tmc2130-debug-20180630 branch.

-Kevin

@jakep82
Copy link
Collaborator Author

jakep82 commented Jun 30, 2018

All it returns is missing stepper.

Recv: !! Error on 'dump_tmc': missing STEPPER

@BlackStump
Copy link
Contributor

@jakep82 I notice in your config you use ; to comment out instead of #
example
[stepper_y]
driver: tmc2130_y
;driver: drv8825_y

I dont know if that is correct maybe it is, I only see in configs the use of # to comment a line out

@AxMod3DPrint
Copy link
Contributor

AxMod3DPrint commented Jul 1, 2018

Just as a note with dump_tmc

The command format is dump_tmc stepper=<stepper_name_in_config> eg: dump_tmc stepper=stepper_x - see https://github.com/KevinOConnor/klipper/docs/G-Codes.md

Also as a note, if your TMC drivers are not working issue a RESTART on the console. That seems to kick mine back into life if they're refusing to move. It may well be there's an SPI issue that underlies this, as I'm having to do that a fair bit, but it's also possible that the Ubuntu ZBox server that that particular printer is connected to is a bit on the warm side so it could be that also on my side. 26°c plus rooms are not good for computers..

@KevinOConnor
Copy link
Collaborator

KevinOConnor commented Jul 1, 2018 via email

@jakep82
Copy link
Collaborator Author

jakep82 commented Jul 1, 2018

Results below. I've tried restart, firmware_restart, changing my power up sequence, etc. Nothing seems to give me functioning drivers for X and Y.

Send: DUMP_TMC STEPPER=stepper_x
Recv: // GCONF: 0
Recv: // GSTAT: 0
Recv: // IOIN: 1000000
Recv: // TSTEP: 4000000
Recv: // XDIRECT: 12000000
Recv: // MSCNT: 2d000000
Recv: // MSCURACT: 6a000000
Recv: // CHOPCONF: 6b000000
Recv: // DRV_STATUS: 6c000000
Recv: // PWM_SCALE: 6f000000
Recv: // LOST_STEPS: 71000000
Recv: ok
[...]
Send: DUMP_TMC STEPPER=stepper_y
Recv: // GCONF: 0
Recv: // GSTAT: 0
Recv: // IOIN: 1000000
Recv: // TSTEP: 4000000
Recv: // XDIRECT: 12000000
Recv: // MSCNT: 2d000000
Recv: // MSCURACT: 6a000000
Recv: // CHOPCONF: 6b000000
Recv: // DRV_STATUS: 6c000000
Recv: // PWM_SCALE: 6f000000
Recv: // LOST_STEPS: 71000000
Recv: ok

@jakep82
Copy link
Collaborator Author

jakep82 commented Jul 1, 2018

After attempting to home X, the GCONF value changes, but I get no movement on either stepper.

Send: G28 X0
Recv: !! Failed to home x: Timeout during endstop homing
Recv: ok
[...]
Send: DUMP_TMC STEPPER=stepper_x
Recv: // GCONF: 209609
Recv: // GSTAT: 0
Recv: // IOIN: 1000000
[...]
Recv: // TSTEP: 4000000
Recv: // XDIRECT: 12000000
Recv: // MSCNT: 2d000000
Recv: // MSCURACT: 6a000000
Recv: // CHOPCONF: 6b000000
Recv: // DRV_STATUS: 6c000000
Recv: // PWM_SCALE: 6f000000
Recv: // LOST_STEPS: 71000000
Recv: ok
[...]
Send: DUMP_TMC STEPPER=stepper_y
Recv: // GCONF: 73000000
Recv: // GSTAT: 0
Recv: // IOIN: 1000000
Recv: // TSTEP: 4000000
Recv: // XDIRECT: 12000000
Recv: // MSCNT: 2d000000
Recv: // MSCURACT: 6a000000
Recv: // CHOPCONF: 6b000000
Recv: // DRV_STATUS: 6c000000
Recv: // PWM_SCALE: 6f000000
Recv: // LOST_STEPS: 71000000
Recv: ok

@AxMod3DPrint
Copy link
Contributor

Random question, have you tried upping the current to the drivers as a test?

@jakep82
Copy link
Collaborator Author

jakep82 commented Jul 1, 2018

Changing the current makes no difference. I've tried setting the run and hold currents to 1 amp. I've also tried reducing the stealthchop threshold. The drivers simply don't initialize, and I get zero indication of movement or power to the motors.

@AxMod3DPrint
Copy link
Contributor

The fact you are getting values back from dump_tmc means they are getting powered and your CS pins are correct you'd be getting 0 for everything. Klipper seems to be doing what it should be. I'd suggest checking your pin out and wiring, if you've not already.

@StefanMeGit
Copy link

StefanMeGit commented Jul 2, 2018

I run my DUE now without the TMC2130 and need the printer for some parts. Tomorrow I ok get a new due and will go in with some test to verify jakep82 problems.

My last tests also didn’t power up the motors (no click if I try to move the motors for the fist time) like death drivers. No movement at all. On my MKS Board i didn’t had that problem before. They worked as aspected.

@KevinOConnor
Copy link
Collaborator

KevinOConnor commented Jul 2, 2018 via email

@jakep82
Copy link
Collaborator Author

jakep82 commented Jul 2, 2018

I was running his OULWare specific fork at the link. I'll try the 2 things you mentioned tonight and see how it goes.

https://github.com/OULWare/klipper

@jakep82
Copy link
Collaborator Author

jakep82 commented Jul 3, 2018

I tried both of these things and neither worked. I'm going to boot back into the OULWare/Cruwaller SD card I have and make sure the drivers are still working, but last time I checked they still worked on his fork. Not sure why they aren't working here.

@jakep82
Copy link
Collaborator Author

jakep82 commented Jul 3, 2018

I switched back to the OULWare fork, and the drivers are working perfectly there. Not sure why they work there, but not on the main Klipper branch. The pin definitions are the same, and I think I have everything else set up correctly in my printer.cfg file for the main branch.

@KevinOConnor
Copy link
Collaborator

KevinOConnor commented Jul 4, 2018 via email

@jakep82
Copy link
Collaborator Author

jakep82 commented Jul 4, 2018

After changing the SPI rate to 100000 and restarting Klipper I get the info below. I don't have a thermocouple.

Send: dump_tmc stepper=stepper_x
Recv: // GCONF: 4924efcc
Recv: // GSTAT: 80000000
Recv: // IOIN: 40000000
Recv: // TSTEP: 4000000
Recv: // XDIRECT: 12000000
Recv: // MSCNT: 2d000000
Recv: // MSCURACT: 6a000000
Recv: // CHOPCONF: 6b000000
Recv: // DRV_STATUS: 6c000000
Recv: // PWM_SCALE: 6f000000
Recv: // LOST_STEPS: 71000000
Recv: ok
[...]
Send: dump_tmc stepper=stepper_y
Recv: // GCONF: 249277e6
Recv: // GSTAT: 0
Recv: // IOIN: 1000000
Recv: // TSTEP: 4000000
Recv: // XDIRECT: 12000000
Recv: // MSCNT: 2d000000
Recv: // MSCURACT: 6a000000
Recv: // CHOPCONF: 6b000000
Recv: // DRV_STATUS: 6c000000
Recv: // PWM_SCALE: 6f000000
Recv: // LOST_STEPS: 71000000

On the OULWare branch the output of git describe --tags is below.

pi@octopi:~/klipper $ git describe --tags
v0.5.0-301-g2925618

@KevinOConnor
Copy link
Collaborator

If you pull the latest code and reflash the micro-controller, does it help?

If it does not help, could you try disabling the thermocouple in your oulware branch and see if that has any impact on the oulware operation?

-Kevin

@jakep82
Copy link
Collaborator Author

jakep82 commented Jul 6, 2018

This fixed it! Thanks for looking into this issue. I've got my drivers running with sensorless homing now. I'm about to do a test print, but everything seems 100% functional so I'm going to close this issue.

@jakep82 jakep82 closed this as completed Jul 6, 2018
@github-actions github-actions bot locked and limited conversation to collaborators Dec 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants