BLACKPILL custom target.

BLACKPILL custom target

Board pinout

When equipped with STM32F401CCU6:

Zoom in
https://os.mbed.com/media/uploads/hudakz/blackpill_f401cc.png

When equipped with STM32F411CEU6:

Zoom in
https://os.mbed.com/media/uploads/hudakz/blackpill-pinout.png

Advantages of the BLACKPILL custom target over the NUCLEO_F401RE/ NUCLEO_F411RE
  • The onboard external 25 MHz crystal is used as system clock source rather than the less precise internal 16 MHz RC oscillator.
  • The onboard LED works as LED1 in programs.
  • The onboard KEY on STM32F411CEU6 boards works as USER_BUTTON pin in programs.
  • You can use the USB peripheral in your programs and connect the board to the PC over the onboard USB connector. An example of using the USB peripheral as USBSerial (12 Mbit/s) is available here.
Building programs for the BLACKPILL custom target in Mbed Studio
  • Connect an STM32 ST-Link programmer to your BLACKPILL board and PC (see below for more details).
  • Create a new program in the Mbed Studio IDE.
  • Right-click on the program's root folder and in the popup window select Add library...
  • Open the drop-list and select default as Branch or tag and click on the Finish button.
  • Open the BLACKPILL_Custom_Target folder and according to you board drag&drop the TARGET_BLACKPILL_F401CC or the TARGET_BLACKPILL_F411CE folder and the custom_targets.json file one by one to the root folder of your program.
  • Delete the BLACKPILL_Custom_Target folder from your project. (Right-click and select delete).
  • Open the Target drop-list and click on the button with a "chip" icon on it (Manage custom targets) .
  • Open the USB device drop-list and select your STM32 ST-Link programmer.
  • Open the Build target drop-list and according to your board select BLACKPILL_F401CC or BLACKPILL_F411CE.
  • Click on the Save All button.
  • Build your program (click on hammer button).

For more info visit

Import programBlackpill_Hello

Using low cost Blackpill (STM32F411CEU6) boards with mbed.

