Problem with Speed adjustment using Sparkfun L6470

Hi everyone, I am struggling with Sparkfun L6470 step motor code. It cannot adjust speed from this code. I try to adjust the code at setMaxSpeed, setFullSpeed, setACC, but it doesn't work as the motor still runs at the same speed as previous.

Here is the drawn schematic;

Here is the code;

#include <SparkFunAutoDriver.h>
#include <SparkFundSPINConstants.h>

#include <SparkFunAutoDriver.h>
#include <SPI.h>


AutoDriver boardA(0, 10, 7);

void setup()
{
  Serial.begin(9600);
  Serial.println("Hello world");  
  // Start by setting up the SPI port and pins. The
  //  Autodriver library does not do this for you!
  pinMode(7, OUTPUT);
  pinMode(MOSI, OUTPUT);
  pinMode(MISO, INPUT);
  pinMode(13, OUTPUT);
  pinMode(10, OUTPUT);
  digitalWrite(10, HIGH);
  digitalWrite(7, LOW);       // This low/high is a reset of the L6470 chip on the
  digitalWrite(7, HIGH);      //  Autodriver board, and is a good thing to do at
                              //  the start of any Autodriver sketch, to be sure
                              //  you're starting the Autodriver from a known state.
  SPI.begin();
  SPI.setDataMode(SPI_MODE3);
  dSPINConfig();  
}

void loop()
{
 Serial.println("FWD"); 
 boardA.run(FWD, 5000);
 delay(1000);
 Serial.println(boardA.getPos()); 
}

void dSPINConfig(void)
{
  boardA.configSyncPin(BUSY_PIN,8);// BUSY pin low during operations;
                                    //  second paramter ignored.
  boardA.configStepMode(STEP_FS_128);   // 8 microsteps per step
  boardA.setMaxSpeed(128);        // 5000 steps/s max
  boardA.setFullSpeed(64);       // microstep below 5000 steps/s
  boardA.setMinSpeed(0);
  boardA.setAcc(5000);             // accelerate at 5000 steps/s/s
  boardA.setDec(5000);
  boardA.setSlewRate(SR_530V_us);   // Upping the edge speed increases torque.
  boardA.setOCThreshold(OC_750mA);  // OC threshold 750mA
  boardA.setPWMFreq(PWM_DIV_2, PWM_MUL_2); // 31.25kHz PWM freq
  boardA.setOCShutdown(OC_SD_DISABLE); // don't shutdown on OC
  boardA.setVoltageComp(VS_COMP_DISABLE); // don't compensate for motor V
  boardA.setSwitchMode(SW_USER);    // Switch is not hard stop
  boardA.setOscMode(INT_16MHZ_OSCOUT_16MHZ); // for boardA, we want 16MHz
  boardA.setAccKVAL(255);           // We'll tinker with these later, if needed.
  boardA.setDecKVAL(255);
  boardA.setRunKVAL(255);
  boardA.setHoldKVAL(32);           // This controls the holding current; keep it low.

I would appreciate any help
Regards, Slimes

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.