Small timer improvements

backlash
Patrick Felixberger 2018-05-15 21:21:32 +02:00
rodzic 8695d0b40c
commit 3752f50f35
5 zmienionych plików z 19 dodań i 13 usunięć

Wyświetl plik

@ -136,7 +136,7 @@
<Cursor1 position="817" topLine="0" />
</Cursor>
</File>
<File name="grbl\SpindleControl.c" open="1" top="1" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="grbl\SpindleControl.c" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="978" topLine="12" />
</Cursor>
@ -236,9 +236,9 @@
<Cursor1 position="1804" topLine="35" />
</Cursor>
</File>
<File name="HAL\STM32\system_stm32f4xx.c" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="HAL\STM32\system_stm32f4xx.c" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="37669" topLine="765" />
<Cursor1 position="7910" topLine="148" />
</Cursor>
</File>
<File name="HAL\STM32\system_stm32f4xx.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
@ -256,9 +256,9 @@
<Cursor1 position="1130" topLine="9" />
</Cursor>
</File>
<File name="HAL\TIM\TIM.c" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="HAL\TIM\TIM.c" open="1" top="1" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="810" topLine="10" />
<Cursor1 position="3181" topLine="67" />
</Cursor>
</File>
<File name="HAL\TIM\TIM.h" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
@ -288,7 +288,7 @@
</File>
<File name="main.c" open="1" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1975" topLine="41" />
<Cursor1 position="2489" topLine="35" />
</Cursor>
</File>
<File name="SPL\inc\stm32f4xx_cryp.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">

Wyświetl plik

@ -90,7 +90,7 @@ void TIM9_Init(void)
TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_Low;
TIM_OC1Init(TIM9, &TIM_OCInitStructure);
TIM_OC1PreloadConfig(TIM9, TIM_OCPreload_Disable);
TIM_OC1PreloadConfig(TIM9, TIM_OCPreload_Enable);
/* Enable the TIM9 global Interrupt */
NVIC_InitStructure.NVIC_IRQChannel = TIM1_BRK_TIM9_IRQn;

Wyświetl plik

@ -281,7 +281,7 @@
// step rate is strictly limited by the CPU speed and will change if something other than an AVR running
// at 16MHz is used.
// NOTE: For now disabled, will enable if flash space permits.
// #define MAX_STEP_RATE_HZ 30000 // Hz
#define MAX_STEP_RATE_HZ 50000 // Hz
// By default, Grbl sets all input pins to normal-high operation with their internal pull-up resistors
// enabled. This simplifies the wiring for users by requiring only a switch connected to ground,

Wyświetl plik

@ -66,6 +66,12 @@
error "AMASS must have 1 or more levels to operate correctly."
#endif
#ifdef MAX_STEP_RATE_HZ
#define STEP_TIMER_MIN (uint16_t)(24000000UL / MAX_STEP_RATE_HZ)
#else
#define STEP_TIMER_MIN (uint16_t)(50000)
#endif
// Stores the planner block Bresenham algorithm execution data for the segments in the segment
// buffer. Normally, this buffer is partially in-use, but, for the worst case scenario, it will
@ -358,8 +364,8 @@ void Stepper_MainISR(void)
// Initialize step segment timing per step and load number of steps to execute.
// Limit ISR to 30 KHz
if(st.exec_segment->cycles_per_tick < 667) {
st.exec_segment->cycles_per_tick = 667;
if(st.exec_segment->cycles_per_tick < STEP_TIMER_MIN) {
st.exec_segment->cycles_per_tick = STEP_TIMER_MIN;
}
TIM9->ARR = st.exec_segment->cycles_per_tick;

Wyświetl plik

@ -33,9 +33,9 @@
#define DEFAULT_X_STEPS_PER_MM 400.0
#define DEFAULT_Y_STEPS_PER_MM 400.0
#define DEFAULT_Z_STEPS_PER_MM 400.0
#define DEFAULT_X_MAX_RATE 600.0 // mm/min
#define DEFAULT_Y_MAX_RATE 600.0 // mm/min
#define DEFAULT_Z_MAX_RATE 600.0 // mm/min
#define DEFAULT_X_MAX_RATE 900.0 // mm/min
#define DEFAULT_Y_MAX_RATE 900.0 // mm/min
#define DEFAULT_Z_MAX_RATE 900.0 // mm/min
#define DEFAULT_X_ACCELERATION (10.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2
#define DEFAULT_Y_ACCELERATION (10.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2
#define DEFAULT_Z_ACCELERATION (10.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2