summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHierophect <hierophect@gmail.com>2019-12-12 16:32:33 -0500
committerHierophect <hierophect@gmail.com>2019-12-12 16:32:33 -0500
commit7e0719117bca20ab4345504d888aa5638abdb98c (patch)
treeafdaaf3c3ec1d8b81a92187e88d1217a834a2f60
parent2be18a7b530149926d492f7b8d5c583849906964 (diff)
Revert "remove F401 additions to streamline"
This reverts commit 12737e282152d7bed7dac540029af9dd5b423ec6.
-rw-r--r--ports/stm32f4/peripherals/stm32f4/periph.h6
-rw-r--r--ports/stm32f4/peripherals/stm32f4/stm32f401xe/clocks.c61
-rw-r--r--ports/stm32f4/peripherals/stm32f4/stm32f401xe/gpio.c54
-rw-r--r--ports/stm32f4/peripherals/stm32f4/stm32f401xe/periph.c172
-rw-r--r--ports/stm32f4/peripherals/stm32f4/stm32f401xe/periph.h57
-rw-r--r--ports/stm32f4/peripherals/stm32f4/stm32f401xe/pins.c123
-rw-r--r--ports/stm32f4/peripherals/stm32f4/stm32f401xe/pins.h121
7 files changed, 594 insertions, 0 deletions
diff --git a/ports/stm32f4/peripherals/stm32f4/periph.h b/ports/stm32f4/peripherals/stm32f4/periph.h
index 0d1374e85..ac98b8932 100644
--- a/ports/stm32f4/peripherals/stm32f4/periph.h
+++ b/ports/stm32f4/peripherals/stm32f4/periph.h
@@ -140,6 +140,12 @@ typedef struct {
//Starter Lines
+#ifdef STM32F401xE
+#define HAS_DAC 0
+#define HAS_TRNG 0
+#include "stm32f401xe/periph.h"
+#endif
+
#ifdef STM32F411xE
#define HAS_DAC 0
#define HAS_TRNG 0
diff --git a/ports/stm32f4/peripherals/stm32f4/stm32f401xe/clocks.c b/ports/stm32f4/peripherals/stm32f4/stm32f401xe/clocks.c
new file mode 100644
index 000000000..883c252d5
--- /dev/null
+++ b/ports/stm32f4/peripherals/stm32f4/stm32f401xe/clocks.c
@@ -0,0 +1,61 @@
+
+/*
+ * This file is part of the Micro Python project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019 Lucian Copeland for Adafruit Industries
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+#include "stm32f4xx_hal.h"
+
+void stm32f4_peripherals_clocks_init(void) {
+ //System clock init
+ RCC_ClkInitTypeDef RCC_ClkInitStruct;
+ RCC_OscInitTypeDef RCC_OscInitStruct;
+
+ /* Enable Power Control clock */
+ __HAL_RCC_PWR_CLK_ENABLE();
+
+ /* The voltage scaling allows optimizing the power consumption when the device is
+ clocked below the maximum system frequency, to update the voltage scaling value
+ regarding system frequency refer to product datasheet. */
+ __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE2);
+
+ /* Enable HSE Oscillator and activate PLL with HSE as source */
+ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
+ RCC_OscInitStruct.HSEState = RCC_HSE_ON;
+ RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
+ RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
+ RCC_OscInitStruct.PLL.PLLM = 8;
+ RCC_OscInitStruct.PLL.PLLN = 336;
+ RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV4;
+ RCC_OscInitStruct.PLL.PLLQ = 7;
+ HAL_RCC_OscConfig(&RCC_OscInitStruct);
+
+ /* Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2
+ clocks dividers */
+ RCC_ClkInitStruct.ClockType = (RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2);
+ RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
+ RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
+ RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2;
+ RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
+ HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_3);
+}
diff --git a/ports/stm32f4/peripherals/stm32f4/stm32f401xe/gpio.c b/ports/stm32f4/peripherals/stm32f4/stm32f401xe/gpio.c
new file mode 100644
index 000000000..45dc8fc6f
--- /dev/null
+++ b/ports/stm32f4/peripherals/stm32f4/stm32f401xe/gpio.c
@@ -0,0 +1,54 @@
+/*
+ * This file is part of the Micro Python project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019 Lucian Copeland for Adafruit Industries
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include "stm32f4xx_hal.h"
+#include "stm32f4/gpio.h"
+#include "common-hal/microcontroller/Pin.h"
+
+void stm32f4_peripherals_gpio_init(void) {
+ //Enable all GPIO for now
+ GPIO_InitTypeDef GPIO_InitStruct = {0};
+ /* GPIO Ports Clock Enable */
+ __HAL_RCC_GPIOA_CLK_ENABLE();
+ __HAL_RCC_GPIOB_CLK_ENABLE();
+ __HAL_RCC_GPIOC_CLK_ENABLE();
+ __HAL_RCC_GPIOD_CLK_ENABLE();
+ __HAL_RCC_GPIOE_CLK_ENABLE();
+ __HAL_RCC_GPIOH_CLK_ENABLE();
+
+ //Never reset pins
+ never_reset_pin_number(2,13); //PC13 anti tamp
+ never_reset_pin_number(2,14); //PC14 OSC32_IN
+ never_reset_pin_number(2,15); //PC15 OSC32_OUT
+ never_reset_pin_number(0,13); //PA13 SWDIO
+ never_reset_pin_number(0,14); //PA14 SWCLK
+}
+
+//LEDs are inverted on F411 DISCO
+void stm32f4_peripherals_status_led(uint8_t led, uint8_t state) {
+}
+
+
diff --git a/ports/stm32f4/peripherals/stm32f4/stm32f401xe/periph.c b/ports/stm32f4/peripherals/stm32f4/stm32f401xe/periph.c
new file mode 100644
index 000000000..859e9a1ad
--- /dev/null
+++ b/ports/stm32f4/peripherals/stm32f4/stm32f401xe/periph.c
@@ -0,0 +1,172 @@
+ /*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019 Lucian Copeland for Adafruit Industries
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include "py/obj.h"
+#include "py/mphal.h"
+#include "stm32f4/pins.h"
+#include "stm32f4/periph.h"
+
+// I2C
+
+I2C_TypeDef * mcu_i2c_banks[3] = {I2C1, I2C2, I2C3};
+
+const mcu_i2c_sda_obj_t mcu_i2c_sda_list[5] = {
+ I2C_SDA(1, 4, &pin_PB07),
+ I2C_SDA(1, 4, &pin_PB09),
+ I2C_SDA(2, 9, &pin_PB03),
+ I2C_SDA(3, 4, &pin_PC09),
+ I2C_SDA(3, 9, &pin_PB04),
+};
+
+const mcu_i2c_scl_obj_t mcu_i2c_scl_list[4] = {
+ I2C_SCL(1, 4, &pin_PB06),
+ I2C_SCL(1, 4, &pin_PB08),
+ I2C_SCL(2, 4, &pin_PB10),
+ I2C_SCL(3, 4, &pin_PA08)
+};
+
+// SPI
+
+SPI_TypeDef * mcu_spi_banks[4] = {SPI1, SPI2, SPI3, SPI4};
+
+const mcu_spi_sck_obj_t mcu_spi_sck_list[9] = {
+ SPI(1, 5, &pin_PA05),
+ SPI(1, 5, &pin_PB03),
+ SPI(2, 5, &pin_PB10),
+ SPI(2, 5, &pin_PB13),
+ SPI(2, 5, &pin_PD03),
+ SPI(3, 6, &pin_PB03),
+ SPI(3, 6, &pin_PC10),
+ SPI(4, 5, &pin_PE02),
+ SPI(4, 5, &pin_PE12),
+};
+
+const mcu_spi_mosi_obj_t mcu_spi_mosi_list[9] = {
+ SPI(1, 5, &pin_PA07),
+ SPI(1, 5, &pin_PB05),
+ SPI(2, 5, &pin_PB15),
+ SPI(2, 5, &pin_PC03),
+ SPI(3, 6, &pin_PB05),
+ SPI(3, 6, &pin_PC12),
+ SPI(3, 5, &pin_PD06),
+ SPI(4, 5, &pin_PE06),
+ SPI(4, 5, &pin_PE14),
+};
+
+const mcu_spi_miso_obj_t mcu_spi_miso_list[8] = {
+ SPI(1, 5, &pin_PA06),
+ SPI(1, 5, &pin_PB04),
+ SPI(2, 5, &pin_PB14),
+ SPI(2, 5, &pin_PC02),
+ SPI(3, 6, &pin_PB04),
+ SPI(3, 6, &pin_PC11),
+ SPI(4, 5, &pin_PE05),
+ SPI(4, 5, &pin_PE13),
+};
+
+const mcu_spi_nss_obj_t mcu_spi_nss_list[9] = {
+ SPI(1, 5, &pin_PA04),
+ SPI(1, 5, &pin_PA15),
+ SPI(2, 5, &pin_PB09),
+ SPI(2, 5, &pin_PB12),
+ SPI(3, 6, &pin_PA04),
+ SPI(3, 6, &pin_PA15),
+ SPI(4, 6, &pin_PB12),
+ SPI(4, 5, &pin_PE04),
+ SPI(4, 5, &pin_PE11),
+};
+
+USART_TypeDef * mcu_uart_banks[MAX_UART] = {USART1, USART2, NULL, NULL, NULL, USART6};
+bool mcu_uart_has_usart[MAX_UART] = {true, true, false, false, false, true};
+
+const mcu_uart_tx_obj_t mcu_uart_tx_list[6] = {
+ UART(2, 7, &pin_PA02),
+ UART(1, 7, &pin_PA09),
+ UART(6, 8, &pin_PA11),
+ UART(1, 7, &pin_PB06),
+ UART(6, 8, &pin_PC06),
+ UART(2, 7, &pin_PD05),
+};
+
+const mcu_uart_rx_obj_t mcu_uart_rx_list[6] = {
+ UART(2, 7, &pin_PA03),
+ UART(1, 7, &pin_PA10),
+ UART(6, 8, &pin_PA12),
+ UART(1, 7, &pin_PB07),
+ UART(6, 8, &pin_PC07),
+ UART(2, 7, &pin_PD06),
+};
+
+//Timers
+//TIM6 and TIM7 are basic timers that are only used by DAC, and don't have pins
+TIM_TypeDef * mcu_tim_banks[14] = {TIM1, TIM2, TIM3, TIM4, TIM5, NULL, NULL, NULL, TIM9, TIM10,
+ TIM11, NULL, NULL, NULL};
+
+const mcu_tim_pin_obj_t mcu_tim_pin_list[44] = {
+ TIM(2,1,1,&pin_PA00),
+ TIM(5,2,1,&pin_PA00),
+ TIM(2,1,2,&pin_PA01),
+ TIM(5,2,2,&pin_PA01),
+ TIM(2,1,3,&pin_PA02),
+ TIM(5,2,3,&pin_PA02),
+ TIM(2,1,4,&pin_PA03),
+ TIM(5,2,4,&pin_PA03),
+ TIM(9,3,1,&pin_PA02),
+ TIM(9,3,2,&pin_PA03),
+ TIM(3,2,1,&pin_PA06),
+ TIM(3,2,2,&pin_PA07),
+ TIM(1,1,1,&pin_PA08),
+ TIM(1,1,2,&pin_PA09),
+ TIM(1,1,3,&pin_PA10),
+ TIM(1,1,4,&pin_PA11),
+ TIM(2,1,1,&pin_PA15),
+ TIM(3,2,3,&pin_PB00),
+ TIM(3,2,4,&pin_PB01),
+ TIM(2,1,2,&pin_PB03),
+ TIM(3,2,1,&pin_PB04),
+ TIM(3,2,2,&pin_PB05),
+ TIM(4,2,1,&pin_PB06),
+ TIM(4,2,2,&pin_PB07),
+ TIM(4,2,3,&pin_PB08),
+ TIM(10,2,1,&pin_PB08),
+ TIM(4,2,4,&pin_PB09),
+ TIM(11,2,1,&pin_PB09),
+ TIM(2,1,3,&pin_PB10),
+ TIM(3,2,1,&pin_PC06),
+ TIM(3,2,2,&pin_PC07),
+ TIM(3,2,3,&pin_PC08),
+ TIM(3,2,4,&pin_PC09),
+ TIM(4,2,1,&pin_PD12),
+ TIM(4,2,2,&pin_PD13),
+ TIM(4,2,3,&pin_PD14),
+ TIM(4,2,4,&pin_PD15),
+ TIM(9,3,1,&pin_PE05),
+ TIM(9,3,2,&pin_PE06),
+ TIM(1,1,1,&pin_PE09),
+ TIM(1,1,2,&pin_PE11),
+ TIM(1,1,3,&pin_PE13),
+ TIM(1,1,4,&pin_PE14),
+};
diff --git a/ports/stm32f4/peripherals/stm32f4/stm32f401xe/periph.h b/ports/stm32f4/peripherals/stm32f4/stm32f401xe/periph.h
new file mode 100644
index 000000000..7d3f4dca2
--- /dev/null
+++ b/ports/stm32f4/peripherals/stm32f4/stm32f401xe/periph.h
@@ -0,0 +1,57 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019 Lucian Copeland for Adafruit Industries
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#ifndef MICROPY_INCLUDED_STM32F4_PERIPHERALS_STM32F411VE_PERIPH_H
+#define MICROPY_INCLUDED_STM32F4_PERIPHERALS_STM32F411VE_PERIPH_H
+
+//I2C
+extern I2C_TypeDef * mcu_i2c_banks[3];
+
+extern const mcu_i2c_sda_obj_t mcu_i2c_sda_list[5];
+extern const mcu_i2c_scl_obj_t mcu_i2c_scl_list[4];
+
+//SPI
+extern SPI_TypeDef * mcu_spi_banks[4];
+
+extern const mcu_spi_sck_obj_t mcu_spi_sck_list[9];
+extern const mcu_spi_mosi_obj_t mcu_spi_mosi_list[9];
+extern const mcu_spi_miso_obj_t mcu_spi_miso_list[8];
+extern const mcu_spi_nss_obj_t mcu_spi_nss_list[9];
+
+//UART
+extern USART_TypeDef * mcu_uart_banks[MAX_UART];
+extern bool mcu_uart_has_usart[MAX_UART];
+
+extern const mcu_uart_tx_obj_t mcu_uart_tx_list[6];
+extern const mcu_uart_rx_obj_t mcu_uart_rx_list[6];
+
+//Timers
+#define TIM_BANK_ARRAY_LEN 14
+#define TIM_PIN_ARRAY_LEN 44
+TIM_TypeDef * mcu_tim_banks[TIM_BANK_ARRAY_LEN];
+const mcu_tim_pin_obj_t mcu_tim_pin_list[TIM_PIN_ARRAY_LEN];
+
+#endif // MICROPY_INCLUDED_STM32F4_PERIPHERALS_STM32F411VE_PERIPH_H \ No newline at end of file
diff --git a/ports/stm32f4/peripherals/stm32f4/stm32f401xe/pins.c b/ports/stm32f4/peripherals/stm32f4/stm32f401xe/pins.c
new file mode 100644
index 000000000..7e88c3dcb
--- /dev/null
+++ b/ports/stm32f4/peripherals/stm32f4/stm32f401xe/pins.c
@@ -0,0 +1,123 @@
+ /*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019 Lucian Copeland for Adafruit Industries
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include "py/obj.h"
+#include "py/mphal.h"
+#include "stm32f4/pins.h"
+
+const mcu_pin_obj_t pin_PE02 = PIN(4, 2, NO_ADC);
+const mcu_pin_obj_t pin_PE03 = PIN(4, 3, NO_ADC);
+const mcu_pin_obj_t pin_PE04 = PIN(4, 4, NO_ADC);
+const mcu_pin_obj_t pin_PE05 = PIN(4, 5, NO_ADC);
+const mcu_pin_obj_t pin_PE06 = PIN(4, 6, NO_ADC);
+
+const mcu_pin_obj_t pin_PC13 = PIN(2, 13, NO_ADC); //anti-tamp
+const mcu_pin_obj_t pin_PC14 = PIN(2, 14, NO_ADC); //OSC32_IN
+const mcu_pin_obj_t pin_PC15 = PIN(2, 15, NO_ADC); //OSC32_OUT
+
+const mcu_pin_obj_t pin_PC00 = PIN(2, 0, ADC_INPUT(ADC_1,10));
+const mcu_pin_obj_t pin_PC01 = PIN(2, 1, ADC_INPUT(ADC_1,11));
+const mcu_pin_obj_t pin_PC02 = PIN(2, 2, ADC_INPUT(ADC_1,12));
+const mcu_pin_obj_t pin_PC03 = PIN(2, 3, ADC_INPUT(ADC_1,13));
+
+const mcu_pin_obj_t pin_PA00 = PIN(0, 0, ADC_INPUT(ADC_1,0));
+const mcu_pin_obj_t pin_PA01 = PIN(0, 1, ADC_INPUT(ADC_1,1));
+const mcu_pin_obj_t pin_PA02 = PIN(0, 2, ADC_INPUT(ADC_1,2));
+const mcu_pin_obj_t pin_PA03 = PIN(0, 3, ADC_INPUT(ADC_1,3));
+const mcu_pin_obj_t pin_PA04 = PIN(0, 4, ADC_INPUT(ADC_1,4));
+const mcu_pin_obj_t pin_PA05 = PIN(0, 5, ADC_INPUT(ADC_1,5));
+const mcu_pin_obj_t pin_PA06 = PIN(0, 6, ADC_INPUT(ADC_1,6));
+const mcu_pin_obj_t pin_PA07 = PIN(0, 7, ADC_INPUT(ADC_1,7));
+
+const mcu_pin_obj_t pin_PC04 = PIN(2, 4, ADC_INPUT(ADC_1,14));
+const mcu_pin_obj_t pin_PC05 = PIN(2, 5, ADC_INPUT(ADC_1,15));
+
+const mcu_pin_obj_t pin_PB00 = PIN(1, 0, ADC_INPUT(ADC_1,8));
+const mcu_pin_obj_t pin_PB01 = PIN(1, 1, ADC_INPUT(ADC_1,9));
+const mcu_pin_obj_t pin_PB02 = PIN(1, 2, NO_ADC);
+
+const mcu_pin_obj_t pin_PE07 = PIN(4, 7, NO_ADC);
+const mcu_pin_obj_t pin_PE08 = PIN(4, 8, NO_ADC);
+const mcu_pin_obj_t pin_PE09 = PIN(4, 9, NO_ADC);
+const mcu_pin_obj_t pin_PE10 = PIN(4, 10, NO_ADC);
+const mcu_pin_obj_t pin_PE11 = PIN(4, 11, NO_ADC);
+const mcu_pin_obj_t pin_PE12 = PIN(4, 12, NO_ADC);
+const mcu_pin_obj_t pin_PE13 = PIN(4, 13, NO_ADC);
+const mcu_pin_obj_t pin_PE14 = PIN(4, 14, NO_ADC);
+const mcu_pin_obj_t pin_PE15 = PIN(4, 15, NO_ADC);
+
+const mcu_pin_obj_t pin_PB10 = PIN(1, 10, NO_ADC);
+const mcu_pin_obj_t pin_PB12 = PIN(1, 12, NO_ADC);
+const mcu_pin_obj_t pin_PB13 = PIN(1, 13, NO_ADC);
+const mcu_pin_obj_t pin_PB14 = PIN(1, 14, NO_ADC);
+const mcu_pin_obj_t pin_PB15 = PIN(1, 15, NO_ADC);
+
+const mcu_pin_obj_t pin_PD08 = PIN(3, 8, NO_ADC);
+const mcu_pin_obj_t pin_PD09 = PIN(3, 9, NO_ADC);
+const mcu_pin_obj_t pin_PD10 = PIN(3, 10, NO_ADC);
+const mcu_pin_obj_t pin_PD11 = PIN(3, 11, NO_ADC);
+const mcu_pin_obj_t pin_PD12 = PIN(3, 12, NO_ADC);
+const mcu_pin_obj_t pin_PD13 = PIN(3, 13, NO_ADC);
+const mcu_pin_obj_t pin_PD14 = PIN(3, 14, NO_ADC);
+const mcu_pin_obj_t pin_PD15 = PIN(3, 15, NO_ADC);
+
+const mcu_pin_obj_t pin_PC06 = PIN(2, 6, NO_ADC);
+const mcu_pin_obj_t pin_PC07 = PIN(2, 7, NO_ADC);
+const mcu_pin_obj_t pin_PC08 = PIN(2, 8, NO_ADC);
+const mcu_pin_obj_t pin_PC09 = PIN(2, 9, NO_ADC);
+
+const mcu_pin_obj_t pin_PA08 = PIN(0, 8, NO_ADC);
+const mcu_pin_obj_t pin_PA09 = PIN(0, 9, NO_ADC);
+const mcu_pin_obj_t pin_PA10 = PIN(0, 10, NO_ADC);
+const mcu_pin_obj_t pin_PA11 = PIN(0, 11, NO_ADC);
+const mcu_pin_obj_t pin_PA12 = PIN(0, 12, NO_ADC);
+const mcu_pin_obj_t pin_PA13 = PIN(0, 13, NO_ADC); //SWDIO
+const mcu_pin_obj_t pin_PA14 = PIN(0, 14, NO_ADC); //SWCLK
+const mcu_pin_obj_t pin_PA15 = PIN(0, 15, NO_ADC); //JTDI
+
+const mcu_pin_obj_t pin_PC10 = PIN(2, 10, NO_ADC);
+const mcu_pin_obj_t pin_PC11 = PIN(2, 11, NO_ADC);
+const mcu_pin_obj_t pin_PC12 = PIN(2, 12, NO_ADC);
+
+const mcu_pin_obj_t pin_PD00 = PIN(3, 0, NO_ADC);
+const mcu_pin_obj_t pin_PD01 = PIN(3, 1, NO_ADC);
+const mcu_pin_obj_t pin_PD02 = PIN(3, 2, NO_ADC);
+const mcu_pin_obj_t pin_PD03 = PIN(3, 3, NO_ADC);
+const mcu_pin_obj_t pin_PD04 = PIN(3, 4, NO_ADC);
+const mcu_pin_obj_t pin_PD05 = PIN(3, 5, NO_ADC);
+const mcu_pin_obj_t pin_PD06 = PIN(3, 6, NO_ADC);
+const mcu_pin_obj_t pin_PD07 = PIN(3, 7, NO_ADC);
+
+const mcu_pin_obj_t pin_PB03 = PIN(1, 3, NO_ADC);
+const mcu_pin_obj_t pin_PB04 = PIN(1, 4, NO_ADC);
+const mcu_pin_obj_t pin_PB05 = PIN(1, 5, NO_ADC);
+const mcu_pin_obj_t pin_PB06 = PIN(1, 6, NO_ADC);
+const mcu_pin_obj_t pin_PB07 = PIN(1, 7, NO_ADC);
+const mcu_pin_obj_t pin_PB08 = PIN(1, 8, NO_ADC);
+const mcu_pin_obj_t pin_PB09 = PIN(1, 9, NO_ADC);
+
+const mcu_pin_obj_t pin_PE00 = PIN(4, 0, NO_ADC);
+const mcu_pin_obj_t pin_PE01 = PIN(4, 1, NO_ADC); \ No newline at end of file
diff --git a/ports/stm32f4/peripherals/stm32f4/stm32f401xe/pins.h b/ports/stm32f4/peripherals/stm32f4/stm32f401xe/pins.h
new file mode 100644
index 000000000..37d3a5cf1
--- /dev/null
+++ b/ports/stm32f4/peripherals/stm32f4/stm32f401xe/pins.h
@@ -0,0 +1,121 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019 Lucian Copeland for Adafruit Industries
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#ifndef MICROPY_INCLUDED_STM32F4_PERIPHERALS_STM32F411VE_PINS_H
+#define MICROPY_INCLUDED_STM32F4_PERIPHERALS_STM32F411VE_PINS_H
+
+//Pins in datasheet order: DocID026289 Rev 7 page 38. LQFP100 only
+//pg 38
+extern const mcu_pin_obj_t pin_PE02;
+extern const mcu_pin_obj_t pin_PE03;
+extern const mcu_pin_obj_t pin_PE04;
+extern const mcu_pin_obj_t pin_PE05;
+//pg 39
+extern const mcu_pin_obj_t pin_PE06;
+extern const mcu_pin_obj_t pin_PC13;
+extern const mcu_pin_obj_t pin_PC14;
+extern const mcu_pin_obj_t pin_PC15;
+extern const mcu_pin_obj_t pin_PC00;
+extern const mcu_pin_obj_t pin_PC01;
+extern const mcu_pin_obj_t pin_PC02;
+extern const mcu_pin_obj_t pin_PC03;
+//pg 40
+extern const mcu_pin_obj_t pin_PA00;
+extern const mcu_pin_obj_t pin_PA01;
+extern const mcu_pin_obj_t pin_PA02;
+extern const mcu_pin_obj_t pin_PA03;
+extern const mcu_pin_obj_t pin_PA04;
+extern const mcu_pin_obj_t pin_PA05;
+extern const mcu_pin_obj_t pin_PA06;
+extern const mcu_pin_obj_t pin_PA07;
+//pg 41
+extern const mcu_pin_obj_t pin_PC04;
+extern const mcu_pin_obj_t pin_PC05;
+extern const mcu_pin_obj_t pin_PB00;
+extern const mcu_pin_obj_t pin_PB01;
+extern const mcu_pin_obj_t pin_PB02;
+extern const mcu_pin_obj_t pin_PE07;
+extern const mcu_pin_obj_t pin_PE08;
+extern const mcu_pin_obj_t pin_PE09;
+extern const mcu_pin_obj_t pin_PE10;
+extern const mcu_pin_obj_t pin_PE11;
+extern const mcu_pin_obj_t pin_PE12;
+extern const mcu_pin_obj_t pin_PE13;
+extern const mcu_pin_obj_t pin_PE14;
+extern const mcu_pin_obj_t pin_PE15;
+//pg 42
+extern const mcu_pin_obj_t pin_PB10;
+extern const mcu_pin_obj_t pin_PB12;
+extern const mcu_pin_obj_t pin_PB13;
+extern const mcu_pin_obj_t pin_PB14;
+extern const mcu_pin_obj_t pin_PB15;
+extern const mcu_pin_obj_t pin_PD08;
+extern const mcu_pin_obj_t pin_PD09;
+extern const mcu_pin_obj_t pin_PD10;
+extern const mcu_pin_obj_t pin_PD11;
+extern const mcu_pin_obj_t pin_PD12;
+//pg 43
+extern const mcu_pin_obj_t pin_PD13;
+extern const mcu_pin_obj_t pin_PD14;
+extern const mcu_pin_obj_t pin_PD15;
+extern const mcu_pin_obj_t pin_PC06;
+extern const mcu_pin_obj_t pin_PC07;
+extern const mcu_pin_obj_t pin_PC08;
+extern const mcu_pin_obj_t pin_PC09;
+extern const mcu_pin_obj_t pin_PA08;
+extern const mcu_pin_obj_t pin_PA09;
+//pg 44
+extern const mcu_pin_obj_t pin_PA10;
+extern const mcu_pin_obj_t pin_PA11;
+extern const mcu_pin_obj_t pin_PA12;
+extern const mcu_pin_obj_t pin_PA13;
+extern const mcu_pin_obj_t pin_PA14;
+extern const mcu_pin_obj_t pin_PA15;
+extern const mcu_pin_obj_t pin_PC10;
+extern const mcu_pin_obj_t pin_PC11;
+extern const mcu_pin_obj_t pin_PC12;
+//pg 45
+extern const mcu_pin_obj_t pin_PD00;
+extern const mcu_pin_obj_t pin_PD01;
+extern const mcu_pin_obj_t pin_PD02;
+extern const mcu_pin_obj_t pin_PD03;
+extern const mcu_pin_obj_t pin_PD04;
+extern const mcu_pin_obj_t pin_PD05;
+extern const mcu_pin_obj_t pin_PD06;
+extern const mcu_pin_obj_t pin_PD07;
+extern const mcu_pin_obj_t pin_PB03;
+extern const mcu_pin_obj_t pin_PB04;
+extern const mcu_pin_obj_t pin_PB05;
+extern const mcu_pin_obj_t pin_PB06;
+//pg 46
+extern const mcu_pin_obj_t pin_PB07;
+extern const mcu_pin_obj_t pin_PB08;
+extern const mcu_pin_obj_t pin_PB09;
+extern const mcu_pin_obj_t pin_PE00;
+extern const mcu_pin_obj_t pin_PE01;
+
+
+#endif // MICROPY_INCLUDED_STM32F4_PERIPHERALS_STM32F411VE_PINS_H