|
@@ -49,17 +49,17 @@
|
49
|
49
|
// currently officially supports).
|
50
|
50
|
#ifndef BOARD_RCC_PLLMUL
|
51
|
51
|
#if !USE_HSI_CLOCK
|
52
|
|
- #if F_CPU==128000000
|
53
|
|
- #define BOARD_RCC_PLLMUL RCC_PLLMUL_16
|
54
|
|
- #elif F_CPU==72000000
|
55
|
|
- #define BOARD_RCC_PLLMUL RCC_PLLMUL_9
|
56
|
|
- #elif F_CPU==48000000
|
57
|
|
- #define BOARD_RCC_PLLMUL RCC_PLLMUL_6
|
58
|
|
- #elif F_CPU==16000000
|
59
|
|
- #define BOARD_RCC_PLLMUL RCC_PLLMUL_2
|
60
|
|
- #endif
|
|
52
|
+ #if F_CPU==128000000
|
|
53
|
+ #define BOARD_RCC_PLLMUL RCC_PLLMUL_16
|
|
54
|
+ #elif F_CPU==72000000
|
|
55
|
+ #define BOARD_RCC_PLLMUL RCC_PLLMUL_9
|
|
56
|
+ #elif F_CPU==48000000
|
|
57
|
+ #define BOARD_RCC_PLLMUL RCC_PLLMUL_6
|
|
58
|
+ #elif F_CPU==16000000
|
|
59
|
+ #define BOARD_RCC_PLLMUL RCC_PLLMUL_2
|
|
60
|
+ #endif
|
61
|
61
|
#else
|
62
|
|
- #define BOARD_RCC_PLLMUL RCC_PLLMUL_16
|
|
62
|
+ #define BOARD_RCC_PLLMUL RCC_PLLMUL_16
|
63
|
63
|
#endif
|
64
|
64
|
#endif
|
65
|
65
|
|
|
@@ -83,33 +83,39 @@ namespace wirish {
|
83
|
83
|
rcc_set_prescaler(RCC_PRESCALER_AHB, RCC_AHB_SYSCLK_DIV_1);
|
84
|
84
|
rcc_set_prescaler(RCC_PRESCALER_APB1, RCC_APB1_HCLK_DIV_2);
|
85
|
85
|
rcc_set_prescaler(RCC_PRESCALER_APB2, RCC_APB2_HCLK_DIV_1);
|
86
|
|
- rcc_clk_disable(RCC_USB);
|
87
|
|
- #if F_CPU == 72000000
|
88
|
|
- rcc_set_prescaler(RCC_PRESCALER_USB, RCC_USB_SYSCLK_DIV_1_5);
|
89
|
|
- #elif F_CPU == 48000000
|
90
|
|
- rcc_set_prescaler(RCC_PRESCALER_USB, RCC_USB_SYSCLK_DIV_1);
|
91
|
|
- #endif
|
|
86
|
+ rcc_clk_disable(RCC_USB);
|
|
87
|
+#if F_CPU == 72000000
|
|
88
|
+ rcc_set_prescaler(RCC_PRESCALER_USB, RCC_USB_SYSCLK_DIV_1_5);
|
|
89
|
+#elif F_CPU == 48000000
|
|
90
|
+ rcc_set_prescaler(RCC_PRESCALER_USB, RCC_USB_SYSCLK_DIV_1);
|
|
91
|
+#endif
|
92
|
92
|
}
|
93
|
93
|
|
94
|
94
|
__weak void board_setup_gpio(void) {
|
|
95
|
+ /**
|
|
96
|
+ * PA14 is a pull up pin. But, some V5 boards it start with LOW state! And just behave properly when the Z- PROBE is actived at least once.
|
|
97
|
+ * So, if the sensor isnt actived, the PA14 pin will be forever in LOW state, telling Marlin the probe IS ALWAYS ACTIVE, that isnt the case!
|
|
98
|
+ * Chitu original firmware seems to start with every pullup PIN with HIGH to workaround this.
|
|
99
|
+ * So we are doing the same here.
|
|
100
|
+ * This hack only works if applied *before* the GPIO Init, it's the reason I did it here.
|
|
101
|
+ */
|
|
102
|
+ #ifdef CHITU_V5_Z_MIN_BUGFIX
|
|
103
|
+ GPIOA->regs->BSRR = (1U << PA14);
|
|
104
|
+ #endif
|
95
|
105
|
gpio_init_all();
|
96
|
106
|
}
|
97
|
107
|
|
98
|
108
|
__weak void board_setup_usb(void) {
|
99
|
|
-
|
100
|
|
-
|
101
|
|
-
|
102
|
109
|
#ifdef SERIAL_USB
|
103
|
110
|
#ifdef GENERIC_BOOTLOADER
|
104
|
|
- //Reset the USB interface on generic boards - developed by Victor PV
|
105
|
|
- gpio_set_mode(PIN_MAP[PA12].gpio_device, PIN_MAP[PA12].gpio_bit, GPIO_OUTPUT_PP);
|
106
|
|
- gpio_write_bit(PIN_MAP[PA12].gpio_device, PIN_MAP[PA12].gpio_bit,0);
|
|
111
|
+ // Reset the USB interface on generic boards - developed by Victor PV
|
|
112
|
+ gpio_set_mode(PIN_MAP[PA12].gpio_device, PIN_MAP[PA12].gpio_bit, GPIO_OUTPUT_PP);
|
|
113
|
+ gpio_write_bit(PIN_MAP[PA12].gpio_device, PIN_MAP[PA12].gpio_bit,0);
|
107
|
114
|
|
108
|
|
- for(volatile unsigned int i=0;i<512;i++);// Only small delay seems to be needed, and USB pins will get configured in Serial.begin
|
109
|
|
- gpio_set_mode(PIN_MAP[PA12].gpio_device, PIN_MAP[PA12].gpio_bit, GPIO_INPUT_FLOATING);
|
|
115
|
+ for (volatile unsigned int i = 0; i < 512; i++); // Only small delay seems to be needed, and USB pins will get configured in Serial.begin
|
|
116
|
+ gpio_set_mode(PIN_MAP[PA12].gpio_device, PIN_MAP[PA12].gpio_bit, GPIO_INPUT_FLOATING);
|
110
|
117
|
#endif
|
111
|
|
-
|
112
|
|
- Serial.begin();// Roger Clark. Changed SerialUSB to Serial for Arduino sketch compatibility
|
|
118
|
+ Serial.begin(); // Roger Clark. Changed SerialUSB to Serial for Arduino sketch compatibility
|
113
|
119
|
#endif
|
114
|
120
|
}
|
115
|
121
|
|
|
@@ -118,6 +124,5 @@ namespace wirish {
|
118
|
124
|
// interrupts work out of the box.
|
119
|
125
|
afio_init();
|
120
|
126
|
}
|
121
|
|
-
|
122
|
127
|
}
|
123
|
128
|
}
|