Skip to content

Commit b8c8e85

Browse files
authored
Merge pull request #6945 from flom84/main
Add circuitpython support for STM Nucleo-F446RE development board.
2 parents f8d2ff0 + 96a83ec commit b8c8e85

File tree

15 files changed

+722
-3
lines changed

15 files changed

+722
-3
lines changed

ports/stm/boards/STM32F446_fs.ld

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
GNU linker script for STM32F446 with filesystem
3+
*/
4+
5+
/* Specify the memory areas */
6+
MEMORY
7+
{
8+
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 512K /* entire flash */
9+
FLASH_ISR (rx) : ORIGIN = 0x08000000, LENGTH = 16K /* sector 0 */
10+
FLASH_FS (rx) : ORIGIN = 0x08004000, LENGTH = 48K /* sectors 1,2,3 are 16K */
11+
FLASH_FIRMWARE (rx) : ORIGIN = 0x08010000, LENGTH = 448K /* sector 4 is 64K, sectors 5,6,7 are 128K */
12+
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
13+
}
14+
15+
/* produce a link error if there is not this amount of RAM for these sections */
16+
_minimum_stack_size = 24K;
17+
_minimum_heap_size = 16K;
18+
19+
/* Define tho top end of the stack. The stack is full descending so begins just
20+
above last byte of RAM. Note that EABI requires the stack to be 8-byte
21+
aligned for a call. */
22+
_estack = ORIGIN(RAM) + LENGTH(RAM);
23+
24+
/* RAM extents for the garbage collector */
25+
_ram_start = ORIGIN(RAM);
26+
_ram_end = ORIGIN(RAM) + LENGTH(RAM);
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* This file is part of the MicroPython project, http://micropython.org/
3+
*
4+
* The MIT License (MIT)
5+
*
6+
* Copyright (c) 2022 flom84
7+
*
8+
* Permission is hereby granted, free of charge, to any person obtaining a copy
9+
* of this software and associated documentation files (the "Software"), to deal
10+
* in the Software without restriction, including without limitation the rights
11+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
* copies of the Software, and to permit persons to whom the Software is
13+
* furnished to do so, subject to the following conditions:
14+
*
15+
* The above copyright notice and this permission notice shall be included in
16+
* all copies or substantial portions of the Software.
17+
*
18+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24+
* THE SOFTWARE.
25+
*/
26+
27+
#include "supervisor/board.h"
28+
29+
// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*
2+
* This file is part of the MicroPython project, http://micropython.org/
3+
*
4+
* The MIT License (MIT)
5+
*
6+
* Copyright (c) 2022 flom84
7+
*
8+
* Permission is hereby granted, free of charge, to any person obtaining a copy
9+
* of this software and associated documentation files (the "Software"), to deal
10+
* in the Software without restriction, including without limitation the rights
11+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
* copies of the Software, and to permit persons to whom the Software is
13+
* furnished to do so, subject to the following conditions:
14+
*
15+
* The above copyright notice and this permission notice shall be included in
16+
* all copies or substantial portions of the Software.
17+
*
18+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24+
* THE SOFTWARE.
25+
*/
26+
27+
// Micropython setup
28+
29+
#define MICROPY_HW_BOARD_NAME "NUCLEO F446RE"
30+
#define MICROPY_HW_MCU_NAME "STM32F446xx"
31+
32+
#define FLASH_SIZE (0x80000u) // 512K
33+
#define FLASH_PAGE_SIZE (0x4000u) // 16K
34+
35+
#define HSE_VALUE ((uint32_t)8000000u)
36+
#define BOARD_HSE_SOURCE (RCC_HSE_ON)
37+
// The schematic has a 32k crystal that isn't fitted. Uncommented the line below if you add it.
38+
// #define BOARD_HAS_LOW_SPEED_CRYSTAL (1)
39+
// #define LSE_VALUE ((uint32_t)32000U)
40+
#define BOARD_HAS_LOW_SPEED_CRYSTAL (0)
41+
42+
// USART3 + USB FTDI
43+
// #define CIRCUITPY_CONSOLE_UART_TX (&pin_PC10)
44+
// #define CIRCUITPY_CONSOLE_UART_RX (&pin_PC11)
45+
46+
// USART2 + ST link
47+
// #define CIRCUITPY_CONSOLE_UART_TX (&pin_PA02)
48+
// #define CIRCUITPY_CONSOLE_UART_RX (&pin_PA03)
49+
50+
// Status LEDs
51+
#define MICROPY_HW_LED_STATUS (&pin_PA05)
52+
53+
#define MICROPY_FATFS_EXFAT 0
54+
55+
#define BOARD_NO_VBUS_SENSE (1)
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
USB_VID = 0x0483
2+
USB_PID = 0x572A
3+
USB_PRODUCT = "NUCLEO-F446RE - CPy"
4+
USB_MANUFACTURER = "STMicroelectronics"
5+
6+
INTERNAL_FLASH_FILESYSTEM = 1
7+
8+
MCU_SERIES = F4
9+
MCU_VARIANT = STM32F446xx
10+
MCU_PACKAGE = LQFP64
11+
12+
LD_COMMON = boards/common_default.ld
13+
LD_FILE = boards/STM32F446_fs.ld
14+
15+
# Too big for the flash
16+
CIRCUITPY_AUDIOCORE = 0
17+
CIRCUITPY_AUDIOPWMIO = 0
18+
CIRCUITPY_BITMAPTOOLS = 0
19+
CIRCUITPY_BLEIO_HCI = 0
20+
CIRCUITPY_VECTORIO = 0
21+
CIRCUITPY_TOUCHIO = 0
22+
CIRCUITPY_RAINBOWIO = 0
23+
CIRCUITPY_USB_HID = 0
24+
CIRCUITPY_USB_MIDI = 0
25+
CIRCUITPY_JSON = 0
26+
# Requires neopixel_write or SPI (dotstar)
27+
CIRCUITPY_PIXELBUF = 0
28+
# No requirements, but takes extra flash
29+
CIRCUITPY_ULAB = 0
30+
CIRCUITPY_GAMEPADSHIFT = 0
31+
CIRCUITPY_BITBANGIO = 0
32+
CIRCUITPY_NEOPIXEL_WRITE = 0
33+
CIRCUITPY_SDCARDIO = 0
34+
CIRCUITPY_DISPLAYIO = 0
35+
CIRCUITPY_KEYPAD = 0

