microstep mode switch with TMC drivers...


Ken Hunter
 

I am trying to understand how to extract a signal from the SPI interface
in order to use it for mode switching an external driver.

For instance... When slewing I'd like to send a "mode change signal"
to the external driver for setting 8 microsteps, bypassing the dip switch.

On the Amazon TB6600 driver (which is actually using a TB67S109AFTG
Driver module to get 32 uSteps) I can switch from 32 to 8 uSteps by 
supplying 5V logic high to the M2 switch contact. How can I find a suitable
point on a MaxESP3 board for Axis 1 & 2 to get that signal during slewing?

Any ideas out there?


 

What you can do way easier is to use axis1 driver slot regularly, then from axis 2 use only MS1 pin regularly but MS2 connect from some unused pins on MCU (if any?) or from AXIS3 step pin if you dont use rotator and then redefine that single pin in config.h. I just did that with TMC2209 in standalone mode and I am able to use only one of these two modes: 8/32 or 16/64 (because MS1 pin is still shared). If you don't need MS3 (SP) pin maybe you can combine something with that.

For decoding SPI communication you need additional microcontroller that will be programmed to mitigate two serial slaves and then act accordingly (send signal to TB6600). This sounds easy on first though, but it's not because I think OnStep firmware will expect some information back from these slaves (dummy drivers), like status/ack messages etc


eugenecisneros
 

My view of the situation is as follows..  The SPI is a serial communication protocol that uses 4 wires.  It has a master and slave, the master being the microprocessor.  So, the master sends data and the slave answers back .. not sure if answer is required.  I would guess that you would need a receiver (slave) that would decipher the command and then generate a 3 or 4 bit digital output to select micro steps on an external controller.  
Perhaps there is an easier way and I hope that the experts will chime in with one.


George Cushing
 

I got an ad for one of these before. Might be worth a look for something like this.

image.png



 

Yeah, this is treasure, however on MaxESP3 only some combinations of modes will work because two out of three cfg pins are connected together and but if wisely connected this can be very usable.


Howard Dutton
 

On Sun, May 8, 2022 at 12:48 PM, Ken Hunter wrote:

On the Amazon TB6600 driver (which is actually using a TB67S109AFTG
Driver module to get 32 uSteps) I can switch from 32 to 8 uSteps by 
supplying 5V logic high to the M2 switch contact. How can I find a suitable
point on a MaxESP3 board for Axis 1 & 2 to get that signal during slewing?
Configure OnStep for the MaxESP3 like its has S109 drivers in axis1 and 2.

Change the pinmap as required so M2/CS (the dedicated unique pin) is mapped to the MS2 (M1 in OnStep lingo) pin for the driver (the only one that changes state between 8x and 32x modes.)

Whatever voltage level requirements etc. are needed for those pins interfacing directly to the drivers will need to be looked after.

// Axis1 RA/Azm step/dir driver
#define Axis1_EN             12     // Enable
#define Axis1_M0             13     // Microstep Mode 0 or SPI MOSI
#define Axis1_M1             23     // Microstep Mode 1 or SPI SCK (was 14 but is now the Axis1 CS pin)
#define Axis1_M2             14     // Microstep Mode 2 or SPI CS (was 23)
#define Axis1_M3           Aux2     // SPI MISO/Fault
#define Axis1_STEP           18     // Step
#define Axis1_DIR             0     // Dir
#define Axis1_DECAY    Axis1_M2     // Decay mode
#define Axis1_HOME         Aux3     // Sense home position

// Axis2 Dec/Alt step/dir driver
#define Axis2_EN         SHARED     // Enable pin control shared with Axis1
#define Axis2_M0             13     // Microstep Mode 0 or SPI MOSI
#define Axis2_M1              5     // Microstep Mode 1 or SPI SCK (was 14 but is now the Axis2 CS pin)
#define Axis2_M2             14     // Microstep Mode 2 or SPI CS (was 5)
#define Axis2_M3           Aux2     // SPI MISO/Fault
#define Axis2_STEP           27     // Step
#define Axis2_DIR            26     // Dir
#define Axis2_DECAY    Axis2_M2     // Decay mode
#define Axis2_HOME         Aux4     // Sense home position


Ken Hunter
 

That is what I am currently doing with the TM6600 External Driver but there is no
uStep change sent to the driver in slew/goto. That is what I am trying to add.

Maybe there is a way to set one of the MCU pins during a slew/goto?
A feature perhaps?


Ken Hunter
 
Edited

Thanks Howard...

I am confused... I see that you are swapping the M1 and M2 pins on the
stepper driver input pins but not sure that I haven't confused the issue above.

The TB6600 (generic description) has dip switch w/contacts labeled M1, M2,
and M3. that can provide the 32/8 uSteps shown here:

                   M1           M2          M3
32 uStep     Low         Low        Low  
  8 uStep     Low         High        Low

I'm looking for a pin that is High during Slew/Goto so that I can use it to switch the
External TB6600 driver to 8 uSteps.

I'll try those changes and see how close I get to finding the correct connection.


Howard Dutton
 

On Mon, May 9, 2022 at 11:36 PM, Ken Hunter wrote:
I'm looking for a pin that is High during Slew/Goto so that I can use it to switch the
External TB6600 driver to 8 uSteps.
I wasn't aware of that, but you could always invert the signal using a transistor.

Or, I guess you could use the SERVO1 driver type then.  The output is on M0 though, so the pinmap changes would be slightly different than I outlined below.


 

Then just set TMC2209_QUIET and your SP pin will be high or low when tracking or GoTo. In OnStepX that would be configurable by stealthchop/spreadcycle in extended congig...


Howard Dutton
 

As it happens a "SERVO1" like feature was added back to OnStepX recently:
https://github.com/hjd1964/OnStepX/pull/18

I just revisited that again and changed the default pin it toggles from M0 to M2, so we don't have this hassle going forward.

In OnStepX you use just the GENERIC driver.  M2 will go HIGH when slewing normally, but you can invert the signal in Config.defaults.h if you like (using AXIS1_M2_ON_STATE LOW for example.)

In OnStep (SERVO1) pretty sure you leave the _MICROSTEPS at 1 then specify the _MICROSTEPS_GOTO 4 to get the 4x larger steps.  This is reverse of how one normally specifies things with a stepper driver.

Even I am confused by that arrangement so in OnStepX those settings behave just as they do with any other stepper driver.  If one happens to have a servo (no microsteps) do what you have to as though it were a microstepping driver (for example if you have a "4x digital gearing" use 4x mode for tracking and 1x for slewing.)


Howard Dutton
 
Edited

On Tue, May 10, 2022 at 04:37 AM, Vladimir wrote:
Then just set TMC2209_QUIET and your SP pin will be high or low when tracking or GoTo. In OnStepX that would be configurable by stealthchop/spreadcycle in extended congig.
That won't work correctly as the internal step counts won't be right.  There are two kinds of "mode switches" in OnStep and OnStepX.

There is a decay mode switch right at the start and end of a slew (at very low speeds) and there is a microstep mode switch at "high" step rates.

For stepper drivers that don't interpolate, switching to the slewing microstep mode at low speeds causes more resonance and stalling so I don't do that.  On the other hand you shouldn't switch between TMC driver decay modes at high speeds so there you have it.