Committer:
hudakz
Date:
Sat Mar 19 10:08:40 2022 +0000
Revision:
7:3a74f7149fa4
Added support for boards equipped with STM32F401CC.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
hudakz 7:3a74f7149fa4 1 /* mbed Microcontroller Library
hudakz 7:3a74f7149fa4 2 *******************************************************************************
hudakz 7:3a74f7149fa4 3 * Copyright (c) 2018, STMicroelectronics
hudakz 7:3a74f7149fa4 4 * All rights reserved.
hudakz 7:3a74f7149fa4 5 *
hudakz 7:3a74f7149fa4 6 * Redistribution and use in source and binary forms, with or without
hudakz 7:3a74f7149fa4 7 * modification, are permitted provided that the following conditions are met:
hudakz 7:3a74f7149fa4 8 *
hudakz 7:3a74f7149fa4 9 * 1. Redistributions of source code must retain the above copyright notice,
hudakz 7:3a74f7149fa4 10 * this list of conditions and the following disclaimer.
hudakz 7:3a74f7149fa4 11 * 2. Redistributions in binary form must reproduce the above copyright notice,
hudakz 7:3a74f7149fa4 12 * this list of conditions and the following disclaimer in the documentation
hudakz 7:3a74f7149fa4 13 * and/or other materials provided with the distribution.
hudakz 7:3a74f7149fa4 14 * 3. Neither the name of STMicroelectronics nor the names of its contributors
hudakz 7:3a74f7149fa4 15 * may be used to endorse or promote products derived from this software
hudakz 7:3a74f7149fa4 16 * without specific prior written permission.
hudakz 7:3a74f7149fa4 17 *
hudakz 7:3a74f7149fa4 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
hudakz 7:3a74f7149fa4 19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
hudakz 7:3a74f7149fa4 20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
hudakz 7:3a74f7149fa4 21 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
hudakz 7:3a74f7149fa4 22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
hudakz 7:3a74f7149fa4 23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
hudakz 7:3a74f7149fa4 24 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
hudakz 7:3a74f7149fa4 25 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
hudakz 7:3a74f7149fa4 26 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
hudakz 7:3a74f7149fa4 27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
hudakz 7:3a74f7149fa4 28 *******************************************************************************
hudakz 7:3a74f7149fa4 29 */
hudakz 7:3a74f7149fa4 30
hudakz 7:3a74f7149fa4 31 #ifndef MBED_PINNAMES_H
hudakz 7:3a74f7149fa4 32 #define MBED_PINNAMES_H
hudakz 7:3a74f7149fa4 33
hudakz 7:3a74f7149fa4 34 #include "cmsis.h"
hudakz 7:3a74f7149fa4 35 #include "PinNamesTypes.h"
hudakz 7:3a74f7149fa4 36
hudakz 7:3a74f7149fa4 37 #ifdef __cplusplus
hudakz 7:3a74f7149fa4 38 extern "C" {
hudakz 7:3a74f7149fa4 39 #endif
hudakz 7:3a74f7149fa4 40
hudakz 7:3a74f7149fa4 41 /* If this macro is defined, then constexpr utility functions for pin-map seach can be used. */
hudakz 7:3a74f7149fa4 42 #define STATIC_PINMAP_READY 1
hudakz 7:3a74f7149fa4 43
hudakz 7:3a74f7149fa4 44 typedef enum {
hudakz 7:3a74f7149fa4 45 ALT0 = 0x100,
hudakz 7:3a74f7149fa4 46 ALT1 = 0x200,
hudakz 7:3a74f7149fa4 47 ALT2 = 0x300,
hudakz 7:3a74f7149fa4 48 ALT3 = 0x400
hudakz 7:3a74f7149fa4 49 } ALTx;
hudakz 7:3a74f7149fa4 50
hudakz 7:3a74f7149fa4 51 typedef enum {
hudakz 7:3a74f7149fa4 52 // Not connected
hudakz 7:3a74f7149fa4 53 NC = (int)0xFFFFFFFF,
hudakz 7:3a74f7149fa4 54
hudakz 7:3a74f7149fa4 55 PA_0 = 0x00,
hudakz 7:3a74f7149fa4 56 PA_1 = 0x01,
hudakz 7:3a74f7149fa4 57 PA_1_ALT0 = PA_1 | ALT0,
hudakz 7:3a74f7149fa4 58 PA_2 = 0x02,
hudakz 7:3a74f7149fa4 59 PA_3 = 0x03,
hudakz 7:3a74f7149fa4 60 PA_4 = 0x04,
hudakz 7:3a74f7149fa4 61 PA_4_ALT0 = PA_4 | ALT0,
hudakz 7:3a74f7149fa4 62 PA_5 = 0x05,
hudakz 7:3a74f7149fa4 63 PA_6 = 0x06,
hudakz 7:3a74f7149fa4 64 PA_7 = 0x07,
hudakz 7:3a74f7149fa4 65 PA_7_ALT0 = PA_7 | ALT0,
hudakz 7:3a74f7149fa4 66 PA_7_ALT1 = PA_7 | ALT1,
hudakz 7:3a74f7149fa4 67 PA_7_ALT2 = PA_7 | ALT2,
hudakz 7:3a74f7149fa4 68 PA_8 = 0x08,
hudakz 7:3a74f7149fa4 69 PA_9 = 0x09,
hudakz 7:3a74f7149fa4 70 PA_10 = 0x0A,
hudakz 7:3a74f7149fa4 71 PA_11 = 0x0B,
hudakz 7:3a74f7149fa4 72 PA_12 = 0x0C,
hudakz 7:3a74f7149fa4 73 PA_13 = 0x0D,
hudakz 7:3a74f7149fa4 74 PA_14 = 0x0E,
hudakz 7:3a74f7149fa4 75 PA_15 = 0x0F,
hudakz 7:3a74f7149fa4 76 PA_15_ALT0 = PA_15 | ALT0,
hudakz 7:3a74f7149fa4 77
hudakz 7:3a74f7149fa4 78 PB_0 = 0x10,
hudakz 7:3a74f7149fa4 79 PB_0_ALT0 = PB_0 | ALT0,
hudakz 7:3a74f7149fa4 80 PB_0_ALT1 = PB_0 | ALT1,
hudakz 7:3a74f7149fa4 81 PB_1 = 0x11,
hudakz 7:3a74f7149fa4 82 PB_1_ALT0 = PB_1 | ALT0,
hudakz 7:3a74f7149fa4 83 PB_1_ALT1 = PB_1 | ALT1,
hudakz 7:3a74f7149fa4 84 PB_2 = 0x12,
hudakz 7:3a74f7149fa4 85 PB_3 = 0x13,
hudakz 7:3a74f7149fa4 86 PB_3_ALT0 = PB_3 | ALT0,
hudakz 7:3a74f7149fa4 87 PB_4 = 0x14,
hudakz 7:3a74f7149fa4 88 PB_4_ALT0 = PB_4 | ALT0,
hudakz 7:3a74f7149fa4 89 PB_4_ALT1 = PB_4 | ALT1,
hudakz 7:3a74f7149fa4 90 PB_5 = 0x15,
hudakz 7:3a74f7149fa4 91 PB_5_ALT0 = PB_5 | ALT0,
hudakz 7:3a74f7149fa4 92 PB_5_ALT1 = PB_5 | ALT1,
hudakz 7:3a74f7149fa4 93 PB_6 = 0x16,
hudakz 7:3a74f7149fa4 94 PB_7 = 0x17,
hudakz 7:3a74f7149fa4 95 PB_8 = 0x18,
hudakz 7:3a74f7149fa4 96 PB_8_ALT0 = PB_8 | ALT0,
hudakz 7:3a74f7149fa4 97 PB_8_ALT1 = PB_8 | ALT1,
hudakz 7:3a74f7149fa4 98 PB_9 = 0x19,
hudakz 7:3a74f7149fa4 99 PB_9_ALT0 = PB_9 | ALT0,
hudakz 7:3a74f7149fa4 100 PB_9_ALT1 = PB_9 | ALT1,
hudakz 7:3a74f7149fa4 101 PB_10 = 0x1A,
hudakz 7:3a74f7149fa4 102 PB_12 = 0x1C,
hudakz 7:3a74f7149fa4 103 PB_12_ALT0 = PB_12 | ALT0,
hudakz 7:3a74f7149fa4 104 PB_13 = 0x1D,
hudakz 7:3a74f7149fa4 105 PB_13_ALT0 = PB_13 | ALT0,
hudakz 7:3a74f7149fa4 106 PB_14 = 0x1E,
hudakz 7:3a74f7149fa4 107 PB_15 = 0x1F,
hudakz 7:3a74f7149fa4 108
hudakz 7:3a74f7149fa4 109 PC_0 = 0x20,
hudakz 7:3a74f7149fa4 110 PC_1 = 0x21,
hudakz 7:3a74f7149fa4 111 PC_2 = 0x22,
hudakz 7:3a74f7149fa4 112 PC_3 = 0x23,
hudakz 7:3a74f7149fa4 113 PC_4 = 0x24,
hudakz 7:3a74f7149fa4 114 PC_5 = 0x25,
hudakz 7:3a74f7149fa4 115 PC_6 = 0x26,
hudakz 7:3a74f7149fa4 116 PC_7 = 0x27,
hudakz 7:3a74f7149fa4 117 PC_8 = 0x28,
hudakz 7:3a74f7149fa4 118 PC_9 = 0x29,
hudakz 7:3a74f7149fa4 119 PC_10 = 0x2A,
hudakz 7:3a74f7149fa4 120 PC_11 = 0x2B,
hudakz 7:3a74f7149fa4 121 PC_12 = 0x2C,
hudakz 7:3a74f7149fa4 122 PC_13 = 0x2D,
hudakz 7:3a74f7149fa4 123 PC_14 = 0x2E,
hudakz 7:3a74f7149fa4 124 PC_15 = 0x2F,
hudakz 7:3a74f7149fa4 125
hudakz 7:3a74f7149fa4 126 PD_2 = 0x32,
hudakz 7:3a74f7149fa4 127
hudakz 7:3a74f7149fa4 128 PH_0 = 0x70,
hudakz 7:3a74f7149fa4 129 PH_1 = 0x71,
hudakz 7:3a74f7149fa4 130
hudakz 7:3a74f7149fa4 131 // ADC internal channels
hudakz 7:3a74f7149fa4 132 ADC_TEMP = 0xF0,
hudakz 7:3a74f7149fa4 133 ADC_VREF = 0xF1,
hudakz 7:3a74f7149fa4 134 ADC_VBAT = 0xF2,
hudakz 7:3a74f7149fa4 135
hudakz 7:3a74f7149fa4 136 // Arduino connector namings
hudakz 7:3a74f7149fa4 137 A0 = PA_0,
hudakz 7:3a74f7149fa4 138 A1 = PA_1,
hudakz 7:3a74f7149fa4 139 A2 = PA_4,
hudakz 7:3a74f7149fa4 140 A3 = PB_0,
hudakz 7:3a74f7149fa4 141 A4 = NC,
hudakz 7:3a74f7149fa4 142 A5 = NC,
hudakz 7:3a74f7149fa4 143 D0 = PA_3,
hudakz 7:3a74f7149fa4 144 D1 = PA_2,
hudakz 7:3a74f7149fa4 145 D2 = PA_10,
hudakz 7:3a74f7149fa4 146 D3 = PB_3,
hudakz 7:3a74f7149fa4 147 D4 = PB_5,
hudakz 7:3a74f7149fa4 148 D5 = PB_4,
hudakz 7:3a74f7149fa4 149 D6 = PB_10,
hudakz 7:3a74f7149fa4 150 D7 = PA_8,
hudakz 7:3a74f7149fa4 151 D8 = PA_9,
hudakz 7:3a74f7149fa4 152 D9 = NC,
hudakz 7:3a74f7149fa4 153 D10 = PB_6,
hudakz 7:3a74f7149fa4 154 D11 = PA_7,
hudakz 7:3a74f7149fa4 155 D12 = PA_6,
hudakz 7:3a74f7149fa4 156 D13 = PA_5,
hudakz 7:3a74f7149fa4 157 D14 = PB_9,
hudakz 7:3a74f7149fa4 158 D15 = PB_8,
hudakz 7:3a74f7149fa4 159
hudakz 7:3a74f7149fa4 160 // STDIO for console print
hudakz 7:3a74f7149fa4 161 #ifdef MBED_CONF_TARGET_STDIO_UART_TX
hudakz 7:3a74f7149fa4 162 CONSOLE_TX = MBED_CONF_TARGET_STDIO_UART_TX,
hudakz 7:3a74f7149fa4 163 #else
hudakz 7:3a74f7149fa4 164 CONSOLE_TX = PA_2,
hudakz 7:3a74f7149fa4 165 #endif
hudakz 7:3a74f7149fa4 166 #ifdef MBED_CONF_TARGET_STDIO_UART_RX
hudakz 7:3a74f7149fa4 167 CONSOLE_RX = MBED_CONF_TARGET_STDIO_UART_RX,
hudakz 7:3a74f7149fa4 168 #else
hudakz 7:3a74f7149fa4 169 CONSOLE_RX = PA_3,
hudakz 7:3a74f7149fa4 170 #endif
hudakz 7:3a74f7149fa4 171
hudakz 7:3a74f7149fa4 172 // Generic signals namings
hudakz 7:3a74f7149fa4 173 LED1 = PC_13,
hudakz 7:3a74f7149fa4 174 LED2 = PC_13,
hudakz 7:3a74f7149fa4 175 LED3 = PC_13,
hudakz 7:3a74f7149fa4 176 LED4 = PC_13,
hudakz 7:3a74f7149fa4 177 LED_RED = PC_13,
hudakz 7:3a74f7149fa4 178 USER_BUTTON = PA_0,
hudakz 7:3a74f7149fa4 179
hudakz 7:3a74f7149fa4 180 // Standardized button names
hudakz 7:3a74f7149fa4 181 BUTTON1 = USER_BUTTON,
hudakz 7:3a74f7149fa4 182
hudakz 7:3a74f7149fa4 183 // Serial backword compatibility
hudakz 7:3a74f7149fa4 184 STDIO_UART_TX = CONSOLE_TX,
hudakz 7:3a74f7149fa4 185 STDIO_UART_RX = CONSOLE_RX,
hudakz 7:3a74f7149fa4 186 SERIAL_TX = CONSOLE_TX,
hudakz 7:3a74f7149fa4 187 SERIAL_RX = CONSOLE_RX,
hudakz 7:3a74f7149fa4 188 #ifndef USBTX
hudakz 7:3a74f7149fa4 189 USBTX = CONSOLE_TX,
hudakz 7:3a74f7149fa4 190 #endif
hudakz 7:3a74f7149fa4 191 #ifndef USBRX
hudakz 7:3a74f7149fa4 192 USBRX = CONSOLE_RX,
hudakz 7:3a74f7149fa4 193 #endif
hudakz 7:3a74f7149fa4 194
hudakz 7:3a74f7149fa4 195 I2C_SCL = PB_8,
hudakz 7:3a74f7149fa4 196 I2C_SDA = PB_9,
hudakz 7:3a74f7149fa4 197 SPI_MOSI = PA_7,
hudakz 7:3a74f7149fa4 198 SPI_MISO = PA_6,
hudakz 7:3a74f7149fa4 199 SPI_SCK = PA_5,
hudakz 7:3a74f7149fa4 200 SPI_CS = PB_6,
hudakz 7:3a74f7149fa4 201 PWM_OUT = PB_3,
hudakz 7:3a74f7149fa4 202
hudakz 7:3a74f7149fa4 203 /**** USB FS pins ****/
hudakz 7:3a74f7149fa4 204 USB_OTG_FS_DM = PA_11,
hudakz 7:3a74f7149fa4 205 USB_OTG_FS_DP = PA_12,
hudakz 7:3a74f7149fa4 206 USB_OTG_FS_ID = PA_10,
hudakz 7:3a74f7149fa4 207 USB_OTG_FS_SOF = PA_8,
hudakz 7:3a74f7149fa4 208 USB_OTG_FS_VBUS = PA_9,
hudakz 7:3a74f7149fa4 209
hudakz 7:3a74f7149fa4 210 /**** OSCILLATOR pins ****/
hudakz 7:3a74f7149fa4 211 RCC_OSC32_IN = PC_14,
hudakz 7:3a74f7149fa4 212 RCC_OSC32_OUT = PC_15,
hudakz 7:3a74f7149fa4 213 RCC_OSC_IN = PH_0,
hudakz 7:3a74f7149fa4 214 RCC_OSC_OUT = PH_1,
hudakz 7:3a74f7149fa4 215
hudakz 7:3a74f7149fa4 216 /**** DEBUG pins ****/
hudakz 7:3a74f7149fa4 217 SYS_JTCK_SWCLK = PA_14,
hudakz 7:3a74f7149fa4 218 SYS_JTDI = PA_15,
hudakz 7:3a74f7149fa4 219 SYS_JTDO_SWO = PB_3,
hudakz 7:3a74f7149fa4 220 SYS_JTMS_SWDIO = PA_13,
hudakz 7:3a74f7149fa4 221 SYS_JTRST = PB_4,
hudakz 7:3a74f7149fa4 222 SYS_WKUP = PA_0,
hudakz 7:3a74f7149fa4 223
hudakz 7:3a74f7149fa4 224 } PinName;
hudakz 7:3a74f7149fa4 225
hudakz 7:3a74f7149fa4 226 #ifdef __cplusplus
hudakz 7:3a74f7149fa4 227 }
hudakz 7:3a74f7149fa4 228 #endif
hudakz 7:3a74f7149fa4 229
hudakz 7:3a74f7149fa4 230 #endif