ports/stm/boards/nucleo_f446re/pins.c

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
#include "shared-bindings/board/__init__.h"
2+
3+
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
4+
{MP_ROM_QSTR(MP_QSTR_ID), MP_ROM_PTR(&board_module_id_obj)},
5+
{MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA03)},
6+
{MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA02)},
7+
{MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PA10)},
8+
{MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PB03)},
9+
{MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PB05)},
10+
{MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PB04)},
11+
{MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PB10)},
12+
{MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PA08)},
13+
{MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PA09)},
14+
{MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PC07)},
15+
{MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PB06)},
16+
{MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA07)},
17+
{MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA06)},
18+
{MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA05)},
19+
{MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_PB09)},
20+
{MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_PB08)},
21+
{MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA00)},
22+
{MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA01)},
23+
{MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PA04)},
24+
{MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PB00)},
25+
{MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PC01)},
26+
{MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PC00)},
27+
{MP_ROM_QSTR(MP_QSTR_PA0), MP_ROM_PTR(&pin_PA00)},
28+
{MP_ROM_QSTR(MP_QSTR_PA1), MP_ROM_PTR(&pin_PA01)},
29+
{MP_ROM_QSTR(MP_QSTR_PA2), MP_ROM_PTR(&pin_PA02)},
30+
{MP_ROM_QSTR(MP_QSTR_PA3), MP_ROM_PTR(&pin_PA03)},
31+
{MP_ROM_QSTR(MP_QSTR_PA4), MP_ROM_PTR(&pin_PA04)},
32+
{MP_ROM_QSTR(MP_QSTR_PA5), MP_ROM_PTR(&pin_PA05)},
33+
{MP_ROM_QSTR(MP_QSTR_PA6), MP_ROM_PTR(&pin_PA06)},
34+
{MP_ROM_QSTR(MP_QSTR_PA7), MP_ROM_PTR(&pin_PA07)},
35+
{MP_ROM_QSTR(MP_QSTR_PA8), MP_ROM_PTR(&pin_PA08)},
36+
{MP_ROM_QSTR(MP_QSTR_PA9), MP_ROM_PTR(&pin_PA09)},
37+
{MP_ROM_QSTR(MP_QSTR_PA10), MP_ROM_PTR(&pin_PA10)},
38+
{MP_ROM_QSTR(MP_QSTR_PA11), MP_ROM_PTR(&pin_PA11)},
39+
{MP_ROM_QSTR(MP_QSTR_PA12), MP_ROM_PTR(&pin_PA12)},
40+
{MP_ROM_QSTR(MP_QSTR_PA15), MP_ROM_PTR(&pin_PA15)},
41+
{MP_ROM_QSTR(MP_QSTR_PB0), MP_ROM_PTR(&pin_PB00)},
42+
{MP_ROM_QSTR(MP_QSTR_PB1), MP_ROM_PTR(&pin_PB01)},
43+
{MP_ROM_QSTR(MP_QSTR_PB2), MP_ROM_PTR(&pin_PB02)},
44+
{MP_ROM_QSTR(MP_QSTR_PB3), MP_ROM_PTR(&pin_PB03)},
45+
{MP_ROM_QSTR(MP_QSTR_PB4), MP_ROM_PTR(&pin_PB04)},
46+
{MP_ROM_QSTR(MP_QSTR_PB5), MP_ROM_PTR(&pin_PB05)},
47+
{MP_ROM_QSTR(MP_QSTR_PB6), MP_ROM_PTR(&pin_PB06)},
48+
{MP_ROM_QSTR(MP_QSTR_PB7), MP_ROM_PTR(&pin_PB07)},
49+
{MP_ROM_QSTR(MP_QSTR_PB8), MP_ROM_PTR(&pin_PB08)},
50+
{MP_ROM_QSTR(MP_QSTR_PB9), MP_ROM_PTR(&pin_PB09)},
51+
{MP_ROM_QSTR(MP_QSTR_PB10), MP_ROM_PTR(&pin_PB10)},
52+
{MP_ROM_QSTR(MP_QSTR_PB12), MP_ROM_PTR(&pin_PB12)},
53+
{MP_ROM_QSTR(MP_QSTR_PB13), MP_ROM_PTR(&pin_PB13)},
54+
{MP_ROM_QSTR(MP_QSTR_PB14), MP_ROM_PTR(&pin_PB14)},
55+
{MP_ROM_QSTR(MP_QSTR_PB15), MP_ROM_PTR(&pin_PB15)},
56+
{MP_ROM_QSTR(MP_QSTR_PC0), MP_ROM_PTR(&pin_PC00)},
57+
{MP_ROM_QSTR(MP_QSTR_PC1), MP_ROM_PTR(&pin_PC01)},
58+
{MP_ROM_QSTR(MP_QSTR_PC2), MP_ROM_PTR(&pin_PC02)},
59+
{MP_ROM_QSTR(MP_QSTR_PC3), MP_ROM_PTR(&pin_PC03)},
60+
{MP_ROM_QSTR(MP_QSTR_PC4), MP_ROM_PTR(&pin_PC04)},
61+
{MP_ROM_QSTR(MP_QSTR_PC5), MP_ROM_PTR(&pin_PC05)},
62+
{MP_ROM_QSTR(MP_QSTR_PC6), MP_ROM_PTR(&pin_PC06)},
63+
{MP_ROM_QSTR(MP_QSTR_PC7), MP_ROM_PTR(&pin_PC07)},
64+
{MP_ROM_QSTR(MP_QSTR_PC8), MP_ROM_PTR(&pin_PC08)},
65+
{MP_ROM_QSTR(MP_QSTR_PC9), MP_ROM_PTR(&pin_PC09)},
66+
{MP_ROM_QSTR(MP_QSTR_PC10), MP_ROM_PTR(&pin_PC10)},
67+
{MP_ROM_QSTR(MP_QSTR_PC11), MP_ROM_PTR(&pin_PC11)},
68+
{MP_ROM_QSTR(MP_QSTR_PC12), MP_ROM_PTR(&pin_PC12)},
69+
{MP_ROM_QSTR(MP_QSTR_PC13), MP_ROM_PTR(&pin_PC13)},
70+
{MP_ROM_QSTR(MP_QSTR_PC14), MP_ROM_PTR(&pin_PC14)},
71+
{MP_ROM_QSTR(MP_QSTR_PC15), MP_ROM_PTR(&pin_PC15)},
72+
{MP_ROM_QSTR(MP_QSTR_PD2), MP_ROM_PTR(&pin_PD02)},
73+
{MP_ROM_QSTR(MP_QSTR_PH0), MP_ROM_PTR(&pin_PH00)},
74+
{MP_ROM_QSTR(MP_QSTR_PH1), MP_ROM_PTR(&pin_PH01)},
75+
{MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_PA05)},
76+
{MP_ROM_QSTR(MP_QSTR_SW), MP_ROM_PTR(&pin_PC13)},
77+
};
78+
MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);

