Debian Codegraph @

ports/stm32/boards/MIKROE_QUAIL/mpconfigboard.h

raw
1 #define MICROPY_HW_BOARD_NAME "MikroE Quail"
2 #define MICROPY_HW_MCU_NAME "STM32F427VI"
3
4 // 1 = use STM32 internal flash (1 MByte)
5 // 0 = use onboard external SPI flash (8 MByte)
6 #define MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE (0)
7
8 #define MICROPY_HW_ENABLE_RNG (1)
9 #define MICROPY_HW_ENABLE_RTC (1)
10 #define MICROPY_HW_ENABLE_USB (1)
11 #define MICROPY_HW_HAS_FLASH (1)
12
13 // HSE is 12MHz
14 #define MICROPY_HW_CLK_PLLM (6)
15 #define MICROPY_HW_CLK_PLLN (336)
16 #define MICROPY_HW_CLK_PLLP (RCC_PLLP_DIV4)
17 #define MICROPY_HW_CLK_PLLQ (14)
18 #define MICROPY_HW_CLK_LAST_FREQ (1)
19
20 // The board has no crystal for the RTC
21 #define MICROPY_HW_RTC_USE_LSE (0)
22 #define MICROPY_HW_RTC_USE_US (0)
23 #define MICROPY_HW_RTC_USE_CALOUT (0) // turn on/off PC13 512Hz output
24
25 // UART config
26 // mikroBUS slot 1
27 #define MICROPY_HW_UART3_NAME "SLOT1"
28 #define MICROPY_HW_UART3_TX (pin_D8)
29 #define MICROPY_HW_UART3_RX (pin_D9)
30 // mikroBUS slot 2
31 #define MICROPY_HW_UART2_NAME "SLOT2"
32 #define MICROPY_HW_UART2_TX (pin_D5)
33 #define MICROPY_HW_UART2_RX (pin_D6)
34 // mikroBUS slot 3
35 #define MICROPY_HW_UART6_NAME "SLOT3"
36 #define MICROPY_HW_UART6_TX (pin_C6)
37 #define MICROPY_HW_UART6_RX (pin_C7)
38 // mikroBUS slot 4
39 #define MICROPY_HW_UART1_NAME "SLOT4"
40 #define MICROPY_HW_UART1_TX (pin_A9)
41 #define MICROPY_HW_UART1_RX (pin_A10)
42
43 // I2C buses
44 // mikroBUS slot 1, 2, 3, 4, and header
45 #define MICROPY_HW_I2C1_NAME "SLOT1234H"
46 #define MICROPY_HW_I2C1_SCL (pin_B6)
47 #define MICROPY_HW_I2C1_SDA (pin_B7)
48
49 // SPI buses
50 // mikroBUS slot 1, 2, and header
51 #define MICROPY_HW_SPI1_NAME "SLOT12H"
52 #define MICROPY_HW_SPI1_SCK (pin_B3)
53 #define MICROPY_HW_SPI1_MISO (pin_B4)
54 #define MICROPY_HW_SPI1_MOSI (pin_B5)
55 // mikroBUS slot 3, 4, and FLASH
56 #define MICROPY_HW_SPI3_NAME "SLOT34F"
57 #define MICROPY_HW_SPI3_SCK (pin_C10)
58 #define MICROPY_HW_SPI3_MISO (pin_C11)
59 #define MICROPY_HW_SPI3_MOSI (pin_C12)
60
61 // LEDs
62 #define MICROPY_HW_LED1 (pin_E15) // orange
63 #define MICROPY_HW_LED2 (pin_E10) // green
64 #define MICROPY_HW_LED3 (pin_C3) // red
65 #define MICROPY_HW_LED_ON(pin) (mp_hal_pin_high(pin))
66 #define MICROPY_HW_LED_OFF(pin) (mp_hal_pin_low(pin))
67
68 // USB config
69 #define MICROPY_HW_USB_FS (1)
70
71 // External SPI Flash config (Cypress S25FL164K)
72 #if !MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE
73
74 #define MICROPY_HW_SPI_IS_STATIC(id) (id == 3) // Shared with SPIFLASH.
75 #define MICROPY_HW_SPIFLASH_SIZE_BITS (64 * 1024 * 1024) // 64 Mbit (8 MByte)
76
77 #define MICROPY_HW_SPIFLASH_CS (pin_A13)
78 #define MICROPY_HW_SPIFLASH_SCK (MICROPY_HW_SPI3_SCK)
79 #define MICROPY_HW_SPIFLASH_MISO (MICROPY_HW_SPI3_MISO)
80 #define MICROPY_HW_SPIFLASH_MOSI (MICROPY_HW_SPI3_MOSI)
81
82 extern const struct _mp_spiflash_config_t spiflash_config;
83 extern struct _spi_bdev_t spi_bdev;
84 #define MICROPY_HW_SPIFLASH_ENABLE_CACHE (1)
85 #define MICROPY_HW_BDEV_SPIFLASH (&spi_bdev)
86 #define MICROPY_HW_BDEV_SPIFLASH_CONFIG (&spiflash_config)
87 #define MICROPY_HW_BDEV_SPIFLASH_SIZE_BYTES (MICROPY_HW_SPIFLASH_SIZE_BITS / 8)
88 #define MICROPY_HW_BDEV_SPIFLASH_EXTENDED (&spi_bdev) // for extended block protocol
89
90 #endif // !MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE
91
92 // Bootloader configuration (only needed if Mboot is used)
93 #define MBOOT_I2C_PERIPH_ID 1
94 #define MBOOT_I2C_SCL (pin_B6)
95 #define MBOOT_I2C_SDA (pin_B7)
96 #define MBOOT_I2C_ALTFUNC (4)
97 #define MBOOT_FSLOAD (1)
98 #define MBOOT_VFS_FAT (1)
99
100 #define MBOOT_SPIFLASH_ADDR (0x80000000)
101 #define MBOOT_SPIFLASH_BYTE_SIZE (8 * 1024 * 1024)
102 #define MBOOT_SPIFLASH_LAYOUT "/0x80000000/512*8Kg"
103 #define MBOOT_SPIFLASH_ERASE_BLOCKS_PER_PAGE \
104 (8 / 4) // 8k page, 4k erase block
105 #define MBOOT_SPIFLASH_CONFIG (&spiflash_config)
106 #define MBOOT_SPIFLASH_SPIFLASH (&spi_bdev.spiflash)