Skip to content

Commit d32c18f

Browse files
committed
Increase cycle count for unoptimized cortex-m0
Cortex-M0 doesn't have 32bitx32bit=64bit multiplication instructions and can not use SCURVE use optimized path. Increasing to actual cycle count of 544 to hopefully improve stability of board as well as a form of documentation that people should consider disabling SCURVE feqature until the code is optimized for cortex-m0; Stepper::calc_timer_interval() use of division is also been identified as taking 126 cycles.
1 parent cd7fa1f commit d32c18f

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

Marlin/src/module/stepper.h

+15-3
Original file line numberDiff line numberDiff line change
@@ -76,18 +76,30 @@
7676
#define TIMER_READ_ADD_AND_STORE_CYCLES 34UL
7777

7878
// The base ISR takes 792 cycles
79-
#define ISR_BASE_CYCLES 792UL
79+
#if defined(STM32G0B1xx)
80+
#define ISR_BASE_CYCLES 928UL
81+
#else
82+
#define ISR_BASE_CYCLES 792UL
83+
#endif
8084

8185
// Linear advance base time is 64 cycles
8286
#if ENABLED(LIN_ADVANCE)
83-
#define ISR_LA_BASE_CYCLES 64UL
87+
#if defined(STM32G0B1xx)
88+
#define ISR_LA_BASE_CYCLES 200UL
89+
#else
90+
#define ISR_LA_BASE_CYCLES 64UL
91+
#endif
8492
#else
8593
#define ISR_LA_BASE_CYCLES 0UL
8694
#endif
8795

8896
// S curve interpolation adds 40 cycles
8997
#if ENABLED(S_CURVE_ACCELERATION)
90-
#define ISR_S_CURVE_CYCLES 40UL
98+
#if defined(STM32G0B1xx)
99+
#define ISR_S_CURVE_CYCLES 544UL
100+
#else
101+
#define ISR_S_CURVE_CYCLES 40UL
102+
#endif
91103
#else
92104
#define ISR_S_CURVE_CYCLES 0UL
93105
#endif

0 commit comments

Comments
 (0)