a cycle's pwm train maight have been too long and run into the start of next cycle's pwm train. That's gone now and it seems to work.

A more brilliant solution is needed for this.
This commit is contained in:
Hakan Bastedt
2024-02-11 19:55:40 +01:00
parent c04ac0e74b
commit f4a15afa8a
4 changed files with 46 additions and 27 deletions

View File

@@ -21,7 +21,8 @@ public:
HardwareTimer *startTimer; // 10,11,13,14
uint8_t dirPin;
PinName stepPin;
const float Tjitter = 5.0; // Time unit is microseconds
const float Tjitter = 500.0; // Time unit is microseconds
uint64_t dbg;
public:
volatile double_t commandedPosition; // End position when this cycle is completed
@@ -37,7 +38,7 @@ public:
StepGen2(TIM_TypeDef *Timer, uint32_t _timerChannel, PinName _stepPin, uint8_t _dirPin, void irq(void), TIM_TypeDef *Timer2, void irq2(void));
uint32_t handleStepper(void);
uint32_t handleStepper(uint64_t irqTime/* time for irq nanosecs */);
void startTimerCB();
void pulseTimerCB();
uint32_t updatePos(uint32_t i);