Works really nice now. 20 usecs base period => 50 kHz, 25 kHz pulse freq.
This commit is contained in:
@@ -146,7 +146,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
// For the example
|
// For the example
|
||||||
#define BASE_PERIOD 40000
|
#define BASE_PERIOD 20000
|
||||||
#define SERVO_PERIOD 2000000
|
#define SERVO_PERIOD 2000000
|
||||||
#define JOINT_X_STEPGEN_MAXACCEL 0.0
|
#define JOINT_X_STEPGEN_MAXACCEL 0.0
|
||||||
#define JOINT_Z_STEPGEN_MAXACCEL 0.0
|
#define JOINT_Z_STEPGEN_MAXACCEL 0.0
|
||||||
|
|||||||
@@ -62,11 +62,11 @@ void syncWithLCNC()
|
|||||||
deltaSyncTime = syncTime - prevSyncTime;
|
deltaSyncTime = syncTime - prevSyncTime;
|
||||||
deltaMakePulsesCnt = makePulsesCnt - prevMakePulsesCnt;
|
deltaMakePulsesCnt = makePulsesCnt - prevMakePulsesCnt;
|
||||||
prevMakePulsesCnt = makePulsesCnt;
|
prevMakePulsesCnt = makePulsesCnt;
|
||||||
Step->updateStepGen(pos_cmd1, pos_cmd2); // Update positions
|
Step->updateStepGen(pos_cmd1, pos_cmd2); // Update positions
|
||||||
Step->makeAllPulses(); // Make first step right here
|
Step->makeAllPulses(); // Make first step right here
|
||||||
basePeriodCnt = SERVO_PERIOD / BASE_PERIOD; //
|
basePeriodCnt = SERVO_PERIOD / BASE_PERIOD; //
|
||||||
baseTimer->refresh(); //
|
baseTimer->refresh(); //
|
||||||
baseTimer->resume(); // Make the other steps in ISR
|
baseTimer->resume(); // Make the other steps in ISR
|
||||||
// baseTimer->isRunning();
|
// baseTimer->isRunning();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -220,7 +220,7 @@ void setup(void)
|
|||||||
baseTimer = new HardwareTimer(TIM11); // The base period timer
|
baseTimer = new HardwareTimer(TIM11); // The base period timer
|
||||||
uint32_t usecs = BASE_PERIOD / sync0CycleTime;
|
uint32_t usecs = BASE_PERIOD / sync0CycleTime;
|
||||||
// setFrequencyAdjustedMicrosSeconds(baseTimer, usecs);
|
// setFrequencyAdjustedMicrosSeconds(baseTimer, usecs);
|
||||||
baseTimer->setOverflow(35, MICROSEC_FORMAT);
|
baseTimer->setOverflow(BASE_PERIOD / 1000, MICROSEC_FORMAT);
|
||||||
baseTimer->attachInterrupt(basePeriodCB);
|
baseTimer->attachInterrupt(basePeriodCB);
|
||||||
|
|
||||||
syncTimer = new HardwareTimer(TIM3); // The Linuxcnc servo period sync timer
|
syncTimer = new HardwareTimer(TIM3); // The Linuxcnc servo period sync timer
|
||||||
|
|||||||
Reference in New Issue
Block a user