gin66 / FastAccelStepper

A high speed stepper library for Atmega 168/328p (nano), Atmega32u4, Atmega 2560, ESP32, ESP32S2, ESP32S3, ESP32C3, ESP32C6 and Atmel SAM Due
MIT License
308 stars 70 forks source link

esp32: time adherence measurements yields anomally #21

Closed gin66 closed 3 years ago

gin66 commented 3 years ago

Measurements by log from CuteCom line timestamps: M1 N A100000 V100 R600000 ...runs for 60s, OK M1 N A100000 V1000 R60000 ...runs for 60s,OK M1 N A100000 V4000 R15000 ...runs for 60s, OK For speed >= 4096us additional pauses are added. M1 N A100000 V4100 R14634 ...runs for 30s ??? M1 N A100000 V5000 R12000 ...runs for 30s ??? M1 N A100000 V10000 R6000 ...runs for 25s ??? M1 N A100000 V12000 R5000 ...runs for 20,5s ??? M1 N A100000 V15000 R4000 ...runs for 32,8s ??? M1 N A100000 V20000 R3000 ...runs for 37s ??? M1 N A100000 V100000 R600 ...runs for 56s ??? M1 N A100000 V100000 R600 ...runs for ~59,5s

All should yield 60s running time.

Stepper runs with V4100 much faster compared to V4000

gin66 commented 3 years ago

Problem is, that for step = 1 in the pcnt interrupt (at TEA aka timer=1) the mcpwm interrupt is enabled and in the same cycle at TEP executed. That execution load already the next command and the pause is effectively skipped.

Correct would be, that the mcpwm interrupt takes place one cycle later at TEP.

gin66 commented 3 years ago

Fixed in 0.16.0