Debian Codegraph @

ports/stm32/boards/SPARKFUN_MICROMOD_STM32/mpconfigboard.h

raw
1 // The SparkFun MicroMod spec uses a zero-based peripheral numbering scheme.
2 // In cases where the 0th peripheral is the default, the "0" is omitted from
3 // the name (e.g. "I2C" instead of "I2C0").
4 //
5 // Note: UART (UART0) is not present in the edge connector pinout because the
6 // primary debug serial port is exposed as a virtual serial port over USB,
7 // i.e. Serial.print() should print over USB VCP, not UART_TX1.
8 //
9 // For more details, see https://www.sparkfun.com/micromod#tech-specs
10
11 #define MICROPY_HW_BOARD_NAME "SparkFun STM32 MicroMod Processor"
12 #define MICROPY_HW_MCU_NAME "STM32F405RG"
13
14 // 1 = use STM32 internal flash (1 MByte)
15 // 0 = use onboard external SPI flash (16 MByte)
16 #define MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE (0)
17
18 #define MICROPY_HW_HAS_FLASH (1)
19 #define MICROPY_HW_ENABLE_RNG (1)
20 #define MICROPY_HW_ENABLE_RTC (1)
21 #define MICROPY_HW_ENABLE_DAC (1)
22 #define MICROPY_HW_ENABLE_USB (1)
23
24 // External SPI Flash config
25 #if !MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE
26
27 // 128 Mbit (16 MByte) external SPI flash
28 #define MICROPY_HW_SPIFLASH_SIZE_BITS (128 * 1024 * 1024)
29
30 #define MICROPY_HW_SPIFLASH_CS (pin_C3)
31 #define MICROPY_HW_SPIFLASH_SCK (pin_C10)
32 #define MICROPY_HW_SPIFLASH_MOSI (pin_C12)
33 #define MICROPY_HW_SPIFLASH_MISO (pin_C11)
34
35 #define MICROPY_BOARD_EARLY_INIT board_early_init
36 void board_early_init(void);
37
38 extern const struct _mp_spiflash_config_t spiflash_config;
39 extern struct _spi_bdev_t spi_bdev;
40 #define MICROPY_HW_SPIFLASH_ENABLE_CACHE (1)
41 #define MICROPY_HW_BDEV_SPIFLASH (&spi_bdev)
42 #define MICROPY_HW_BDEV_SPIFLASH_CONFIG (&spiflash_config)
43 #define MICROPY_HW_BDEV_SPIFLASH_SIZE_BYTES (MICROPY_HW_SPIFLASH_SIZE_BITS / 8)
44 #define MICROPY_HW_BDEV_SPIFLASH_EXTENDED (&spi_bdev) // for extended block protocol
45
46 #endif // !MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE
47
48 // STM32 HSE config
49 // The module has a 12 MHz crystal for the HSE oscillator.
50 #define MICROPY_HW_CLK_PLLM (12)
51 #define MICROPY_HW_CLK_PLLN (336)
52 #define MICROPY_HW_CLK_PLLP (RCC_PLLP_DIV2)
53 #define MICROPY_HW_CLK_PLLQ (7)
54 #define MICROPY_HW_CLK_LAST_FREQ (1)
55
56 // STM32 LSE config
57 // The module has a 32.768 kHz crystal for the LSE (RTC).
58 #define MICROPY_HW_RTC_USE_LSE (1)
59 #define MICROPY_HW_RTC_USE_US (0)
60 #define MICROPY_HW_RTC_USE_CALOUT (1)
61
62 // UART2 config (MicroMod UART1)
63 #define MICROPY_HW_UART2_NAME "UART1"
64 #define MICROPY_HW_UART2_TX (pin_A2)
65 #define MICROPY_HW_UART2_RX (pin_A3)
66
67 // CAN1 config (MicroMod CAN)
68 #define MICROPY_HW_CAN1_NAME "CAN"
69 #define MICROPY_HW_CAN1_TX (pin_B9)
70 #define MICROPY_HW_CAN1_RX (pin_B8)
71
72 // I2C1 config (MicroMod I2C1)
73 #define MICROPY_HW_I2C1_NAME "I2C1"
74 #define MICROPY_HW_I2C1_SCL (pin_B6)
75 #define MICROPY_HW_I2C1_SDA (pin_B7)
76
77 // I2C2 config (MicroMod I2C)
78 #define MICROPY_HW_I2C2_NAME "I2C"
79 #define MICROPY_HW_I2C2_SCL (pin_B10)
80 #define MICROPY_HW_I2C2_SDA (pin_B11)
81
82 // SPI1 config (MicroMod SPI)
83 #define MICROPY_HW_SPI1_NAME "SPI"
84 #define MICROPY_HW_SPI1_NSS (pin_C4)
85 #define MICROPY_HW_SPI1_SCK (pin_A5)
86 #define MICROPY_HW_SPI1_MISO (pin_A6)
87 #define MICROPY_HW_SPI1_MOSI (pin_A7)
88
89 // LED1 config
90 // The module has a single blue status LED.
91 #define MICROPY_HW_LED1 (pin_A15)
92 #define MICROPY_HW_LED_ON(pin) (mp_hal_pin_high(pin))
93 #define MICROPY_HW_LED_OFF(pin) (mp_hal_pin_low(pin))
94
95 // USB device config
96 #define MICROPY_HW_USB_FS (1)