Works really nice now. 20 usecs base period => 50 kHz, 25 kHz pulse freq.

This commit is contained in:
Hakan Bastedt
2024-04-07 21:45:53 +02:00
parent 544dd5ed85
commit ab1a306d86
2 changed files with 7 additions and 7 deletions

View File

@@ -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

View File

@@ -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