diff --git a/ports/stm32f4/boards/stm32f411ce_blackpill/mpconfigboard.h b/ports/stm32f4/boards/stm32f411ce_blackpill/mpconfigboard.h index 8a482ce7dc..4b46b1056b 100644 --- a/ports/stm32f4/boards/stm32f411ce_blackpill/mpconfigboard.h +++ b/ports/stm32f4/boards/stm32f411ce_blackpill/mpconfigboard.h @@ -33,6 +33,13 @@ #define FLASH_PAGE_SIZE (0x4000) #define BOARD_OSC_DIV 25 +#define BOARD_USB_VBUS_BOOST + +// On-board flash +// #define SPI_FLASH_MOSI_PIN (&pin_PA07) +// #define SPI_FLASH_MISO_PIN (&pin_PA06) +// #define SPI_FLASH_SCK_PIN (&pin_PA05) +// #define SPI_FLASH_CS_PIN (&pin_PA04) #define CIRCUITPY_AUTORELOAD_DELAY_MS 500 diff --git a/ports/stm32f4/boards/stm32f411ce_blackpill/mpconfigboard.mk b/ports/stm32f4/boards/stm32f411ce_blackpill/mpconfigboard.mk index 41c283a780..a9f12cbc95 100644 --- a/ports/stm32f4/boards/stm32f411ce_blackpill/mpconfigboard.mk +++ b/ports/stm32f4/boards/stm32f411ce_blackpill/mpconfigboard.mk @@ -1,8 +1,13 @@ USB_VID = 0x239A USB_PID = 0x806A -USB_PRODUCT = "stm32f411ce-blackpill" +USB_PRODUCT = "stm32f411ce blackpill" USB_MANUFACTURER = "Unknown" -USB_DEVICES = "CDC" +USB_DEVICES = "CDC,MSC" + +# SPI_FLASH_FILESYSTEM = 1 +# EXTERNAL_FLASH_DEVICE_COUNT = 1 +# EXTERNAL_FLASH_DEVICES = xxxxxx #See supervisor/shared/external_flash/devices.h for options +# LONGINT_IMPL = MPZ INTERNAL_FLASH_FILESYSTEM = 1 LONGINT_IMPL = NONE diff --git a/ports/stm32f4/boards/stm32f411ce_blackpill/pins.c b/ports/stm32f4/boards/stm32f411ce_blackpill/pins.c index 0846cee673..5797a9762b 100644 --- a/ports/stm32f4/boards/stm32f411ce_blackpill/pins.c +++ b/ports/stm32f4/boards/stm32f411ce_blackpill/pins.c @@ -6,10 +6,10 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_B14), MP_ROM_PTR(&pin_PB14) }, { MP_ROM_QSTR(MP_QSTR_B15), MP_ROM_PTR(&pin_PB15) }, { MP_ROM_QSTR(MP_QSTR_A8), MP_ROM_PTR(&pin_PA08) }, - { MP_ROM_QSTR(MP_QSTR_A9), MP_ROM_PTR(&pin_PA09) }, - { MP_ROM_QSTR(MP_QSTR_A10), MP_ROM_PTR(&pin_PA10) }, - { MP_ROM_QSTR(MP_QSTR_A11), MP_ROM_PTR(&pin_PA11) }, - { MP_ROM_QSTR(MP_QSTR_A12), MP_ROM_PTR(&pin_PA12) }, + { MP_ROM_QSTR(MP_QSTR_A9), MP_ROM_PTR(&pin_PA09) }, //USB (shouldn't be used) + { MP_ROM_QSTR(MP_QSTR_A10), MP_ROM_PTR(&pin_PA10) }, //USB (shouldn't be used) + { MP_ROM_QSTR(MP_QSTR_A11), MP_ROM_PTR(&pin_PA11) }, //USB (shouldn't be used) + { MP_ROM_QSTR(MP_QSTR_A12), MP_ROM_PTR(&pin_PA12) }, //USB (shouldn't be used) { MP_ROM_QSTR(MP_QSTR_A15), MP_ROM_PTR(&pin_PA15) }, { MP_ROM_QSTR(MP_QSTR_B3), MP_ROM_PTR(&pin_PB03) }, { MP_ROM_QSTR(MP_QSTR_B4), MP_ROM_PTR(&pin_PB04) }, @@ -26,7 +26,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_PA07) }, { MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_PA06) }, { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PA05) }, - { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PA05) }, + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PA04) }, { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA03) }, { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PA02) }, { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA01) }, @@ -34,5 +34,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_C15), MP_ROM_PTR(&pin_PC15) }, { MP_ROM_QSTR(MP_QSTR_C14), MP_ROM_PTR(&pin_PC14) }, { MP_ROM_QSTR(MP_QSTR_C13), MP_ROM_PTR(&pin_PC13) }, + + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_PC13) }, }; MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/stm32f4/peripherals/stm32f4/stm32f411xe/gpio.c b/ports/stm32f4/peripherals/stm32f4/stm32f411xe/gpio.c index 2b0e2b2888..651aea2691 100644 --- a/ports/stm32f4/peripherals/stm32f4/stm32f411xe/gpio.c +++ b/ports/stm32f4/peripherals/stm32f4/stm32f411xe/gpio.c @@ -38,7 +38,6 @@ void stm32f4_peripherals_gpio_init(void) { __HAL_RCC_GPIOD_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 diff --git a/ports/stm32f4/supervisor/usb.c b/ports/stm32f4/supervisor/usb.c index f327050f58..39538daabf 100644 --- a/ports/stm32f4/supervisor/usb.c +++ b/ports/stm32f4/supervisor/usb.c @@ -31,6 +31,7 @@ #include "lib/utils/interrupt_char.h" #include "lib/mp-readline/readline.h" #include "stm32f4xx_hal.h" +#include "py/mpconfig.h" #include "common-hal/microcontroller/Pin.h" @@ -58,7 +59,11 @@ void init_usb_hardware(void) { /* Configure VBUS Pin */ GPIO_InitStruct.Pin = GPIO_PIN_9; GPIO_InitStruct.Mode = GPIO_MODE_INPUT; - GPIO_InitStruct.Pull = GPIO_NOPULL; +#ifdef BOARD_USB_VBUS_BOOST + GPIO_InitStruct.Pull = GPIO_PULLUP; //GPIO_NOPULL; +#else + GPIO_InitStruct.Pull = GPIO_NOPULL; //GPIO_NOPULL; +#endif HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); never_reset_pin_number(0, 9);