Phenomenon
With the I2S stream enabled, the motor moves about three times as fast as the RMT step.
Reproduce steps:
1. change parameters for reproduce
$Stepper/Pulse=5
$Stepper/IdleTime=255
$X/StepsPerMm=5120.000
$X/MaxRate=1000.000
$X/Acceleration=1.000
$X/MaxTravel=300.000
2. move X axis 1 mm with F500
G0X1F500
The expected processing time is about 2.037s.
The actual processing time is about 0.75s, which is about three times faster.
Root cause
I completely misunderstood the calculation of the interruption interval.
I had assumed that the alarm_val used in the interrupt setting was μs/min.
The actual units were ticks/interupt.
For example (alarm_val = 32,549):
Correct value
1 / 20,000,000 * 32,549 = 0.00162745 s/int
Incorrectly calculated value(Approximately 1/3 of correct value):
32,549 / 60 / 10,000,000 = 0.00054248 s/int
Fix
Change to calculate the correct μsec interval from the tick value.
After the fix, I2S steps now generate a pulse similar to RMT steps when using I2S streams.
RMT steps:
!RMTPLW4IDL255_G0X1F500
I2S stream steps:
!I2SSTREAMPLW5IDL255G0X1F500
Acknowledgments
I would like to thank jesse schoch and William Curry for reporting on the issue.
I also thanks Mitch Bradley and Bart Dring for their help in investigating the cause of the problem.
#1 – MitchBradley 于 2020-08-08
I rebased this onto the new directory structure where nearly everything is under src/ and applied it.