board.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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 STM32F103C8T6 Module often described as "Arduino"-like
  17. * on eBay, typically marked "www.vcc-gnd.com".
  18. */
  19. /*
  20. * Board identifier.
  21. */
  22. #define BOARD_MINIMAL_STM32_F103
  23. #define BOARD_NAME "STM32F103 Minimal Module"
  24. /*
  25. * Board frequencies.
  26. */
  27. #define STM32_LSECLK 32768
  28. #define STM32_HSECLK 8000000
  29. /*
  30. * MCU type, supported types are defined in ./os/hal/platforms/hal_lld.h.
  31. *
  32. * Only xB (128KB Flash) is defined, but it's identical to the
  33. * x8 version (64KB Flash) except for the Flash region size in the
  34. * linker script. For x8 parts use xB here and change to the x8 linker
  35. * script in the project Makefile.
  36. */
  37. #define STM32F103xB
  38. /*
  39. * IO pins assignments
  40. *
  41. * numbering is sorted by onboard/connectors, as from the schematics in
  42. * http://www.vcc-gnd.com/read.php?tid=369
  43. */
  44. /* on-board */
  45. #define GPIOC_LED 13
  46. #define GPIOA_USBDM 11 // pin 8
  47. #define GPIOA_USBDP 12 // pin 9
  48. #define GPIOC_OSC32_IN 14
  49. #define GPIOC_OSC32_OUT 15
  50. /*
  51. * I/O ports initial setup, this configuration is established soon after reset
  52. * in the initialization code.
  53. *
  54. * The digits have the following meaning:
  55. * 0 - Analog input.
  56. * 1 - Push Pull output 10MHz.
  57. * 2 - Push Pull output 2MHz.
  58. * 3 - Push Pull output 50MHz.
  59. * 4 - Digital input.
  60. * 5 - Open Drain output 10MHz.
  61. * 6 - Open Drain output 2MHz.
  62. * 7 - Open Drain output 50MHz.
  63. * 8 - Digital input with PullUp or PullDown resistor depending on ODR.
  64. * 9 - Alternate Push Pull output 10MHz.
  65. * A - Alternate Push Pull output 2MHz.
  66. * B - Alternate Push Pull output 50MHz.
  67. * C - Reserved.
  68. * D - Alternate Open Drain output 10MHz.
  69. * E - Alternate Open Drain output 2MHz.
  70. * F - Alternate Open Drain output 50MHz.
  71. * Please refer to the STM32 Reference Manual for details.
  72. */
  73. /*
  74. * Port A setup.
  75. * Everything input with pull-up except:
  76. */
  77. #define VAL_GPIOACRL 0x88888888 /* PA7...PA0 */
  78. #define VAL_GPIOACRH 0x88888888 /* PA15...PA8 */
  79. #define VAL_GPIOAODR 0xFFFFFFFF
  80. /*
  81. * Port B setup.
  82. * Everything input with pull-up except:
  83. */
  84. #define VAL_GPIOBCRL 0x88888888 /* PB7...PB0 */
  85. #define VAL_GPIOBCRH 0x88888888 /* PB15...PB8 */
  86. #define VAL_GPIOBODR 0xFFFFFFFF
  87. /*
  88. * Port C setup.
  89. * Everything input with pull-up except:
  90. * PC13 - Digital output (LED).
  91. */
  92. #define VAL_GPIOCCRL 0x88888888 /* PC7...PC0 */
  93. #define VAL_GPIOCCRH 0x88388888 /* PC15...PC8 */
  94. #define VAL_GPIOCODR 0xFFFFFFFF
  95. /*
  96. * Port D setup.
  97. * Everything input with pull-up except:
  98. * PD0 - Normal input (XTAL).
  99. * PD1 - Normal input (XTAL).
  100. */
  101. #define VAL_GPIODCRL 0x88888844 /* PD7...PD0 */
  102. #define VAL_GPIODCRH 0x88888888 /* PD15...PD8 */
  103. #define VAL_GPIODODR 0xFFFFFFFF
  104. /*
  105. * Port E setup.
  106. * Everything input with pull-up except:
  107. */
  108. #define VAL_GPIOECRL 0x88888888 /* PE7...PE0 */
  109. #define VAL_GPIOECRH 0x88888888 /* PE15...PE8 */
  110. #define VAL_GPIOEODR 0xFFFFFFFF
  111. /*
  112. * USB bus activation macro, required by the USB driver.
  113. */
  114. #define usb_lld_connect_bus(usbp) /* always connected */
  115. /*
  116. * USB bus de-activation macro, required by the USB driver.
  117. */
  118. #define usb_lld_disconnect_bus(usbp) /* always connected */
  119. #if !defined(_FROM_ASM_)
  120. #ifdef __cplusplus
  121. extern "C" {
  122. #endif
  123. void boardInit(void);
  124. #ifdef __cplusplus
  125. }
  126. #endif
  127. #endif /* _FROM_ASM_ */
  128. #endif /* _BOARD_H_ */