-
-
Notifications
You must be signed in to change notification settings - Fork 19.2k
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
[2.0.x] Add L6470 SPI daisy chain support #12895
[2.0.x] Add L6470 SPI daisy chain support #12895
Conversation
a222f23
to
950f5c5
Compare
Some big assumptions:
|
374bb23
to
46d6737
Compare
I'm a maintainer of the Arduino-L6470 library. Should I do a formal release of 0.7.0? |
I modified the macros in |
Note that this PR breaks mixing, dual-x duplication mode, and other special extrusion modes for the L6470. To fix this the L6470 macros to enable/disable stepper drivers should be extended for all the extrusion modes. |
I think I've gotten the L6470 extruder macros setup so that the standard mixing extruder logic works correctly in a L6470 system. Bench testing shows that the new defines are working. Lots more testing to see if that's true in all cases. I'm going to try to squash the commits. |
Not yet. I need to do some more bench testing and then actually try a print before stating that it's ready for public consumption. |
I can't reproduce the Travis errors. Is Travis having problems? |
I've squashed and pushed the commits, so you can just do this:
|
The issue is weird. I'm trying a small change to see if it finally compiles. There was something else blocking it before this most recent "TMCTMC2130Stepper WTF" compile error. |
Thanks for all your work. To get it to compile for a L6470 driver I needed to fix a few syntax errors and had to revert the argument definitions in L6470_get_user_input. I'm trying to keep the steppers powered down after a reset. Currently configuration_store.cpp calls reset_stepper_drivers() which calls set_directions() which powers up the L6470s . About 1/2 second later they get disabled. To avoid that 1/2 second power up I've modified reset_stepper_drivers() to call set_directions() only if a TMC driver is in the system. Why does configuration_store.cpp call reset_stepper_drivers() ? Maybe there's a better way to accomplish the goal. |
37c92df
to
924a66c
Compare
Ok, so this is almost ready, but before it's merged the |
- Avoid L6470 library name conflict by another method
What??!!! How could you possibly think my amateur coding could be improved upon? 😉 |
Not much to improve, honestly! This is all pretty solid. The chain method is bound to be slow, so there's not much we can do about that. The L6470 library has some interesting qualities, like requiring the client app (Marlin) to define The way we would usually do it is to define the methods as pure-virtual, then require the client to make a sub-class Weird as it is, I guess it'll be ok for our purposes. |
Thanks for all your work. Much appreciated. As to the "weak link" method - I was expecting someone to come back and point me to a better method. Should I pursue making then a part of a class? |
This PR adds SPI daisy chain support for the L6470 stepper drivers. The following file contains an explanation of the hardware and software involved.
two_motors_synchronized.txt
Arduino-L6470 library revision 0.7.0 is required for this stepper driver. This library has not been released yet.
The L6470 drivers continue to operate in STEP_CLOCK mode. In this mode the direction and enable are done via SPI commands and the phase currents are changed in response to step pulses (generated in the usual way).
HARDWARE/SOFTWARE interaction
Powering up a stepper and setting the direction are done by the same command. Can't do one without the other.
All directions are set every time a new block is popped off the queue by the stepper ISR.
SPI transfers when setting the directions is minimized by using arrays and a SPI routine dedicated to this function. L6470 library calls are not used. For N L6470 drivers, this results in a N byte transfer. If library calls were used then N*N bytes would be sent.
Power up (reset) sequence:
Top level changes:
The numbering of the gcodes will probably change. I didn’t find anything comparable (except for M906) so the assignment of numbers was arbitrary.
The example configurations have only had the L6470 to ST_L6470 name changes done. I’ll update them once this PR has had some feedback.
Marlin/Configuration_adv.h
HAL_spi_L6470.cpp contains two SPIs and a pin init routine.
Marlin.cpp
drivers.h
Added the macro AXIS_IS_ST_L6470(A)
enum.h
Added L6470_driver_enum to provide unique names/indices for each of the 13 possible drivers.
macros.h
Defined macro UNUSED(x) to eliminate a compiler warning.
M114
Displays the absolute positions registers of the L6470 drivers during a M114 D. They should be within 1 of the counts for each axis.
G28
Set the absolute positions registers of the L6470 drivers to the counts for each axis after homing completes.
Added gcodes
Conditionals_post.h
Macro USE_EXECUTE_COMMANDS_IMMEDIATE modified to be true when there is a L6470 driver in the system. The M916-M918 routines use this feature to inject movement commands into the queue.
SanityCheck.h
[AXIS]_IS_L6470 is now check modified to use ST_L6470
L6470_Marlin.h
Contains all the non-library definitions needed to support the L6470 software.
L6470_Marlin.cpp
Contains the common code and data structures.
stepper.cpp
routine set_directions() modified to generate and xmit a buffer of L6470 commands to set each driver to the correct direction. This also enables the driver. In a N driver system this results in sending N bytes when setting/changing direction rather the N squared bytes.
stepper_indirection.cpp
stepper_indirection.h
UIpdated driver enable macros.
Misc changes
added date stamp to AutoBuild script
TO DO:
Add MIXING_EXTRUDER section for L6470 drivers to stepper_indirection.hDONE - created DIR_WRITE macros such that MIXING_EXTRUDER section did not have to be modified.MIXING_EXTRUDER doesn't matter to a L6470 system because all L6470 drivers always have direction set and enabled simultaneouslyWRONG - In some extruder systems the directions are not all the same for every extruder.Update example configurationsDONEUpdate pinsDebug_list.hDONETest in mixed driver system