Controlling the AMIS-30543 Stepper Motor Carrier

I’m trying to utilize the multiple slave feature with the AMIS-30543 chip. I read a similar forum post from a year ago, but wasn’t able to figure it out myself from the response.

I’d like to be able to send and receive commands from one device and switch to another, which should be doable with SPI. The issue that I get is that both drivers are listening and both stepper motors move. I have the code such that each motor is governed by a separate object, however the step function

void step()

fires commands off to both motors. I have tried

void stepper1.step()

but step is not part of the AMIS library so it has no clue what to do. Where is step from? I pulled this function out of the AMIS-30543 example code as:

void step()
{
// The NXT/STEP minimum high pulse width is 2 microseconds.
digitalWrite(amisStepPin, HIGH);
delayMicroseconds(3);
digitalWrite(amisStepPin, LOW);
delayMicroseconds(3);

// The delay here controls the stepper motor’s speed. You can
// increase the delay to make the stepper motor go slower. If
// you decrease the delay, the stepper motor will go fast, but
// there is a limit to how fast it can go before it starts
// missing steps.
delayMicroseconds(2000);
}

I don’t know how to use the AMIS30543 object in conjunction with some function to step a single motor rather than both.

My code: Code.txt (4.1 KB)

This code will at the moment, move the motors simultaneously. For example I’d like to move one motor on its own for the first move, then move the other motor on its own for the second move [the step functions towards the end of the program]. Really all I need to know is how to send step commands to only a single motor.

Thanks for any help,
-Simon

Hello, Simon.

The AMIS-30543 cannot be stepped over SPI; you must use its STEP pin. Also, the CS pin on the driver only enables the driver to receive SPI commands and does not affect signaling on the STEP pin. It sounds like you might have both drivers connected via the same STEP pin. Using separate I/O pins for the STEP pins on the two drivers should allow you to step independently.

Also, from your code, it looks like you might be using the same DIR pin as well. Toggling that pin will change the direction of both motors at the same time. You might consider using separate DIR pins, though it is also possible to leave the DIR pins disconnected and then use the AMIS30543.setDirection(bool value) function (over SPI) to change the direction instead.

-Nathan

Thanks Nathan,

For anyone reading this in the future - the pinout on my Arduino Mega 2560 is:

STEP_M1 = 46;
STEP_M2 = 47;
SS_M1 = 48;
SS_M2 = 49;

(along with all the other SPI stuff)

Then I have two objects:

AMIS30543 stepper1;
AMIS30543 stepper2;

And there are two separate step functions which use the different step pins, but are otherwise identical. Direction is controlled via SPI. Example:

stepper1.setDirection(1);

1 Like

I am glad to hear that you got it working. Thanks for letting us know what you did.

-Nathan