ports/stm/peripherals/periph.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,13 @@ typedef struct {
119119
#include "stm32f4/stm32f407xx/periph.h"
120120
#endif
121121

122+
#ifdef STM32F446xx
123+
#define HAS_DAC 0
124+
#define HAS_TRNG 0
125+
#define HAS_BASIC_TIM 0
126+
#include "stm32f4/stm32f446xx/periph.h"
127+
#endif
128+
122129
// F7 Series
123130

124131
#ifdef STM32F746xx

ports/stm/peripherals/pins.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ extern const mp_obj_type_t mcu_pin_type;
9797
#ifdef STM32F407xx
9898
#include "stm32f4/stm32f407xx/pins.h"
9999
#endif
100+
#ifdef STM32F446xx
101+
#include "stm32f4/stm32f446xx/pins.h"
102+
#endif
100103

101104
// F7 Series
102105
#ifdef STM32F746xx

ports/stm/peripherals/stm32f4/clocks.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,14 @@
4747
#ifdef STM32F407xx
4848
#include "stm32f4/stm32f407xx/clocks.h"
4949
#endif
50+
#ifdef STM32F446xx
51+
#include "stm32f4/stm32f446xx/clocks.h"
52+
#endif
5053

5154
void stm32_peripherals_clocks_init(void) {
52-
RCC_ClkInitTypeDef RCC_ClkInitStruct;
53-
RCC_OscInitTypeDef RCC_OscInitStruct;
54-
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct;
55+
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
56+
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
57+
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
5558

5659
// Set voltage scaling in accordance with system clock speed
5760
__HAL_RCC_PWR_CLK_ENABLE();
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/*
2+
* This file is part of the Micro Python project, http://micropython.org/
3+
*
4+
* The MIT License (MIT)
5+
*
6+
* Copyright (c) 2022 flom84
7+
*
8+
* Permission is hereby granted, free of charge, to any person obtaining a copy
9+
* of this software and associated documentation files (the "Software"), to deal
10+
* in the Software without restriction, including without limitation the rights
11+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
* copies of the Software, and to permit persons to whom the Software is
13+
* furnished to do so, subject to the following conditions:
14+
*
15+
* The above copyright notice and this permission notice shall be included in
16+
* all copies or substantial portions of the Software.
17+
*
18+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24+
* THE SOFTWARE.
25+
*/
26+
27+
#include "stm32f4xx_hal.h"
28+
29+
// Chip: STM32F446xC/xV
30+
// Line Type: Access Line
31+
// Speed: 168MHz (max 180MHz)
32+
33+
// Defaults:
34+
#ifndef CPY_CLK_VSCALE
35+
#define CPY_CLK_VSCALE (PWR_REGULATOR_VOLTAGE_SCALE1)
36+
#endif
37+
#ifndef CPY_CLK_PLLM
38+
#define CPY_CLK_PLLM (8)
39+
#endif
40+
#ifndef CPY_CLK_PLLN
41+
#define CPY_CLK_PLLN (336)
42+
#endif
43+
#ifndef CPY_CLK_PLLP
44+
#define CPY_CLK_PLLP (RCC_PLLP_DIV2)
45+
#endif
46+
#ifndef CPY_CLK_PLLQ
47+
#define CPY_CLK_PLLQ (7)
48+
#endif
49+
#ifndef CPY_CLK_AHBDIV
50+
#define CPY_CLK_AHBDIV (RCC_SYSCLK_DIV1)
51+
#endif
52+
#ifndef CPY_CLK_APB1DIV
53+
#define CPY_CLK_APB1DIV (RCC_HCLK_DIV4)
54+
#endif
55+
#ifndef CPY_CLK_APB2DIV
56+
#define CPY_CLK_APB2DIV (RCC_HCLK_DIV2)
57+
#endif
58+
#ifndef CPY_CLK_FLASH_LATENCY
59+
#define CPY_CLK_FLASH_LATENCY (FLASH_LATENCY_5)
60+
#endif
61+
#ifndef CPY_CLK_USB_USES_AUDIOPLL
62+
#define CPY_CLK_USB_USES_AUDIOPLL (0)
63+
#endif
64+
#ifndef BOARD_HSE_SOURCE
65+
#define BOARD_HSE_SOURCE (RCC_HSE_ON)
66+
#endif
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* This file is part of the Micro Python project, http://micropython.org/
3+
*
4+
* The MIT License (MIT)
5+
*
6+
* Copyright (c) 2022 flom84
7+
*
8+
* Permission is hereby granted, free of charge, to any person obtaining a copy
9+
* of this software and associated documentation files (the "Software"), to deal
10+
* in the Software without restriction, including without limitation the rights
11+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
* copies of the Software, and to permit persons to whom the Software is
13+
* furnished to do so, subject to the following conditions:
14+
*
15+
* The above copyright notice and this permission notice shall be included in
16+
* all copies or substantial portions of the Software.
17+
*
18+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24+
* THE SOFTWARE.
25+
*/
26+
27+
#include "peripherals/gpio.h"
28+
#include "stm32f4xx_hal.h"
29+
#include "common-hal/microcontroller/Pin.h"
30+
31+
void stm32_peripherals_gpio_init(void) {
32+
// * GPIO Ports Clock Enable */
33+
__HAL_RCC_GPIOC_CLK_ENABLE();
34+
__HAL_RCC_GPIOH_CLK_ENABLE();
35+
__HAL_RCC_GPIOA_CLK_ENABLE();
36+
__HAL_RCC_GPIOB_CLK_ENABLE();
37+
38+
// Never reset pins
39+
never_reset_pin_number(2, 13); // PC13 anti tamp
40+
never_reset_pin_number(2, 14); // PC14 OSC32_IN
41+
never_reset_pin_number(2, 15); // PC15 OSC32_OUT
42+
never_reset_pin_number(0, 13); // PA13 SWDIO
43+
never_reset_pin_number(0, 14); // PA14 SWCLK
44+
}
45+
46+
void stm32f4_peripherals_status_led(uint8_t led, uint8_t state) {
47+
}

0 commit comments

Comments
 (0)