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

Add shared UART with analog commutator and ChipSelect pin #2

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

byebyedizzy
Copy link

Small patch to enable use of shared UART with analog commutator like 77HC4066 for multiple TMC2208 drivers. This might be suitable for platforms like Arduino Due which don't have software UART library implementations.
In this scenario drivers should be connected as shown on TMC2208 datasheet (https://www.trinamic.com/fileadmin/assets/Products/ICs_Documents/TMC220x_TMC222x_Datasheet.pdf), page 22, figure 4.2. And ChipSelect pins (port pins in the datasheet) should be defined and used in TMC2208Stepper class constructors.
Examples compile for both avr and due architectures, so I guess, that "avr-only" limitation can be shifted.

@teemuatlut
Copy link
Owner

Looks good. I'll merge it soon and then make some minor stylistic changes.

@byebyedizzy
Copy link
Author

I'm testing this patch with Arduino Due, 74HC4066, 74HC125 and a bunch of 2208 (4 pieces). That turned out to be more tricky than I expected, so please postpone merge a little bit ...
My guess is that additional buffer (74hc125) may affect reading from drivers, so I have to investigate the matter. I will let know of the result.

@byebyedizzy
Copy link
Author

byebyedizzy commented Jan 2, 2018

Well, preliminary tests (like in examples folder) on Arduino Due are over and successfull. Though I have to admit, that wasted 3 days just because though that if function returns boolean then it is an indicator whether it succeeds or no. But turned out that it's not always true :). I'm talking about functions that read driver's registers and return 0 if CRC is ok and 1 otherwise. May be this should be clarified in the readme ?

@teemuatlut
Copy link
Owner

I believe it's quite common for 0 to be "ok" and then 1, 2, 3.. to be different errors.
Anyway, the TMC2208 behavior will be changed to conform to the TMC2130Stepper for the universal TMCStepper library.

@byebyedizzy
Copy link
Author

Well, I assumed (as per readme) that boolean true == CRC is okay.
But speaking of universal library - do you plan to merge this PR or will (or will not) integrate the code for shared UART in the universal library ? And when are you going to release this new library ? The thing is - I want to use 2208 drivers and shared UART on Due with Marlin (and send a PR to Marlin for that) and this will not be possible until you merge this PR ...

@teemuatlut
Copy link
Owner

The TMCStepper is already pushed on github but it's still WIP and I haven't added it to the Arduino Library Manager. At first I aim to support TMC2130, TMC5130 and TMC2660. Then TMC2208 and TMC2224 come after because they use UART instead of SPI. The new library will support everything the old ones do but the interface will change a bit for UART communication.
It'll be some months before everything is nicely set up with it and the old libraries will of course be available. It's mostly a matter of where I will put my effort and where new features will be made. Also when it's working properly, Marlin will also change to that.

I can merge this later this week and it'll also be part of the TMCStepper library in the future.

@byebyedizzy
Copy link
Author

My fault - I'm new to github and mistook "popular" for "all" repos. Will look forward for new library!
Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants