Teensy4.1 to AMIS-30543 to Nema17

RaspianDesign

New member
Hello, I am very new to all this stuff and I'm working on a project. I have a raspberry pi 4 that has a custom GUI, the PI is connected to a teensy4.1 which is connected to a AMIS-30543 to drive a Nema17 stepper motor (specifically the MLS17A15-M06060S20300N-A000-RS2).

Can someone please walk me through the connections via pins for these to communicate properly? I have the teensy connected to the Arduino IDE and am able to add code to it.
I am doing something wrong because I've tried a test program and the motor isn't moving.

Currently: From the motor to the driver (blue-MXP, Red-MXN, Green-MYP, Black-MYN). From driver to teensy (NXT-2, DIR-3, DO-11, CLK-13, CS-10, GND-GND).
I provide photos if it would help as well. Thank you
 
Please supply connection photo and code.
When adding code use the </> button.
#include <SPI.h>

// Pin definitions (adjust if needed)
#define STEP_PIN 2
#define DIR_PIN 3
#define CS_PIN 10 // Chip Select for SPI
// If you have extra pins like CLR or SLA on the Teensy, define them too.
// e.g. #define CLR_PIN 5; #define SLA_PIN 6; etc., then drive them HIGH or LOW in setup().

void setup() {
Serial.begin(115200);
while(!Serial); // Wait for Serial Monitor

// Configure STEP and DIR as outputs
pinMode(STEP_PIN, OUTPUT);
pinMode(DIR_PIN, OUTPUT);
digitalWrite(DIR_PIN, LOW); // set an initial direction

// If you have an EN, CLR, or SLA pin connected, configure them:
// pinMode(CLR_PIN, OUTPUT);
// digitalWrite(CLR_PIN, HIGH); // for example, if CLR must be high to run

// Set up SPI pins
pinMode(CS_PIN, OUTPUT);
digitalWrite(CS_PIN, HIGH); // deactivate device (CS is active low)

// Initialize SPI
SPI.begin();
// We pick some default settings: 1 MHz, MSB first, SPI mode 0
SPI.beginTransaction(SPISettings(1000000, MSBFIRST, SPI_MODE0));

Serial.println("Setup complete. Attempting dummy SPI write...");

// ------------------------------------------------------------------
// DUMMY SPI WRITE: We don't know the actual register addresses or data
// for md27a 0J8863. This is just an example of how you'd do it.
// ------------------------------------------------------------------
digitalWrite(CS_PIN, LOW); // Select the driver
// Suppose register 0x01 sets microstepping, just as a placeholder:
SPI.transfer(0x01); // send register address
SPI.transfer(0x55); // send some arbitrary data
digitalWrite(CS_PIN, HIGH); // Deselect the driver

// If there's a status register to read, you'd do something like:
// digitalWrite(CS_PIN, LOW);
// SPI.transfer(0x80 | 0x01); // hypothetical read command, or read from 0x01
// uint8_t status = SPI.transfer(0x00);
// digitalWrite(CS_PIN, HIGH);
// Serial.print("Status: 0x"); Serial.println(status, HEX);

// End the SPI transaction
SPI.endTransaction();

Serial.println("Dummy SPI write done. Stepping in loop...");
}

void loop() {
// Generate a step pulse to see if the motor moves
digitalWrite(STEP_PIN, HIGH);
delayMicroseconds(800);
digitalWrite(STEP_PIN, LOW);
delayMicroseconds(800);

// ~600 steps/second with 800us high + 800us low
}
 
Back
Top