board.h 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. /*
  2. ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. #ifndef _BOARD_H_
  14. #define _BOARD_H_
  15. /*
  16. * Setup for the GoldBull STM32F107 V3 evaluation board.
  17. */
  18. /*
  19. * Board identifier.
  20. */
  21. #define BOARD_GOLDBULL_STM32F107VC
  22. #define BOARD_NAME "GoldBull STM32F107VC V3"
  23. /*
  24. * Board frequencies.
  25. */
  26. #define STM32_LSECLK 32768
  27. #define STM32_HSECLK 25000000
  28. /*
  29. * MCU type, supported types are defined in ./os/hal/platforms/hal_lld.h.
  30. */
  31. #define STM32F107xC
  32. /*
  33. * Ethernet PHY type.
  34. */
  35. #define BOARD_PHY_ID MII_DP83848I_ID
  36. #define BOARD_PHY_RMII
  37. /*
  38. * IO pins assignments.
  39. */
  40. #define GPIOA_SWITCH_WKUP 0
  41. #define GPIOB_SWITCH_USER 2
  42. #define GPIOC_SWITCH_TAMPER 13
  43. #define GPIOC_SPI3_SD_CS 3
  44. #define GPIOC_SPI3_SD_CD 2
  45. #define GPIOD_LED3 2
  46. #define GPIOD_LED4 3
  47. #define GPIOD_LED5 4
  48. #define GPIOD_LED6 7
  49. /*
  50. * I/O ports initial setup, this configuration is established soon after reset
  51. * in the initialization code.
  52. *
  53. * The digits have the following meaning:
  54. * 0 - Analog input.
  55. * 1 - Push Pull output 10MHz.
  56. * 2 - Push Pull output 2MHz.
  57. * 3 - Push Pull output 50MHz.
  58. * 4 - Digital input.
  59. * 5 - Open Drain output 10MHz.
  60. * 6 - Open Drain output 2MHz.
  61. * 7 - Open Drain output 50MHz.
  62. * 8 - Digital input with PullUp or PullDown resistor depending on ODR.
  63. * 9 - Alternate Push Pull output 10MHz.
  64. * A - Alternate Push Pull output 2MHz.
  65. * B - Alternate Push Pull output 50MHz.
  66. * C - Reserved.
  67. * D - Alternate Open Drain output 10MHz.
  68. * E - Alternate Open Drain output 2MHz.
  69. * F - Alternate Open Drain output 50MHz.
  70. * Please refer to the STM32 Reference Manual for details.
  71. */
  72. /*
  73. * Port A setup.
  74. * Everything input with pull-up except:
  75. * PA0 - Normal input (WKUP BUTTON).
  76. * PA1 - Normal input (ETH_RMII_REF_CLK).
  77. * PA2 - Alternate output (ETH_RMII_MDIO).
  78. * PA3 - Input with PU (TP_IRQ).
  79. * PA4 - Push Pull output (TP_CS).
  80. * PA5 - Alternate output (SPI1 SCK).
  81. * PA6 - Input with PU (SPI1 MISO).
  82. * PA7 - Alternate output (SPI1 MOSI).
  83. * PA8 - Alternate output (MCO).
  84. * PA9 - Normal input (OTG_VBUS).
  85. * PA10 - Normal input (OTG_ID).
  86. * PA11 - Normal input (OTG_DM).
  87. * PA12 - Normal input (OTG_DP).
  88. * PA13 - Normal input (TMS).
  89. * PA14 - Normal input (TCK).
  90. * PA15 - Normal input (TDI).
  91. */
  92. #define VAL_GPIOACRL 0xB8B38B44 /* PA7...PA0 */
  93. #define VAL_GPIOACRH 0x4444444B /* PA15...PA8 */
  94. #define VAL_GPIOAODR 0xFFFFFFFF
  95. /*
  96. * 0 - Analog input.
  97. * 1 - Push Pull output 10MHz.
  98. * 2 - Push Pull output 2MHz.
  99. * 3 - Push Pull output 50MHz.
  100. * 4 - Digital input.
  101. * 5 - Open Drain output 10MHz.
  102. * 6 - Open Drain output 2MHz.
  103. * 7 - Open Drain output 50MHz.
  104. * 8 - Digital input with PullUp or PullDown resistor depending on ODR.
  105. * 9 - Alternate Push Pull output 10MHz.
  106. * A - Alternate Push Pull output 2MHz.
  107. * B - Alternate Push Pull output 50MHz.
  108. * C - Reserved.
  109. * D - Alternate Open Drain output 10MHz.
  110. * E - Alternate Open Drain output 2MHz.
  111. * F - Alternate Open Drain output 50MHz.
  112. */
  113. /*
  114. * Port B setup:
  115. * PB0 - Input with PU (unconnected).
  116. * PB1 - Input with PU (unconnected).
  117. * PB2 - Normal input (BOOT1, KEY_USER).
  118. * PB3 - Normal input (TDO).
  119. * PB4 - Normal input (TRST).
  120. * PB5 - Input with PU (CAN2 RX).
  121. * PB6 - Alternate output (USART1 TX, remapped).
  122. * PB7 - Input with PU (USART1 RX, remapped).
  123. * PB8 - Alternate O.D. (I2C1 SCL, remapped).
  124. * PB9 - Alternate O.D. (I2C1 SDA, remapped).
  125. * PB10 - Input with PU (BL_CNT).
  126. * PB11 - Alternate output (ETH_RMII_TX_EN).
  127. * PB12 - Alternate output (ETH_RMII_TXD0).
  128. * PB13 - Alternate output (ETH_RMII_TXD1).
  129. * PB14 - Input with PU (unconnected).
  130. * PB15 - Input with PU (unconnected).
  131. */
  132. #define VAL_GPIOBCRL 0x8B844488 /* PB7...PB0 */
  133. #define VAL_GPIOBCRH 0x88BBB8FF /* PB15...PB8 */
  134. #define VAL_GPIOBODR 0xFFFFFFFF
  135. /*
  136. * 0 - Analog input.
  137. * 1 - Push Pull output 10MHz.
  138. * 2 - Push Pull output 2MHz.
  139. * 3 - Push Pull output 50MHz.
  140. * 4 - Digital input.
  141. * 5 - Open Drain output 10MHz.
  142. * 6 - Open Drain output 2MHz.
  143. * 7 - Open Drain output 50MHz.
  144. * 8 - Digital input with PullUp or PullDown resistor depending on ODR.
  145. * 9 - Alternate Push Pull output 10MHz.
  146. * A - Alternate Push Pull output 2MHz.
  147. * B - Alternate Push Pull output 50MHz.
  148. * C - Reserved.
  149. * D - Alternate Open Drain output 10MHz.
  150. * E - Alternate Open Drain output 2MHz.
  151. * F - Alternate Open Drain output 50MHz.
  152. */
  153. /*
  154. * Port C setup:
  155. * PC0 - Analog input (ADC_IN).
  156. * PC1 - Alternate output (ETH_MDC).
  157. * PC2 - Input with PU (SD_CD).
  158. * PC3 - Push Pull output (SD_CS).
  159. * PC4 - Push Pull output (OTG_PW_ON).
  160. * PC5 - Push Pull output (SF_CS).
  161. * PC6 - Push Pull output (LCD_RD).
  162. * PC7 - Push Pull output (LCD_WR).
  163. * PC8 - Push Pull output (LCD_RS).
  164. * PC9 - Push Pull output (LCD_CS).
  165. * PC10 - Alternate output (SPI3 SCK).
  166. * PC11 - Input with PU (SPI3 MISO).
  167. * PC12 - Alternate output (SPI3 MOSI).
  168. * PC13 - Normal input (KEY_TAMPER).
  169. * PC14 - Normal input (OSC32 IN).
  170. * PC15 - Normal input (OSC32 OUT).
  171. */
  172. #define VAL_GPIOCCRL 0x333338B0 /* PC7...PC0 */
  173. #define VAL_GPIOCCRH 0x444B8B33 /* PC15...PC8 */
  174. #define VAL_GPIOCODR 0xFFFFFFFF
  175. /*
  176. * 0 - Analog input.
  177. * 1 - Push Pull output 10MHz.
  178. * 2 - Push Pull output 2MHz.
  179. * 3 - Push Pull output 50MHz.
  180. * 4 - Digital input.
  181. * 5 - Open Drain output 10MHz.
  182. * 6 - Open Drain output 2MHz.
  183. * 7 - Open Drain output 50MHz.
  184. * 8 - Digital input with PullUp or PullDown resistor depending on ODR.
  185. * 9 - Alternate Push Pull output 10MHz.
  186. * A - Alternate Push Pull output 2MHz.
  187. * B - Alternate Push Pull output 50MHz.
  188. * C - Reserved.
  189. * D - Alternate Open Drain output 10MHz.
  190. * E - Alternate Open Drain output 2MHz.
  191. * F - Alternate Open Drain output 50MHz.
  192. */
  193. /*
  194. * Port D setup:
  195. * PD0 - Input with PU (CAN1_RX, remapped).
  196. * PD1 - Alternate output (CAN1_TX, remapped).
  197. * PD2 - Push Pull output (LED3).
  198. * PD3 - Push Pull output (LED4).
  199. * PD4 - Push Pull output (LED5).
  200. * PD5 - Alternate output (USART2 TX, remapped).
  201. * PD6 - Input with PU (USART2 RX, remapped).
  202. * PD7 - Push Pull output (LED6).
  203. * PD8 - Normal input (ETH_RMII_CRS_DV, remapped).
  204. * PD9 - Normal input (ETH_RMII_RXD0, remapped).
  205. * PD10 - Normal input (ETH_RMII_RXD1, remapped).
  206. * PD11 - Input with PU (JOY_UP).
  207. * PD12 - Input with PU (JOY_DOWN).
  208. * PD13 - Input with PU (JOY_LEFT).
  209. * PD14 - Input with PU (JOY_RIGHT).
  210. * PD15 - Input with PU (JOY_SEL).
  211. */
  212. #define VAL_GPIODCRL 0x38B333B8 /* PD7...PD0 */
  213. #define VAL_GPIODCRH 0x88888444 /* PD15...PD8 */
  214. #define VAL_GPIODODR 0xFFFFFFFF
  215. /*
  216. * Port E setup.
  217. * Everything input with pull-up except:
  218. */
  219. #define VAL_GPIOECRL 0x88888888 /* PE7...PE0 */
  220. #define VAL_GPIOECRH 0x88888888 /* PE15...PE8 */
  221. #define VAL_GPIOEODR 0xFFFFFFFF
  222. #if !defined(_FROM_ASM_)
  223. #ifdef __cplusplus
  224. extern "C" {
  225. #endif
  226. void boardInit(void);
  227. #ifdef __cplusplus
  228. }
  229. #endif
  230. #endif /* _FROM_ASM_ */
  231. #endif /* _BOARD_H_ */