Skip to content

STM32: New board definitions for Pyboard, F411 Blackpill #2312

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 11 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ jobs:
- "pewpew10"
- "pewpew_m4"
- "pirkey_m0"
- "pyb_nano_v2"
- "pybadge"
- "pybadge_airlift"
- "pyboard_v11"
Expand All @@ -149,6 +150,7 @@ jobs:
- "sparkfun_samd21_dev"
- "sparkfun_samd21_mini"
- "spresense"
- "stm32f411ce_blackpill"
- "stm32f411ve_discovery"
- "stm32f412zg_discovery"
- "stringcar_m0_express"
Expand Down
39 changes: 39 additions & 0 deletions ports/stm32f4/boards/pyb_nano_v2/board.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2017 Scott Shawcroft 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 "boards/board.h"
#include "mpconfigboard.h"

void board_init(void) {
}

bool board_requests_safe_mode(void) {
return false;
}

void reset_board(void) {

}
47 changes: 47 additions & 0 deletions ports/stm32f4/boards/pyb_nano_v2/mpconfigboard.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* 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.
*/

//Micropython setup

#define MICROPY_HW_BOARD_NAME "PYB LR Nano V2"
#define MICROPY_HW_MCU_NAME "STM32F411CE"

#define FLASH_SIZE (0x80000)
#define FLASH_PAGE_SIZE (0x4000)

#define BOARD_OSC_DIV 8

// On-board flash
#define SPI_FLASH_MOSI_PIN (&pin_PB15)
#define SPI_FLASH_MISO_PIN (&pin_PB14)
#define SPI_FLASH_SCK_PIN (&pin_PB13)
#define SPI_FLASH_CS_PIN (&pin_PB12)

#define CIRCUITPY_AUTORELOAD_DELAY_MS 500

#define BOARD_FLASH_SIZE (FLASH_SIZE - 0x2000 - 0xC000)

#define AUTORESET_DELAY_MS 500
19 changes: 19 additions & 0 deletions ports/stm32f4/boards/pyb_nano_v2/mpconfigboard.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
USB_VID = 0x239A
USB_PID = 0x8068
USB_PRODUCT = "PYB LR Nano V2"
USB_MANUFACTURER = "MicroPython Chinese Community"
USB_DEVICES = "CDC,MSC"

SPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICE_COUNT = 1
EXTERNAL_FLASH_DEVICES = W25Q64JV_IQ
LONGINT_IMPL = MPZ

MCU_SERIES = m4
MCU_VARIANT = stm32f4
MCU_SUB_VARIANT = stm32f411xe
MCU_PACKAGE = 48
CMSIS_MCU = STM32F411xE
LD_FILE = boards/STM32F411VETx_FLASH.ld
TEXT0_ADDR = 0x08000000
TEXT1_ADDR = 0x08020000
59 changes: 59 additions & 0 deletions ports/stm32f4/boards/pyb_nano_v2/pins.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#include "shared-bindings/board/__init__.h"

STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_Y10), MP_ROM_PTR(&pin_PA10) },
{ MP_ROM_QSTR(MP_QSTR_Y9), MP_ROM_PTR(&pin_PA13) },
{ MP_ROM_QSTR(MP_QSTR_Y8), MP_ROM_PTR(&pin_PA14) },
{ MP_ROM_QSTR(MP_QSTR_Y7), MP_ROM_PTR(&pin_PA15) },
{ MP_ROM_QSTR(MP_QSTR_Y6), MP_ROM_PTR(&pin_PB03) },
{ MP_ROM_QSTR(MP_QSTR_Y5), MP_ROM_PTR(&pin_PB04) },
{ MP_ROM_QSTR(MP_QSTR_Y4), MP_ROM_PTR(&pin_PB05) },
{ MP_ROM_QSTR(MP_QSTR_Y3), MP_ROM_PTR(&pin_PB06) },
{ MP_ROM_QSTR(MP_QSTR_Y2), MP_ROM_PTR(&pin_PB07) },
{ MP_ROM_QSTR(MP_QSTR_Y1), MP_ROM_PTR(&pin_PB08) },
{ MP_ROM_QSTR(MP_QSTR_Y0), MP_ROM_PTR(&pin_PB09) },

