My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

variant.cpp 7.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. /*
  2. *******************************************************************************
  3. * Copyright (c) 2017, STMicroelectronics
  4. * All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted provided that the following conditions are met:
  8. *
  9. * 1. Redistributions of source code must retain the above copyright notice,
  10. * this list of conditions and the following disclaimer.
  11. * 2. Redistributions in binary form must reproduce the above copyright notice,
  12. * this list of conditions and the following disclaimer in the documentation
  13. * and/or other materials provided with the distribution.
  14. * 3. Neither the name of STMicroelectronics nor the names of its contributors
  15. * may be used to endorse or promote products derived from this software
  16. * without specific prior written permission.
  17. *
  18. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  19. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  20. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  21. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  22. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  23. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  24. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  25. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  26. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  27. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  28. *******************************************************************************
  29. */
  30. #include "pins_arduino.h"
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34. #if defined(ARDUINO_STEVAL)
  35. // Pin number
  36. // This array allows to wrap Arduino pin number(Dx or x)
  37. // to STM32 PinName (PX_n)
  38. const PinName digitalPin[] = {
  39. PA_9, // TX
  40. PA_10, // RX
  41. // WIFI
  42. PD_3, // CTS
  43. PD_4, // RTS
  44. PD_5, // TX
  45. PD_6, // RX
  46. PB_5, // WIFI_WAKEUP
  47. PE_11, // WIFI_RESET
  48. PE_12, // WIFI_BOOT
  49. // STATUS_LED
  50. PE_1, //STATUS_LED
  51. // SPI USER
  52. PB_12, // SPI_CS
  53. PB_15, // SPI_MOSI
  54. PB_14, // SPI_MISO
  55. PB_13, // SPI_SCK
  56. // I2C USER
  57. PB_7, // SDA
  58. PB_6, // SCL
  59. // SPI
  60. PA_4, // SPI_CS
  61. PA_5, // SPI_SCK
  62. PA_6, // SPI_MISO
  63. PA_7, // SPI_MOSI
  64. // JTAG
  65. PA_13, // JTAG_TMS/SWDIO
  66. PA_14, // JTAG_TCK/SWCLK
  67. PB_3, // JTAG_TDO/SWO
  68. // SDCARD
  69. PC_8, // SDIO_D0
  70. PC_9, // SDIO_D1
  71. PA_15, // SD_CARD_DETECT
  72. PC_10, // SDIO_D2
  73. PC_11, // SDIO_D3
  74. PC_12, // SDIO_CK
  75. PD_2, // SDIO_CMD
  76. // OTG
  77. PA_11, // OTG_DM
  78. PA_12, // OTG_DP
  79. // IR/PROBE
  80. PD_1, // IR_OUT
  81. PC_1, // IR_ON
  82. // USER_PINS
  83. PD_7, // USER3
  84. PB_9, // USER1
  85. PE_0, // USER2
  86. PB_4, // USER4
  87. // USERKET
  88. PE_7, // USER_BUTTON
  89. // ENDSTOPS
  90. PD_8, // X_STOP
  91. PD_9, // Y_STOP
  92. PD_10, // Z_STOP
  93. PD_11, // U_STOP
  94. PA_8, // V_STOP
  95. PD_0, // W_STOP
  96. // HEATERS
  97. PD_13, // BED_HEAT_2
  98. PD_14, // BED_HEAT_1
  99. PD_15, // BED_HEAT_3
  100. PC_7, // E1_HEAT_PWM
  101. PB_0, // E2_HEAT_PWM
  102. PB_1, // E3_HEAT_PWM
  103. // THERMISTOR
  104. PC_2, // BED_THERMISTOR_1
  105. PC_3, // BED_THERMISTOR_2
  106. PA_3, // BED_THERMISTOR_3
  107. PA_0, // E1_THERMISTOR
  108. PA_1, // E2_THERMISTOR
  109. PA_2, // E3_THERMISTOR
  110. // FANS
  111. PC_4, // E1_FAN
  112. PC_5, // E2_FAN
  113. PE_8, // E3_FAN
  114. // X_MOTOR
  115. PE_13, // X_RESET
  116. PE_14, // X_PWM
  117. PE_15, // X_DIR
  118. // Y_MOTOR
  119. PE_10, // Y_RESET
  120. PB_10, // Y_PWM
  121. PE_9, // Y_DIR
  122. // Z_MOTOR
  123. PC_15, // Z_RESET
  124. PC_6, // Z_PWM
  125. PC_0, // Z_DIR
  126. // E1_MOTOR
  127. PC_14, // E1_RESET
  128. PC_13, // E1_DIR
  129. PD_12, // E1_PWM
  130. // E2_MOTOR
  131. PE_4, // E2_RESET
  132. PE_5, // E2_PWM
  133. PE_6, // E2_DIR
  134. // E3_MOTOR
  135. PE_3, // E3_RESET
  136. PE_2, // E3_DIR
  137. PB_8 // E3_PWM
  138. };
  139. #endif
  140. #ifdef __cplusplus
  141. }
  142. #endif
  143. // ----------------------------------------------------------------------------
  144. #ifdef __cplusplus
  145. extern "C" {
  146. #endif
  147. /**
  148. * @brief System Clock Configuration
  149. * The system Clock is configured as follow :
  150. * System Clock source = PLL (HSI)
  151. * SYSCLK(Hz) = 84000000
  152. * HCLK(Hz) = 84000000
  153. * AHB Prescaler = 1
  154. * APB1 Prescaler = 2
  155. * APB2 Prescaler = 1
  156. * HSI Frequency(Hz) = 16000000
  157. * PLL_M = 16
  158. * PLL_N = 336
  159. * PLL_P = 4
  160. * PLL_Q = 7
  161. * VDD(V) = 3.3
  162. * Main regulator output voltage = Scale2 mode
  163. * Flash Latency(WS) = 2
  164. * @param None
  165. * @retval None
  166. */
  167. WEAK void SystemClock_Config(void)
  168. {
  169. RCC_OscInitTypeDef RCC_OscInitStruct = {};
  170. RCC_ClkInitTypeDef RCC_ClkInitStruct = {};
  171. /* Configure the main internal regulator output voltage */
  172. __HAL_RCC_PWR_CLK_ENABLE();
  173. __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE2);
  174. /* Initializes the CPU, AHB and APB busses clocks */
  175. RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
  176. RCC_OscInitStruct.HSEState = RCC_HSE_ON;
  177. RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
  178. RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
  179. RCC_OscInitStruct.PLL.PLLM = 15;
  180. RCC_OscInitStruct.PLL.PLLN = 144;
  181. RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV4;
  182. RCC_OscInitStruct.PLL.PLLQ = 5;
  183. if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
  184. Error_Handler();
  185. }
  186. /* Initializes the CPU, AHB and APB busses clocks */
  187. RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK
  188. | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2;
  189. RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
  190. RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
  191. RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2;
  192. RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
  193. if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK) {
  194. Error_Handler();
  195. }
  196. }
  197. #ifdef __cplusplus
  198. }
  199. #endif
  200. // PA_0 54 // E1_THERMISTOR
  201. // PA_1 55 // E2_THERMISTOR
  202. // PA_2 56 // E3_THERMISTOR
  203. // PA_3 53 // BED_THERMISTOR_3
  204. // PA_4 16 // SPI_CS
  205. // PA_5 17 // SPI_SCK
  206. // PA_6 18 // SPI_MISO
  207. // PA_7 19 // SPI_MOSI
  208. // PA_8 43 // V_STOP
  209. // PA_9 0 //TX
  210. // PA_10 1 //RX
  211. // PA_11 30 //OTG_DM
  212. // PA_12 31 //OTG_DP
  213. // PA_13 20 // JTAG_TMS/SWDIO
  214. // PA_14 21 // JTAG_TCK/SWCLK
  215. // PA_15 25 // SD_CARD_DETECT
  216. // PB_0 49 // E2_HEAT_PWM
  217. // PB_1 50 // E3_HEAT_PWM
  218. // PB_3 22 // JTAG_TDO/SWO
  219. // PB_4 37 // USER4
  220. // PB_5 6 // WIFI_WAKEUP
  221. // PB_6 15 // SCL
  222. // PB_7 14 // SDA
  223. // PB_8 77 // E3_PWM
  224. // PB_9 35 // USER1
  225. // PB_10 64 // Y_PWM
  226. // PB_12 10 // SPI_CS
  227. // PB_13 13 // SPI_SCK
  228. // PB_14 12 // SPI_MISO
  229. // PB_15 11 // SPI_MOSI
  230. // PC_0 68 // Z_DIR
  231. // PC_1 33 //IR_ON
  232. // PC_2 51 // BED_THERMISTOR_1
  233. // PC_3 52 // BED_THERMISTOR_2
  234. // PC_4 57 // E1_FAN
  235. // PC_5 58 // E2_FAN
  236. // PC_6 67 // Z_PWM
  237. // PC_7 48 // E1_HEAT_PWM
  238. // PC_8 23 // SDIO_D0
  239. // PC_9 24 // SDIO_D1
  240. // PC_10 26 // SDIO_D2
  241. // PC_11 27 // SDIO_D3
  242. // PC_12 28 // SDIO_CK
  243. // PC_13 70 // E1_DIR
  244. // PC_14 69 // E1_RESET
  245. // PC_15 66 // Z_RESET
  246. // PD_0 44 // W_STOP
  247. // PD_1 32 //IR_OUT
  248. // PD_2 29 // SDIO_CMD
  249. // PD_3 2 // CTS
  250. // PD_4 3 // RTS
  251. // PD_5 4 // TX
  252. // PD_6 5 // RX
  253. // PD_7 34 // USER3
  254. // PD_8 39 // X_STOP
  255. // PD_9 40 // Y_STOP
  256. // PD_10 41 // Z_STOP
  257. // PD_11 42 // U_STOP
  258. // PD_12 71 // E1_PWM
  259. // PD_13 45 // BED_HEAT_2
  260. // PD_14 46 // BED_HEAT_1
  261. // PD_15 47 // BED_HEAT_3
  262. // PE_0 36 // USER2
  263. // PE_1 9 // STATUS_LED
  264. // PE_2 76 // E3_DIR
  265. // PE_3 75 // E3_RESET
  266. // PE_4 72 // E2_RESET
  267. // PE_5 73 // E2_PWM
  268. // PE_6 74 // E2_DIR
  269. // PE_7 38 // USER_BUTTON
  270. // PE_8 59 // E3_FAN
  271. // PE_9 65 // Y_DIR
  272. // PE_10 63 // Y_RESET
  273. // PE_11 7 // WIFI_RESET
  274. // PE_12 8 // WIFI_BOOT
  275. // PE_13 60 // X_RESET
  276. // PE_14 61 // X_PWM
  277. // PE_15 62 // X_DIR