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.h 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  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. #pragma once
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif // __cplusplus
  34. /*----------------------------------------------------------------------------
  35. * Pins
  36. *----------------------------------------------------------------------------*/
  37. #ifdef STM32F405RX
  38. #define STM32F4X_PIN_NUM 64 //64 pins mcu, 51 gpio
  39. #define STM32F4X_GPIO_NUM 51
  40. #define STM32F4X_ADC_NUM 16
  41. #elif defined(STM32F407_5VX)
  42. #define STM32F4X_PIN_NUM 100 //100 pins mcu, 82 gpio
  43. #define STM32F4X_GPIO_NUM 82
  44. #define STM32F4X_ADC_NUM 16
  45. #elif defined(STM32F407_5ZX)
  46. #define STM32F4X_PIN_NUM 144 //144 pins mcu, 114 gpio
  47. #define STM32F4X_GPIO_NUM 114
  48. #define STM32F4X_ADC_NUM 24
  49. #elif defined(STM32F407IX)
  50. #define STM32F4X_PIN_NUM 176 //176 pins mcu, 140 gpio
  51. #define STM32F4X_GPIO_NUM 140
  52. #define STM32F4X_ADC_NUM 24
  53. #else
  54. #error "no match MCU defined"
  55. #endif
  56. #if STM32F4X_PIN_NUM >= 64 //64 pins mcu, 51 gpio
  57. #define PC13 0
  58. #define PC14 1 //OSC32_IN
  59. #define PC15 2 //OSC32_OUT
  60. #define PH0 3 //OSC_IN
  61. #define PH1 4 //OSC_OUT
  62. #define PB2 5 //BOOT1
  63. #define PB10 6 //1:SPI2_SCK / I2C2_SCL / USART3_TX / TIM2_CH3
  64. #define PB11 7 //1:I2C2_SDA / USART3_RX / TIM2_CH4
  65. #define PB12 8 //1:SPI2_NSS / OTG_HS_ID
  66. #define PB13 9 //1:SPI2_SCK 2:OTG_HS_VBUS
  67. #define PB14 10 //1:SPI2_MISO / TIM12_CH1 / OTG_HS_DM
  68. #define PB15 11 //SPI2_MOSI / TIM12_CH2 / OTG_HS_DP
  69. #define PC6 12 //1:TIM8_CH1 / SDIO_D6 / USART6_TX / TIM3_CH1
  70. #define PC7 13 //1:TIM8_CH2 / SDIO_D7 / USART6_RX / TIM3_CH2
  71. #define PC8 14 //1:TIM8_CH3 / SDIO_D0 / TIM3_CH3
  72. #define PC9 15 //1:TIM8_CH4 / SDIO_D1 / TIM3_CH4
  73. #define PA8 16 //1:TIM1_CH1 / I2C3_SCL / OTG_FS_SOF
  74. #define PA9 17 //1:USART1_TX / TIM1_CH2 2:OTG_FS_VBUS
  75. #define PA10 18 //1:USART1_RX / TIM1_CH3 / OTG_FS_ID
  76. #define PA11 19 //1:TIM1_CH4 / OTG_FS_DM
  77. #define PA12 20 //1:OTG_FS_DP
  78. #define PA13 21 //0:JTMS-SWDIO
  79. #define PA14 22 //0:JTCK-SWCLK
  80. #define PA15 23 //0:JTDI 1:SPI3_NSS / SPI1_NSS
  81. #define PC10 24 //1:UART4_TX / SPI3_SCK / SDIO_D2 / USART3_TX
  82. #define PC11 25 //1:UART4_RX / SPI3_MISO / SDIO_D3 / USART3_RX
  83. #define PC12 26 //1:UART5_TX / SPI3_MOSI / SDIO_CK
  84. #define PD2 27 //1:UART5_RX / SDIO_CMD
  85. #define PB3 28 //0:JTDO 1:SPI3_SCK / TIM2_CH2 / SPI1_SCK
  86. #define PB4 29 //0:NJTRST 1:SPI3_MISO / TIM3_CH1 / SPI1_MISO
  87. #define PB5 30 //1:TIM3_CH2 / SPI1_MOSI / SPI3_MOSI
  88. #define PB6 31 //1:I2C1_SCL / TIM4_CH1 / USART1_TX
  89. #define PB7 32 //1:I2C1_SDA / TIM4_CH2 / USART1_RX
  90. #define PB8 33 //1:I2C1_SCL / TIM4_CH3 / SDIO_D4 / TIM10_CH1
  91. #define PB9 34 //1:I2C1_SDA / TIM4_CH4 / SDIO_D5 / TIM11_CH1 / SPI2_NSS
  92. #define PA0 35 //1:UART4_TX / TIM5_CH1 2:ADC123_IN0
  93. #define PA1 36 //1:UART4_RX / TIM5_CH2 / TIM2_CH2 2:ADC123_IN1
  94. #define PA2 37 //1:USART2_TX /TIM5_CH3 / TIM9_CH1 / TIM2_CH3 2:ADC123_IN2
  95. #define PA3 38 //1:USART2_RX /TIM5_CH4 / TIM9_CH2 / TIM2_CH4 2:ADC123_IN3
  96. #define PA4 39 //NOT FT 1:SPI1_NSS / SPI3_NSS / USART2_CK 2:ADC12_IN4 / DAC_OUT1
  97. #define PA5 40 //NOT FT 1:SPI1_SCK 2:ADC12_IN5 / DAC_OUT2
  98. #define PA6 41 //1:SPI1_MISO / TIM13_CH1 / TIM3_CH1 2:ADC12_IN6
  99. #define PA7 42 //1:SPI1_MOSI / TIM14_CH1 / TIM3_CH2 2:ADC12_IN7
  100. #define PB0 43 //1:TIM3_CH3 2:ADC12_IN8
  101. #define PB1 44 //1:TIM3_CH4 2:ADC12_IN9
  102. #define PC0 45 //1: 2:ADC123_IN10
  103. #define PC1 46 //1: 2:ADC123_IN11
  104. #define PC2 47 //1:SPI2_MISO 2:ADC123_IN12
  105. #define PC3 48 //1:SPI2_MOSI 2:ADC123_IN13
  106. #define PC4 49 //1: 2:ADC12_IN14
  107. #define PC5 50 //1: 2:ADC12_IN15
  108. #if STM32F4X_PIN_NUM >= 144
  109. #define PF3 51 //1:FSMC_A3 2:ADC3_IN9
  110. #define PF4 52 //1:FSMC_A4 2:ADC3_IN14
  111. #define PF5 53 //1:FSMC_A5 2:ADC3_IN15
  112. #define PF6 54 //1:TIM10_CH1 2:ADC3_IN4
  113. #define PF7 55 //1:TIM11_CH1 2:ADC3_IN5
  114. #define PF8 56 //1:TIM13_CH1 2:ADC3_IN6
  115. #define PF9 57 //1;TIM14_CH1 2:ADC3_IN7
  116. #define PF10 58 //2:ADC3_IN8
  117. #endif
  118. #endif
  119. #if STM32F4X_PIN_NUM >= 100 //100 pins mcu, 82 gpio
  120. #define PE2 (35+STM32F4X_ADC_NUM) //1:FSMC_A23
  121. #define PE3 (36+STM32F4X_ADC_NUM) //1:FSMC_A19
  122. #define PE4 (37+STM32F4X_ADC_NUM) //1:FSMC_A20
  123. #define PE5 (38+STM32F4X_ADC_NUM) //1:FSMC_A21
  124. #define PE6 (39+STM32F4X_ADC_NUM) //1:FSMC_A22
  125. #define PE7 (40+STM32F4X_ADC_NUM) //1:FSMC_D4
  126. #define PE8 (41+STM32F4X_ADC_NUM) //1:FSMC_D5
  127. #define PE9 (42+STM32F4X_ADC_NUM) //1:FSMC_D6 / TIM1_CH1
  128. #define PE10 (43+STM32F4X_ADC_NUM) //1:FSMC_D7
  129. #define PE11 (44+STM32F4X_ADC_NUM) //1:FSMC_D8 / TIM1_CH2
  130. #define PE12 (45+STM32F4X_ADC_NUM) //1:FSMC_D9
  131. #define PE13 (46+STM32F4X_ADC_NUM) //1:FSMC_D10 / TIM1_CH3
  132. #define PE14 (47+STM32F4X_ADC_NUM) //1:FSMC_D11 / TIM1_CH4
  133. #define PE15 (48+STM32F4X_ADC_NUM) //1:FSMC_D12
  134. #define PD8 (49+STM32F4X_ADC_NUM) //1:FSMC_D13 / USART3_TX
  135. #define PD9 (50+STM32F4X_ADC_NUM) //1:FSMC_D14 / USART3_RX
  136. #define PD10 (51+STM32F4X_ADC_NUM) //1:FSMC_D15
  137. #define PD11 (52+STM32F4X_ADC_NUM) //1:FSMC_A16
  138. #define PD12 (53+STM32F4X_ADC_NUM) //1:FSMC_A17 / TIM4_CH1
  139. #define PD13 (54+STM32F4X_ADC_NUM) //1:FSMC_A18 / TIM4_CH2
  140. #define PD14 (55+STM32F4X_ADC_NUM) //1:FSMC_D0 / TIM4_CH3
  141. #define PD15 (56+STM32F4X_ADC_NUM) //1:FSMC_D1 / TIM4_CH4
  142. #define PD0 (57+STM32F4X_ADC_NUM) //1:FSMC_D2
  143. #define PD1 (58+STM32F4X_ADC_NUM) //1:FSMC_D3
  144. #define PD3 (59+STM32F4X_ADC_NUM) //1:FSMC_CLK
  145. #define PD4 (60+STM32F4X_ADC_NUM) //1:FSMC_NOE
  146. #define PD5 (61+STM32F4X_ADC_NUM) //1:USART2_TX
  147. #define PD6 (62+STM32F4X_ADC_NUM) //1:USART2_RX
  148. #define PD7 (63+STM32F4X_ADC_NUM)
  149. #define PE0 (64+STM32F4X_ADC_NUM)
  150. #define PE1 (65+STM32F4X_ADC_NUM)
  151. #endif
  152. #if STM32F4X_PIN_NUM >= 144 //144 pins mcu, 114 gpio
  153. #define PF0 (66+STM32F4X_ADC_NUM) //1:FSMC_A0 / I2C2_SDA
  154. #define PF1 (67+STM32F4X_ADC_NUM) //1:FSMC_A1 / I2C2_SCL
  155. #define PF2 (68+STM32F4X_ADC_NUM) //1:FSMC_A2
  156. #define PF11 (69+STM32F4X_ADC_NUM)
  157. #define PF12 (70+STM32F4X_ADC_NUM) //1:FSMC_A6
  158. #define PF13 (71+STM32F4X_ADC_NUM) //1:FSMC_A7
  159. #define PF14 (72+STM32F4X_ADC_NUM) //1:FSMC_A8
  160. #define PF15 (73+STM32F4X_ADC_NUM) //1:FSMC_A9
  161. #define PG0 (74+STM32F4X_ADC_NUM) //1:FSMC_A10
  162. #define PG1 (75+STM32F4X_ADC_NUM) //1:FSMC_A11
  163. #define PG2 (76+STM32F4X_ADC_NUM) //1:FSMC_A12
  164. #define PG3 (77+STM32F4X_ADC_NUM) //1:FSMC_A13
  165. #define PG4 (78+STM32F4X_ADC_NUM) //1:FSMC_A14
  166. #define PG5 (79+STM32F4X_ADC_NUM) //1:FSMC_A15
  167. #define PG6 (80+STM32F4X_ADC_NUM)
  168. #define PG7 (81+STM32F4X_ADC_NUM)
  169. #define PG8 (82+STM32F4X_ADC_NUM)
  170. #define PG9 (83+STM32F4X_ADC_NUM) //1:USART6_RX
  171. #define PG10 (84+STM32F4X_ADC_NUM) //1:FSMC_NE3
  172. #define PG11 (85+STM32F4X_ADC_NUM)
  173. #define PG12 (86+STM32F4X_ADC_NUM) //1:FSMC_NE4
  174. #define PG13 (87+STM32F4X_ADC_NUM) //1:FSMC_A24
  175. #define PG14 (88+STM32F4X_ADC_NUM) //1:FSMC_A25 / USART6_TX
  176. #define PG15 (89+STM32F4X_ADC_NUM)
  177. #endif
  178. #if STM32F4X_PIN_NUM >= 176 //176 pins mcu, 140 gpio
  179. #define PI8 (90+STM32F4X_ADC_NUM)
  180. #define PI9 (91+STM32F4X_ADC_NUM)
  181. #define PI10 (92+STM32F4X_ADC_NUM)
  182. #define PI11 (93+STM32F4X_ADC_NUM)
  183. #define PH2 (94+STM32F4X_ADC_NUM)
  184. #define PH3 (95+STM32F4X_ADC_NUM)
  185. #define PH4 (96+STM32F4X_ADC_NUM) //1:I2C2_SCL
  186. #define PH5 (97+STM32F4X_ADC_NUM) //1:I2C2_SDA
  187. #define PH6 (98+STM32F4X_ADC_NUM) //1:TIM12_CH1
  188. #define PH7 (99+STM32F4X_ADC_NUM) //1:I2C3_SCL
  189. #define PH8 (100+STM32F4X_ADC_NUM) //1:I2C3_SDA
  190. #define PH9 (101+STM32F4X_ADC_NUM) //1:TIM12_CH2
  191. #define PH10 (102+STM32F4X_ADC_NUM) //1:TIM5_CH1
  192. #define PH11 (103+STM32F4X_ADC_NUM) //1:TIM5_CH2
  193. #define PH12 (104+STM32F4X_ADC_NUM) //1:TIM5_CH3
  194. #define PH13 (105+STM32F4X_ADC_NUM)
  195. #define PH14 (106+STM32F4X_ADC_NUM)
  196. #define PH15 (107+STM32F4X_ADC_NUM)
  197. #define PI0 (108+STM32F4X_ADC_NUM) //1:TIM5_CH4 / SPI2_NSS
  198. #define PI1 (109+STM32F4X_ADC_NUM) //1:SPI2_SCK
  199. #define PI2 (110+STM32F4X_ADC_NUM) //1:TIM8_CH4 /SPI2_MISO
  200. #define PI3 (111+STM32F4X_ADC_NUM) //1:SPI2_MOS
  201. #define PI4 (112+STM32F4X_ADC_NUM)
  202. #define PI5 (113+STM32F4X_ADC_NUM) //1:TIM8_CH1
  203. #define PI6 (114+STM32F4X_ADC_NUM) //1:TIM8_CH2
  204. #define PI7 (115+STM32F4X_ADC_NUM) //1:TIM8_CH3
  205. #endif
  206. // This must be a literal
  207. #define NUM_DIGITAL_PINS (STM32F4X_GPIO_NUM)
  208. // This must be a literal with a value less than or equal to MAX_ANALOG_INPUTS
  209. #define NUM_ANALOG_INPUTS (STM32F4X_ADC_NUM)
  210. #define NUM_ANALOG_FIRST 35
  211. // Below ADC, DAC and PWM definitions already done in the core
  212. // Could be redefined here if needed
  213. // ADC resolution is 12bits
  214. //#define ADC_RESOLUTION 12
  215. //#define DACC_RESOLUTION 12
  216. // PWM resolution
  217. /*
  218. * BEWARE:
  219. * Changing this value from the default (1000) will affect the PWM output value of analogWrite (to a PWM pin)
  220. * Since the pin is toggled on capture, if you change the frequency of the timer you have to adapt the compare value (analogWrite thinks you did)
  221. */
  222. //#define PWM_FREQUENCY 20000
  223. //The bottom values are the default and don't need to be redefined
  224. //#define PWM_RESOLUTION 8
  225. //#define PWM_MAX_DUTY_CYCLE 255
  226. // Below SPI and I2C definitions already done in the core
  227. // Could be redefined here if differs from the default one
  228. // SPI Definitions
  229. #define PIN_SPI_MOSI PB15
  230. #define PIN_SPI_MISO PB14
  231. #define PIN_SPI_SCK PB13
  232. #define PIN_SPI_SS PB12
  233. // I2C Definitions
  234. #define PIN_WIRE_SDA PB7
  235. #define PIN_WIRE_SCL PB6
  236. // Timer Definitions
  237. // Do not use timer used by PWM pins when possible. See PinMap_PWM in PeripheralPins.c
  238. #define TIMER_TONE TIM7 // TIMER_TONE must be defined in this file
  239. #define TIMER_SERVO TIM5 // TIMER_SERVO must be defined in this file
  240. #define TIMER_SERIAL TIM2 // TIMER_SERIAL must be defined in this file
  241. // UART Definitions
  242. // Define here Serial instance number to map on Serial generic name
  243. #define SERIAL_UART_INSTANCE 1 //ex: 2 for Serial2 (USART2)
  244. // DEBUG_UART could be redefined to print on another instance than 'Serial'
  245. //#define DEBUG_UART ((USART_TypeDef *) U(S)ARTX) // ex: USART3
  246. // DEBUG_UART baudrate, default: 9600 if not defined
  247. //#define DEBUG_UART_BAUDRATE x
  248. // DEBUG_UART Tx pin name, default: the first one found in PinMap_UART_TX for DEBUG_UART
  249. //#define DEBUG_PINNAME_TX PX_n // PinName used for TX
  250. // Default pin used for 'Serial' instance (ex: ST-Link)
  251. // Mandatory for Firmata
  252. #define PIN_SERIAL_RX PA10
  253. #define PIN_SERIAL_TX PA9
  254. // Serial Pins for the MMU2
  255. #define ENABLE_HWSERIAL4
  256. #define PIN_SERIAL4_RX PC11
  257. #define PIN_SERIAL4_TX PC10
  258. #ifdef __cplusplus
  259. } // extern "C"
  260. #endif
  261. /*----------------------------------------------------------------------------
  262. * Arduino objects - C++ only
  263. *----------------------------------------------------------------------------*/
  264. #ifdef __cplusplus
  265. // These serial port names are intended to allow libraries and architecture-neutral
  266. // sketches to automatically default to the correct port name for a particular type
  267. // of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
  268. // the first hardware serial port whose RX/TX pins are not dedicated to another use.
  269. //
  270. // SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
  271. //
  272. // SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
  273. //
  274. // SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
  275. //
  276. // SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
  277. //
  278. // SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
  279. // pins are NOT connected to anything by default.
  280. #define SERIAL_PORT_MONITOR Serial
  281. #define SERIAL_PORT_HARDWARE Serial1
  282. #endif