{ MP_ROM_QSTR(MP_QSTR_X15), MP_ROM_PTR(&pin_PA08) },
{ MP_ROM_QSTR(MP_QSTR_X14), MP_ROM_PTR(&pin_PB15) },
{ MP_ROM_QSTR(MP_QSTR_X13), MP_ROM_PTR(&pin_PB14) },
{ MP_ROM_QSTR(MP_QSTR_X12), MP_ROM_PTR(&pin_PB13) },
{ MP_ROM_QSTR(MP_QSTR_X11), MP_ROM_PTR(&pin_PB12) },
{ MP_ROM_QSTR(MP_QSTR_X10), MP_ROM_PTR(&pin_PB10) },
{ MP_ROM_QSTR(MP_QSTR_X9), MP_ROM_PTR(&pin_PB01) },
{ MP_ROM_QSTR(MP_QSTR_X8), MP_ROM_PTR(&pin_PB00) },
{ MP_ROM_QSTR(MP_QSTR_X7), MP_ROM_PTR(&pin_PA07) },
{ MP_ROM_QSTR(MP_QSTR_X6), MP_ROM_PTR(&pin_PA06) },
{ MP_ROM_QSTR(MP_QSTR_X5), MP_ROM_PTR(&pin_PA05) },
{ MP_ROM_QSTR(MP_QSTR_X4), MP_ROM_PTR(&pin_PA04) },
{ MP_ROM_QSTR(MP_QSTR_X3), MP_ROM_PTR(&pin_PA03) },
{ MP_ROM_QSTR(MP_QSTR_X2), MP_ROM_PTR(&pin_PA02) },
{ MP_ROM_QSTR(MP_QSTR_X1), MP_ROM_PTR(&pin_PA01) },
{ MP_ROM_QSTR(MP_QSTR_X0), MP_ROM_PTR(&pin_PA00) },

{ MP_ROM_QSTR(MP_QSTR_SDA1), MP_ROM_PTR(&pin_PB09) },
{ MP_ROM_QSTR(MP_QSTR_SCL1), MP_ROM_PTR(&pin_PB08) },
{ MP_ROM_QSTR(MP_QSTR_SDA2), MP_ROM_PTR(&pin_PB03) },
{ MP_ROM_QSTR(MP_QSTR_SCL2), MP_ROM_PTR(&pin_PB10) },
{ MP_ROM_QSTR(MP_QSTR_SDA3), MP_ROM_PTR(&pin_PB04) },
{ MP_ROM_QSTR(MP_QSTR_SCL3), MP_ROM_PTR(&pin_PA08) },

{ MP_ROM_QSTR(MP_QSTR_SCK1), MP_ROM_PTR(&pin_PA05) },
{ MP_ROM_QSTR(MP_QSTR_MISO1), MP_ROM_PTR(&pin_PA06) },
{ MP_ROM_QSTR(MP_QSTR_MOSI1), MP_ROM_PTR(&pin_PA07) },
{ MP_ROM_QSTR(MP_QSTR_SCK2), MP_ROM_PTR(&pin_PB13) },
{ MP_ROM_QSTR(MP_QSTR_MISO2), MP_ROM_PTR(&pin_PB14) },
{ MP_ROM_QSTR(MP_QSTR_MOSI2), MP_ROM_PTR(&pin_PB15) },

{ MP_ROM_QSTR(MP_QSTR_TX1), MP_ROM_PTR(&pin_PB07) },
{ MP_ROM_QSTR(MP_QSTR_RX1), MP_ROM_PTR(&pin_PB06) },
{ MP_ROM_QSTR(MP_QSTR_TX2), MP_ROM_PTR(&pin_PA02) },
{ MP_ROM_QSTR(MP_QSTR_RX2), MP_ROM_PTR(&pin_PA03) },

{ MP_ROM_QSTR(MP_QSTR_LED_RED), MP_ROM_PTR(&pin_PA00) },
{ MP_ROM_QSTR(MP_QSTR_LED_GREEN), MP_ROM_PTR(&pin_PA01) },
{ MP_ROM_QSTR(MP_QSTR_LED_YELLOW), MP_ROM_PTR(&pin_PA02) },
{ MP_ROM_QSTR(MP_QSTR_LED_BLUE), MP_ROM_PTR(&pin_PA03) },

{ MP_ROM_QSTR(MP_QSTR_SW), MP_ROM_PTR(&pin_PC13) },
};
MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);
Loading