Merge pull request #12169 from maribu/blxxxpill

boards: Split off 128KiB version of bl*pill
This commit is contained in:
Alexandre Abadie 2019-09-29 18:50:29 +02:00 committed by GitHub
commit c72f286796
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
51 changed files with 477 additions and 346 deletions

View File

@ -0,0 +1,5 @@
MODULE = board
DIRS = $(RIOTBOARD)/common/blxxxpill
include $(RIOTBASE)/Makefile.base

View File

@ -0,0 +1 @@
include $(RIOTBOARD)/common/blxxxpill/Makefile.dep

View File

@ -0,0 +1 @@
include $(RIOTBOARD)/common/blxxxpill/Makefile.features

View File

@ -0,0 +1,8 @@
## the cpu to build for
export CPU = stm32f1
export CPU_MODEL = stm32f103cb
export OPENOCD_CONFIG ?= $(RIOTBOARD)/common/blxxxpill/dist/openocd-128kib.cfg
USEMODULE += boards_common_blxxxpill
include $(RIOTBOARD)/common/blxxxpill/Makefile.include

View File

@ -0,0 +1,9 @@
/**
@defgroup boards_blackpill_128kib Blackpill board (128KiB flash hack version)
@ingroup boards
@brief Support for the stm32f103c8 based blackpill board.
Refer to the common documentation of the bluepill and blackpill board in
@ref boards_common_blxxxpill instead.
*/

View File

@ -0,0 +1,52 @@
/*
* Copyright (C) 2015 TriaGnoSys GmbH
* 2017 Alexander Kurth, Sören Tempel, Tristan Bruns
* 2018 Otto-von-Guericke-Universität Magdeburg
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup boards_blackpill_128kib
* @brief Support for the stm32f103c8 based Black pill.
*
* @{
*
* @file
* @brief Peripheral MCU configuration for the Black Pill board
*
* @author Víctor Ariño <victor.arino@triagnosys.com>
* @author Sören Tempel <tempel@uni-bremen.de>
* @author Tristan Bruns <tbruns@uni-bremen.de>
* @author Alexander Kurth <kurth1@uni-bremen.de>
* @author Marian Buschsieweke <marian.buschsieweke@ovgu.de>
*/
#ifndef BOARD_H
#define BOARD_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* @name Macros for controlling the on-board LED.
* @{
*/
#define LED0_PORT GPIOB /**< GPIO-Port the LED is connected to */
#define LED0_PORTNUM PORT_B /**< GPIO Port number the LED is connected to */
#define LED0_PINNUM (12) /**< Pin number the LED is connected to */
/** @} */
#ifdef __cplusplus
}
#endif
/* Beware: This include must come *after* LED0 paramters have been defined */
#include "board_common.h"
#endif /* BOARD_H */
/** @} */

View File

@ -1,5 +1,5 @@
MODULE = board MODULE = board
DIRS = $(RIOTBOARD)/common/stm32f103c8 DIRS = $(RIOTBOARD)/common/blxxxpill
include $(RIOTBASE)/Makefile.base include $(RIOTBASE)/Makefile.base

View File

@ -1,4 +1 @@
ifneq (,$(filter saul_default,$(USEMODULE))) include $(RIOTBOARD)/common/blxxxpill/Makefile.dep
USEMODULE += saul_gpio
endif
include $(RIOTBOARD)/common/stm32f103c8/Makefile.dep

View File

@ -1 +1 @@
include $(RIOTBOARD)/common/stm32f103c8/Makefile.features include $(RIOTBOARD)/common/blxxxpill/Makefile.features

View File

@ -1,2 +1,8 @@
USEMODULE += boards_common_stm32f103c8 ## the cpu to build for
include $(RIOTBOARD)/common/stm32f103c8/Makefile.include export CPU = stm32f1
export CPU_MODEL = stm32f103c8
export OPENOCD_CONFIG ?= $(RIOTBOARD)/common/blxxxpill/dist/openocd.cfg
USEMODULE += boards_common_blxxxpill
include $(RIOTBOARD)/common/blxxxpill/Makefile.include

View File

@ -1,35 +0,0 @@
/*
* Copyright (C) 2015 TriaGnoSys GmbH
* 2017 Alexander Kurth, Sören Tempel, Tristan Bruns
* 2018 Otto-von-Guericke-Universität Magdeburg
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup boards_blackpill
* @{
*
* @file
* @brief Board specific implementations for the Black Pill
* Board
*
* @author Víctor Ariño <victor.arino@triagnosys.com>
* @author Sören Tempel <tempel@uni-bremen.de>
* @author Tristan Bruns <tbruns@uni-bremen.de>
* @author Alexander Kurth <kurth1@uni-bremen.de>
* @author Marian Buschsieweke <marian.buschsieweke@ovgu.de>
*
* @}
*/
#include "board.h"
#include "periph/gpio.h"
void board_init(void)
{
cpu_init();
gpio_init(LED0_PIN, GPIO_OUT);
}

View File

@ -1 +0,0 @@
../../common/stm32f103c8/dist/openocd.cfg

9
boards/blackpill/doc.txt Normal file
View File

@ -0,0 +1,9 @@
/**
@defgroup boards_blackpill Blackpill board
@ingroup boards
@brief Support for the stm32f103c8 based blackpill board.
Refer to the common documentation of the bluepill and blackpill board in
@ref boards_common_blxxxpill instead.
*/

View File

@ -9,17 +9,9 @@
*/ */
/** /**
* @defgroup boards_blackpill Black pill * @ingroup boards_blackpill
* @ingroup boards
* @brief Support for the stm32f103c8 based Black pill. * @brief Support for the stm32f103c8 based Black pill.
* *
* This board can be bought very cheaply on sides like eBay or
* AliExpress. Although the MCU nominally has 64 KiB ROM, most of them
* have 128 KiB ROM. This board is almost identical to the bluepill board,
* except for the pin layout and the on board LED is connected to PB12 instead
* of PC13. For more information see:
* http://wiki.stm32duino.com/index.php?title=Black_Pill
*
* @{ * @{
* *
* @file * @file
@ -35,6 +27,7 @@
#ifndef BOARD_H #ifndef BOARD_H
#define BOARD_H #define BOARD_H
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
@ -43,36 +36,17 @@ extern "C" {
* @name Macros for controlling the on-board LED. * @name Macros for controlling the on-board LED.
* @{ * @{
*/ */
#define LED0_PORT GPIOB #define LED0_PORT GPIOB /**< GPIO-Port the LED is connected to */
#define LED0_PIN GPIO_PIN(PORT_B, 12) #define LED0_PORTNUM PORT_B /**< GPIO Port number the LED is connected to */
#define LED0_MASK (1 << 12) #define LED0_PINNUM (12) /**< Pin number the LED is connected to */
#define LED0_ON (LED0_PORT->BSRR = (LED0_MASK << 16))
#define LED0_OFF (LED0_PORT->BSRR = LED0_MASK)
#define LED0_TOGGLE (LED0_PORT->ODR ^= LED0_MASK)
/** @} */
/**
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
*/
void board_init(void);
/**
* @brief Use the 2nd UART for STDIO on this board
*/
#define STDIO_UART_DEV UART_DEV(1)
/**
* @name xtimer configuration
* @{
*/
#define XTIMER_WIDTH (16)
#define XTIMER_BACKOFF (19)
/** @} */ /** @} */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
/* Beware: This include must come *after* LED0 paramters have been defined */
#include "board_common.h"
#endif /* BOARD_H */ #endif /* BOARD_H */
/** @} */ /** @} */

View File

@ -1,49 +0,0 @@
/*
* Copyright (C) 2017 HAW Hamburg
* 2018 Otto-von-Guericke-Universität Magdeburg
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup boards_blackpill
* @{
*
* @file
* @brief Board specific configuration of direct mapped GPIOs
*
* @author Sebastian Meiling <s@mlng.net>
* @author Marian Buschsieweke <marian.buschsieweke@ovgu.de>
*/
#ifndef GPIO_PARAMS_H
#define GPIO_PARAMS_H
#include "board.h"
#include "saul/periph.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief GPIO pin configuration
*/
static const saul_gpio_params_t saul_gpio_params[] =
{
{
.name = "LED",
.pin = LED0_PIN,
.mode = GPIO_OUT,
.flags = (SAUL_GPIO_INVERTED | SAUL_GPIO_INIT_CLEAR)
},
};
#ifdef __cplusplus
}
#endif
#endif /* GPIO_PARAMS_H */
/** @} */

View File

@ -0,0 +1,5 @@
MODULE = board
DIRS = $(RIOTBOARD)/common/blxxxpill
include $(RIOTBASE)/Makefile.base

View File

@ -0,0 +1 @@
include $(RIOTBOARD)/common/blxxxpill/Makefile.dep

View File

@ -0,0 +1 @@
include $(RIOTBOARD)/common/blxxxpill/Makefile.features

View File

@ -0,0 +1,8 @@
## the cpu to build for
export CPU = stm32f1
export CPU_MODEL = stm32f103cb
export OPENOCD_CONFIG ?= $(RIOTBOARD)/common/blxxxpill/dist/openocd-128kib.cfg
USEMODULE += boards_common_blxxxpill
include $(RIOTBOARD)/common/blxxxpill/Makefile.include

View File

@ -0,0 +1,9 @@
/**
@defgroup boards_bluepill_128kib Bluepill board (128KiB flash hack version)
@ingroup boards
@brief Support for the stm32f103c8 based bluepill board.
Refer to the common documentation of the bluepill and blackpill board in
@ref boards_common_blxxxpill instead.
*/

View File

@ -0,0 +1,45 @@
/*
* Copyright (C) 2015 TriaGnoSys GmbH
* 2017 Alexander Kurth, Sören Tempel, Tristan Bruns
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup boards_bluepill_128kib
*
* This board can be bought very cheaply on sides like eBay or
* AliExpress. Although the MCU nominally has 64 KiB ROM, most of them
* have 128 KiB ROM. For more information see:
* http://wiki.stm32duino.com/index.php?title=Blue_Pill
*
* @{
*
* @file
* @brief Peripheral MCU configuration for the bluepill board
*
* @author Víctor Ariño <victor.arino@triagnosys.com>
* @author Sören Tempel <tempel@uni-bremen.de>
* @author Tristan Bruns <tbruns@uni-bremen.de>
* @author Alexander Kurth <kurth1@uni-bremen.de>
*/
#ifndef BOARD_H
#define BOARD_H
#include "board_common.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Board common contains all required info */
#ifdef __cplusplus
}
#endif
#endif /* BOARD_H */
/** @} */

View File

@ -1,5 +1,5 @@
MODULE = board MODULE = board
DIRS = $(RIOTBOARD)/common/stm32f103c8 DIRS = $(RIOTBOARD)/common/blxxxpill
include $(RIOTBASE)/Makefile.base include $(RIOTBASE)/Makefile.base

View File

@ -1,4 +1 @@
ifneq (,$(filter saul_default,$(USEMODULE))) include $(RIOTBOARD)/common/blxxxpill/Makefile.dep
USEMODULE += saul_gpio
endif
include $(RIOTBOARD)/common/stm32f103c8/Makefile.dep

View File

@ -1 +1 @@
include $(RIOTBOARD)/common/stm32f103c8/Makefile.features include $(RIOTBOARD)/common/blxxxpill/Makefile.features

View File

@ -1,2 +1,8 @@
USEMODULE += boards_common_stm32f103c8 ## the cpu to build for
include $(RIOTBOARD)/common/stm32f103c8/Makefile.include export CPU = stm32f1
export CPU_MODEL = stm32f103c8
export OPENOCD_CONFIG ?= $(RIOTBOARD)/common/blxxxpill/dist/openocd.cfg
USEMODULE += boards_common_blxxxpill
include $(RIOTBOARD)/common/blxxxpill/Makefile.include

View File

@ -1 +0,0 @@
../../common/stm32f103c8/dist/openocd.cfg

View File

@ -3,156 +3,7 @@
@ingroup boards @ingroup boards
@brief Support for the stm32f103c8 based bluepill board. @brief Support for the stm32f103c8 based bluepill board.
## Overview Refer to the common documentation of the bluepill and blackpill board in
@ref boards_common_blxxxpill instead.
The bluepill is an STM32F103 based board which can be bought for around
2€ on sides like AliExpress, eBay and others. Although the STM32F130C8
MCU nominally has 64 KB flash, most [actually have 128 KB
flash][Flashsize].
## Hardware
![bluepill](https://camo.githubusercontent.com/8df2fb54f87527bdd57fe007352d72c1f377d08f/687474703a2f2f77696b692e73746d33326475696e6f2e636f6d2f696d616765732f7468756d622f312f31392f53544d33325f426c75655f50696c6c5f746f702e6a70672f38303070782d53544d33325f426c75655f50696c6c5f746f702e6a7067)
### MCU
| MCU | STM32F103C8 |
|:----------|:-----------------------|
| Family | ARM Cortex-M3 |
| Vendor | STMicroelectronics |
| RAM | 20 KB |
| Flash | 64 KB / 128 KB |
| Frequency | up to 72 MHz |
| Timer | 3x 16-Bit |
| ADC | 2x 12-bit, 10 channels |
| UART | 3 |
| SPI | 2 |
| I2C | 2 |
| CAN | 1 |
| Vcc | 2.0 to 3.6 V |
| Datasheet | [Datasheet][Datasheet] |
## Implementation Status
| ID | Supported |
|:----- |:--------- |
| GPIO | yes |
| PWM | yes |
| UART | yes |
| ADC | yes |
| I2C | no |
| SPI | yes |
| USB | no |
| Timer | yes |
| CAN | no |
## Flashing
To program and debug the board you need a SWD capable debugger. The
easiest way is using [OpenOCD][OpenOCD]. By default RIOT uses the hardware
reset signal and connects to the chip under reset for flashing. This is
required to reliably connect to the device even when the MCU is in a low power
mode. Therefore not only SWDIO and SWCLK, but also the RST pin of your
debugger need to be connected to the board. Once the device is connected to
the debugger and OpenOCD is installed, you can flash the device with:
$ make BOARD=bluepill flash
### Additional Flash
To make use of the entire 128 KB flash, compile your application with:
$ make STM32F103C8_FLASH_HACK=1 BOARD=bluepill
This sets the `CPU_MODEL` make variable to `stm32f103cb`, the default
value is `stm32f103c8`. These two CPU models basically only have one
major difference, the latter has 128 KB flash while the former has 64
KB. You may also set `STM32F103C8_FLASH_HACK` as environment variable.
If you want to flash a binary compiled this way you either need to
figure out how to adjust the OpenOCD configuration to make it use 128 KB
flash or use this [stlink fork][caboStlink] which has a
[patch][caboPatch] to make use of the entire 128 KB flash using:
$ C8T6HACK=1 st-flash write /dev/sgX $pathToHexFile 0x8000000
## Connecting via Serial
The default UART port used is UART2, which uses pins A2 (TX) and A3 (RX).
To use it, configure your UART to operate at a baudrate of 115200/8N1.
## Using PWM
PWM is available at pins A8 to A11.
## Known Issues
### USB connector
The Micro-USB port is sometimes not soldered properly. Also, it is
usually equipped with an incorrect resistor. [This can be fixed multiple
ways][USB].
### Flashing fails
Please check whether the debugger is properly connected, including the hardware
reset signal pin.
| Pin on Debugger | Pin on Blue Pill |
|:------------------ |:---------------- |
| SWDIO | DIO |
| SWCLK | DCLK |
| NRST | R |
| GND | GND |
| VDD (3.3V) (*) | 3.3 |
| Target VCC (**) | 3.3 |
- (*) Most debuggers have a 3.3V supply voltage to power the board. You can
alternatively power the board using the TTL-Adapter or via Micro-USB.
- (**) Some debuggers monitor the voltage of the target MCU. Their target VCC
pin needs to be connected to one of the 3.3V pins of the boards.
Most very cheap SWD debuggers (especially those imported for about 2€ from far
east) do not have a Target VCC pin; they will still work just fine. On these
cheap debuggers the pin to send the reset signal to the board is often either
not present or defunct. You can work around this by pressing the reset button
when OpenOCD wants to connect to the Blue Pill. Hit the reset button again after
flashing in order to boot the newly flashed image.
## Where to buy
The board is sold under different names. On some sites it is called
`bluepill` or `blue pill`. On others you might find it by searching for
`stm32f103c8` or `stm32f103c8t6`.
Try [eBay][eBay] or [AliExpress][AliExpress].
## Further reading
* http://wiki.stm32duino.com/index.php?title=Blue_Pill
* http://wiki.stm32duino.com/index.php?title=Maple_Mini#Clones
* http://www.st.com/content/st_com/en/products/microcontrollers/stm32-32-bit-
arm-cortex-mcus/stm32-mainstream-mcus/stm32f1-series/stm32f103/stm32f103c8.html
[Datasheet]: http://www.st.com/content/ccc/resource/technical/document/datash
eet/33/d4/6f/1d/df/0b/4c/6d/CD00161566.pdf/files/CD00161566.pdf/jcr:content/tran
slations/en.CD00161566.pdf
[Flashsize]:
http://wiki.stm32duino.com/index.php?title=Blue_Pill#128_KB_flash_on_C8_version
[eBay]: https://www.ebay.com/sch/i.html?_nkw=stm32f103c8
[AliExpress]: https://www.aliexpress.com/wholesale?SearchText=STM32F103C8T6
[OpenOCD]: https://github.com/RIOT-OS/RIOT/wiki/OpenOCD
[USB]:
http://wiki.stm32duino.com/index.php?title=Blue_Pill#Hardware_installation
[imgTop]:
http://wiki.stm32duino.com/images/thumb/1/19/STM32_Blue_Pill_top.jpg/800px-
STM32_Blue_Pill_top.jpg
[caboStlink]: https://github.com/cabo/stlink
[caboPatch]:
https://github.com/cabo/stlink/commit/e2ff1710ca6caeb55b5b99f7bd8a29181ccf533d
*/ */

View File

@ -29,41 +29,12 @@
#ifndef BOARD_H #ifndef BOARD_H
#define BOARD_H #define BOARD_H
#include "board_common.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/**
* @name Macros for controlling the on-board LED.
* @{
*/
#define LED0_PORT GPIOC
#define LED0_PIN GPIO_PIN(PORT_C, 13)
#define LED0_MASK (1 << 13)
#define LED0_ON (LED0_PORT->BSRR = (LED0_MASK << 16))
#define LED0_OFF (LED0_PORT->BSRR = LED0_MASK)
#define LED0_TOGGLE (LED0_PORT->ODR ^= LED0_MASK)
/** @} */
/**
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
*/
void board_init(void);
/**
* @brief Use the 2nd UART for STDIO on this board
*/
#define STDIO_UART_DEV UART_DEV(1)
/**
* @name xtimer configuration
* @{
*/
#define XTIMER_WIDTH (16)
#define XTIMER_BACKOFF (19)
/** @} */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -1,3 +1,3 @@
MODULE = boards_common_stm32f103c8 MODULE = boards_common_blxxxpill
include $(RIOTBASE)/Makefile.base include $(RIOTBASE)/Makefile.base

View File

@ -0,0 +1,3 @@
ifneq (,$(filter saul_default,$(USEMODULE)))
USEMODULE += saul_gpio
endif

View File

@ -1,13 +1,4 @@
## the cpu to build for INCLUDES += -I$(RIOTBOARD)/common/blxxxpill/include
export CPU = stm32f1
STM32F103C8_FLASH_HACK ?= 0
ifneq ($(STM32F103C8_FLASH_HACK),0)
export CPU_MODEL = stm32f103cb
else
export CPU_MODEL = stm32f103c8
endif
INCLUDES += -I$(RIOTBOARD)/common/stm32f103c8/include
# define the default port depending on the host OS # define the default port depending on the host OS
PORT_LINUX ?= /dev/ttyUSB0 PORT_LINUX ?= /dev/ttyUSB0

View File

@ -0,0 +1,22 @@
set CHIPNAME STM32F103C8Tx
# Enable debug when in low power modes
set ENABLE_LOW_POWER 1
# Stop Watchdog counters when halt
set STOP_WATCHDOG 1
# STlink Debug clock frequency
set CLOCK_FREQ 4000
# use hardware reset, connect under reset
# connect_assert_srst needed if low power mode application running (WFI...)
reset_config srst_only srst_nogate connect_assert_srst
set CONNECT_UNDER_RESET 1
# brutally overwriting detected flash size with 128KiB (OpenOCD > 0.10.0)
set FLASH_SIZE 0x20000
source [find target/stm32f1x.cfg]
$_TARGETNAME configure -rtos auto

View File

@ -0,0 +1,161 @@
/**
@defgroup boards_common_blxxxpill Common code for bluepill and blackpill
@ingroup boards_common
@brief Support for cheap stm32f103c8 based boards such as bluepill and blackpill.
## Overview
The bluepill and the blackpill are STM32F103 based board which can be bought for
around 2€ on sides like AliExpress, eBay and others. Although the STM32F130C8
MCU nominally has 64 KiB flash, most [actually have 128 KiB flash][Flashsize].
There are also versions that only report to have 32 KiB, but actually have
64 KiB.
## Hardware
![bluepill](https://camo.githubusercontent.com/8df2fb54f87527bdd57fe007352d72c1f377d08f/687474703a2f2f77696b692e73746d33326475696e6f2e636f6d2f696d616765732f7468756d622f312f31392f53544d33325f426c75655f50696c6c5f746f702e6a70672f38303070782d53544d33325f426c75655f50696c6c5f746f702e6a7067)
### MCU
| MCU | STM32F103C8 |
|:----------|:--------------------------|
| Family | ARM Cortex-M3 |
| Vendor | STMicroelectronics |
| RAM | 20 KiB |
| Flash | 32 KiB/ 64 KiB / 128 KiB |
| Frequency | up to 72 MHz |
| Timer | 3x 16-Bit |
| ADC | 2x 12-bit, 10 channels |
| UART | 3 |
| SPI | 2 |
| I2C | 2 |
| CAN | 1 |
| Vcc | 2.0 to 3.6 V |
| Datasheet | [Datasheet][Datasheet] |
## Implementation Status
| ID | Supported |
|:----- |:--------- |
| GPIO | yes |
| PWM | yes |
| UART | yes |
| ADC | yes |
| I2C | yes |
| SPI | yes |
| USB | no |
| Timer | yes |
| CAN | no |
## Flashing
To program and debug the board you need a SWD capable debugger. The
easiest way is using [OpenOCD][OpenOCD]. By default RIOT uses the hardware
reset signal and connects to the chip under reset for flashing. This is
required to reliably connect to the device even when the MCU is in a low power
mode. Therefore not only SWDIO and SWCLK, but also the RST pin of your
debugger need to be connected to the board. Once the device is connected to
the debugger and OpenOCD is installed, you can flash the device with:
$ make BOARD=bluepill flash
Or for the blackpill with:
$ make BOARD=blackpill flash
### Additional Flash
To make use of the entire 128 KiB flash, compile and flash your application
with:
$ make BOARD=bluepill-128kib flash
Or for the blackpill with:
$ make BOARD=blackpill-128kib flash
This sets the `CPU_MODEL` make variable to `stm32f103cb`, the default
value is `stm32f103c8`. These two CPU models basically only have one
major difference, the former has 128 KiB flash while the latter has 64
KiB.
Flashing for the 128KiB version currently (as of September 2019) requires the
development version of OpenOCD.
## Connecting via Serial
The default UART port used is UART2, which uses pins A2 (TX) and A3 (RX).
To use it, configure your UART to operate at a baudrate of 115200/8N1.
## Using PWM
PWM is available at pins A8 to A11.
## Known Issues
### USB connector
The Micro-USB port is sometimes not soldered properly. Also, it is
usually equipped with an incorrect resistor. [This can be fixed multiple
ways][USB].
### Flashing fails
Please check whether the debugger is properly connected, including the hardware
reset signal pin.
| Pin on Debugger | Pin on Blue Pill |
|:------------------ |:---------------- |
| SWDIO | DIO |
| SWCLK | DCLK |
| NRST | R |
| GND | GND |
| VDD (3.3V) (*) | 3.3 |
| Target VCC (**) | 3.3 |
- (*) Most debuggers have a 3.3V supply voltage to power the board. You can
alternatively power the board using the TTL-Adapter or via Micro-USB.
- (**) Some debuggers monitor the voltage of the target MCU. Their target VCC
pin needs to be connected to one of the 3.3V pins of the boards.
Most very cheap SWD debuggers (especially those imported for about 2€ from far
east) do not have a Target VCC pin; they will still work just fine. On these
cheap debuggers the pin to send the reset signal to the board is often either
not present or defunct. You can work around this by pressing the reset button
when OpenOCD wants to connect to the Blue Pill. Hit the reset button again after
flashing in order to boot the newly flashed image.
## Where to buy
The board is sold under different names. On some sites it is called
`bluepill` or `blue pill`. On others you might find it by searching for
`stm32f103c8` or `stm32f103c8t6`.
Try [eBay][eBay] or [AliExpress][AliExpress].
## Further reading
* http://wiki.stm32duino.com/index.php?title=Blue_Pill
* http://wiki.stm32duino.com/index.php?title=Maple_Mini#Clones
* http://www.st.com/content/st_com/en/products/microcontrollers/stm32-32-bit-
arm-cortex-mcus/stm32-mainstream-mcus/stm32f1-series/stm32f103/stm32f103c8.html
[Datasheet]: http://www.st.com/content/ccc/resource/technical/document/datash
eet/33/d4/6f/1d/df/0b/4c/6d/CD00161566.pdf/files/CD00161566.pdf/jcr:content/tran
slations/en.CD00161566.pdf
[Flashsize]:
http://wiki.stm32duino.com/index.php?title=Blue_Pill#128_KB_flash_on_C8_version
[eBay]: https://www.ebay.com/sch/i.html?_nkw=stm32f103c8
[AliExpress]: https://www.aliexpress.com/wholesale?SearchText=STM32F103C8T6
[OpenOCD]: https://github.com/RIOT-OS/RIOT/wiki/OpenOCD
[USB]:
http://wiki.stm32duino.com/index.php?title=Blue_Pill#Hardware_installation
[imgTop]:
http://wiki.stm32duino.com/images/thumb/1/19/STM32_Blue_Pill_top.jpg/800px-
STM32_Blue_Pill_top.jpg
*/

View File

@ -0,0 +1,75 @@
/*
* Copyright (C) 2015 TriaGnoSys GmbH
* 2017 Alexander Kurth, Sören Tempel, Tristan Bruns
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup boards_common_blxxxpill
*
* @{
*
* @file
* @brief Peripheral MCU configuration for the bluepill/blackpill board
*
* @author Víctor Ariño <victor.arino@triagnosys.com>
* @author Sören Tempel <tempel@uni-bremen.de>
* @author Tristan Bruns <tbruns@uni-bremen.de>
* @author Alexander Kurth <kurth1@uni-bremen.de>
*/
#ifndef BOARD_COMMON_H
#define BOARD_COMMON_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* @name Macros for controlling the on-board LED.
* @{
*/
#ifndef LED0_PORT
#define LED0_PORT GPIOC /**< GPIO-Port the LED is connected to */
#endif
#ifndef LED0_PORTNUM
#define LED0_PORTNUM PORT_C /**< GPIO Port number the LED is connected to */
#endif
#ifndef LED0_PINNUM
#define LED0_PINNUM (13) /**< Pin number the LED is connected to */
#endif
#define LED0_PIN GPIO_PIN(LED0_PORTNUM, LED0_PINNUM) /**< GPIO-Pin the LED is connected to */
#define LED0_MASK (1 << LED0_PINNUM)
#define LED0_ON (LED0_PORT->BSRR = (LED0_MASK << 16)) /**< Turn LED0 on */
#define LED0_OFF (LED0_PORT->BSRR = LED0_MASK) /**< Turn LED0 off */
#define LED0_TOGGLE (LED0_PORT->ODR ^= LED0_MASK) /**< Toggle LED0 */
/** @} */
/**
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
*/
void board_init(void);
/**
* @brief Use the 2nd UART for STDIO on this board
*/
#define STDIO_UART_DEV UART_DEV(1)
/**
* @name xtimer configuration
* @{
*/
#define XTIMER_WIDTH (16)
#define XTIMER_BACKOFF (19)
/** @} */
#ifdef __cplusplus
}
#endif
#endif /* BOARD_COMMON_H */
/** @} */

View File

@ -7,7 +7,7 @@
*/ */
/** /**
* @ingroup boards_bluepill * @ingroup boards_common_blxxxpill
* @{ * @{
* *
* @file * @file

View File

@ -8,13 +8,11 @@
*/ */
/** /**
* @defgroup boards_common_stm32f103c8 STM32F103C8 based boards common * @ingroup boards_common_blxxxpill
* @ingroup boards_common
* @brief Shared files and configuration for STM32F103C8 based boards
* @{ * @{
* *
* @file * @file
* @brief Peripheral MCU configuration for the bluepill board * @brief Peripheral MCU configuration for the bluepill/blackpill boards
* *
* @author Víctor Ariño <victor.arino@triagnosys.com> * @author Víctor Ariño <victor.arino@triagnosys.com>
* @author Sören Tempel <tempel@uni-bremen.de> * @author Sören Tempel <tempel@uni-bremen.de>

View File

@ -12,13 +12,13 @@ BOARD_BLACKLIST := arduino-duemilanove arduino-leonardo arduino-mega2560 arduino
chronos jiminy-mega256rfr2 mega-xplained msb-430 msb-430h telosb \ chronos jiminy-mega256rfr2 mega-xplained msb-430 msb-430h telosb \
waspmote-pro wsn430-v1_3b wsn430-v1_4 z1 waspmote-pro wsn430-v1_3b wsn430-v1_4 z1
BOARD_INSUFFICIENT_MEMORY := airfy-beacon b-l072z-lrwan1 bluepill \ BOARD_INSUFFICIENT_MEMORY := airfy-beacon b-l072z-lrwan1 blackpill bluepill \
calliope-mini cc2650-launchpad cc2650stk hifive1 i-nucleo-lrwan1 \ calliope-mini cc2650-launchpad cc2650stk hifive1 i-nucleo-lrwan1 \
maple-mini microbit nrf51dongle nrf6310 nucleo-f031k6 \ maple-mini microbit nrf51dongle nrf6310 nucleo-f031k6 \
nucleo-f042k6 nucleo-f303k8 nucleo-f303k8 nucleo-l031k6 nucleo-f030r8 \ nucleo-f042k6 nucleo-f303k8 nucleo-f303k8 nucleo-l031k6 nucleo-f030r8 \
nucleo-f070rb nucleo-f072rb nucleo-f103rb nucleo-f302r8 nucleo-f334r8 \ nucleo-f070rb nucleo-f072rb nucleo-f103rb nucleo-f302r8 nucleo-f334r8 \
nucleo-l031k6 nucleo-l053r8 nucleo-l073rz opencm904 \ nucleo-l031k6 nucleo-l053r8 nucleo-l073rz opencm904 \
saml11-xpro bluepill blackpill saml10-xpro \ saml11-xpro bluepill saml10-xpro \
stm32l0538-disco \ stm32l0538-disco \
spark-core stm32f0discovery stm32mindev yunjia-nrf51822 spark-core stm32f0discovery stm32mindev yunjia-nrf51822

View File

@ -9,8 +9,8 @@ RIOTBASE ?= $(CURDIR)/../..
BOARD_INSUFFICIENT_MEMORY := airfy-beacon arduino-duemilanove arduino-leonardo \ BOARD_INSUFFICIENT_MEMORY := airfy-beacon arduino-duemilanove arduino-leonardo \
arduino-mega2560 arduino-nano arduino-uno \ arduino-mega2560 arduino-nano arduino-uno \
b-l072z-lrwan1 blackpill \ b-l072z-lrwan1 blackpill blackpill-128kib bluepill \
bluepill calliope-mini cc2650-launchpad cc2650stk \ bluepill-128kib calliope-mini cc2650-launchpad cc2650stk \
hifive1 hifive1b i-nucleo-lrwan1 lsn50 maple-mini mega-xplained microbit msb-430 \ hifive1 hifive1b i-nucleo-lrwan1 lsn50 maple-mini mega-xplained microbit msb-430 \
msb-430h nrf51dk nrf51dongle nrf6310 \ msb-430h nrf51dk nrf51dongle nrf6310 \
nucleo-f031k6 nucleo-f042k6 \ nucleo-f031k6 nucleo-f042k6 \

View File

@ -7,8 +7,10 @@ BOARD ?= native
# This has to be the absolute path to the RIOT base directory: # This has to be the absolute path to the RIOT base directory:
RIOTBASE ?= $(CURDIR)/../.. RIOTBASE ?= $(CURDIR)/../..
BOARD_INSUFFICIENT_MEMORY := airfy-beacon b-l072z-lrwan1 blackpill bluepill calliope-mini \ BOARD_INSUFFICIENT_MEMORY := airfy-beacon b-l072z-lrwan1 blackpill \
cc2650-launchpad cc2650stk hifive1 hifive1b i-nucleo-lrwan1 lobaro-lorabox lsn50 \ blackpill-128kib bluepill bluepill-128kib \
calliope-mini cc2650-launchpad cc2650stk hifive1 \
hifive1b i-nucleo-lrwan1 lobaro-lorabox lsn50 \
maple-mini microbit nrf51dk nrf51dongle nrf6310 \ maple-mini microbit nrf51dk nrf51dongle nrf6310 \
nucleo-f030r8 nucleo-f070rb nucleo-f072rb \ nucleo-f030r8 nucleo-f070rb nucleo-f072rb \
nucleo-f103rb nucleo-f302r8 nucleo-f334r8 \ nucleo-f103rb nucleo-f302r8 nucleo-f334r8 \

View File

@ -6,7 +6,8 @@ BOARD ?= native
# This has to be the absolute path to the RIOT base directory: # This has to be the absolute path to the RIOT base directory:
RIOTBASE ?= $(CURDIR)/../.. RIOTBASE ?= $(CURDIR)/../..
BOARD_INSUFFICIENT_MEMORY := blackpill bluepill calliope-mini cc2650-launchpad \ BOARD_INSUFFICIENT_MEMORY := blackpill blackpill-128kib bluepill \
bluepill-128kib calliope-mini cc2650-launchpad \
cc2650stk hamilton i-nucleo-lrwan1 lsn50 \ cc2650stk hamilton i-nucleo-lrwan1 lsn50 \
maple-mini microbit nrf51dk nrf51dongle \ maple-mini microbit nrf51dk nrf51dongle \
nucleo-f030r8 nucleo-f031k6 nucleo-f042k6 \ nucleo-f030r8 nucleo-f031k6 nucleo-f042k6 \

View File

@ -6,7 +6,8 @@ BOARD ?= native
# This has to be the absolute path to the RIOT base directory: # This has to be the absolute path to the RIOT base directory:
RIOTBASE ?= $(CURDIR)/../.. RIOTBASE ?= $(CURDIR)/../..
BOARD_INSUFFICIENT_MEMORY := blackpill bluepill calliope-mini cc2650-launchpad \ BOARD_INSUFFICIENT_MEMORY := blackpill blackpill-128kib bluepill \
bluepill-128kib calliope-mini cc2650-launchpad \
cc2650stk i-nucleo-lrwan1 lobaro-lorabox maple-mini \ cc2650stk i-nucleo-lrwan1 lobaro-lorabox maple-mini \
microbit nrf51dk nrf51dongle \ microbit nrf51dk nrf51dongle \
nucleo-f030r8 nucleo-f031k6 \ nucleo-f030r8 nucleo-f031k6 \

View File

@ -19,7 +19,9 @@ BOARD_WHITELIST += arduino-mkr1000
BOARD_WHITELIST += arduino-mkrfox1200 BOARD_WHITELIST += arduino-mkrfox1200
BOARD_WHITELIST += arduino-mkrzero BOARD_WHITELIST += arduino-mkrzero
BOARD_WHITELIST += blackpill BOARD_WHITELIST += blackpill
BOARD_WHITELIST += blackpill-128kib
BOARD_WHITELIST += bluepill BOARD_WHITELIST += bluepill
BOARD_WHITELIST += bluepill-128kib
BOARD_WHITELIST += feather-m0 BOARD_WHITELIST += feather-m0
BOARD_WHITELIST += opencm904 BOARD_WHITELIST += opencm904
BOARD_WHITELIST += spark-core BOARD_WHITELIST += spark-core

View File

@ -2,7 +2,8 @@ include ../Makefile.tests_common
BOARD_INSUFFICIENT_MEMORY := airfy-beacon arduino-duemilanove arduino-leonardo \ BOARD_INSUFFICIENT_MEMORY := airfy-beacon arduino-duemilanove arduino-leonardo \
arduino-mega2560 arduino-nano arduino-uno \ arduino-mega2560 arduino-nano arduino-uno \
b-l072z-lrwan1 blackpill bluepill calliope-mini \ b-l072z-lrwan1 blackpill blackpill-128kib \
bluepill bluepill-128kib calliope-mini \
cc2650-launchpad cc2650stk chronos hifive1 hifive1b \ cc2650-launchpad cc2650stk chronos hifive1 hifive1b \
i-nucleo-lrwan1 lsn50 maple-mini \ i-nucleo-lrwan1 lsn50 maple-mini \
mega-xplained microbit msb-430 msb-430h \ mega-xplained microbit msb-430 msb-430h \

View File

@ -2,7 +2,7 @@ DEVELHELP = 0
include ../Makefile.tests_common include ../Makefile.tests_common
BOARD_INSUFFICIENT_MEMORY := blackpill bluepill BOARD_INSUFFICIENT_MEMORY :=
USEMODULE += embunit USEMODULE += embunit
USEMODULE += l2util USEMODULE += l2util

View File

@ -11,7 +11,8 @@ FEATURES_OPTIONAL += periph_rtc
BOARD_WHITELIST := airfy-beacon arduino-due arduino-duemilanove \ BOARD_WHITELIST := airfy-beacon arduino-due arduino-duemilanove \
arduino-leonardo arduino-mega2560 arduino-mkr1000 \ arduino-leonardo arduino-mega2560 arduino-mkr1000 \
arduino-mkrzero arduino-uno arduino-zero avsextrem \ arduino-mkrzero arduino-uno arduino-zero avsextrem \
b-l072z-lrwan1 b-l475e-iot01a bluepill cc2538dk ek-lm4f120xl \ b-l072z-lrwan1 b-l475e-iot01a blackpill blackpill-128kib \
bluepill bluepill-128kib cc2538dk ek-lm4f120xl \
feather-m0 fox frdm-k22f frdm-k64f i-nucleo-lrwan1 ikea-tradfri \ feather-m0 fox frdm-k22f frdm-k64f i-nucleo-lrwan1 ikea-tradfri \
iotlab-a8-m3 iotlab-m3 limifrog-v1 maple-mini msb-430 msb-430h msba2 \ iotlab-a8-m3 iotlab-m3 limifrog-v1 maple-mini msb-430 msb-430h msba2 \
msbiot mulle nrf52840dk nrf52dk nrf6310 nucleo-f207zg nucleo-f303ze \ msbiot mulle nrf52840dk nrf52dk nrf6310 nucleo-f207zg nucleo-f303ze \

View File

@ -33,7 +33,8 @@ BOARD_INSUFFICIENT_MEMORY := arduino-duemilanove arduino-leonardo arduino-nano \
BOARD_WHITELIST := airfy-beacon arduino-due arduino-duemilanove \ BOARD_WHITELIST := airfy-beacon arduino-due arduino-duemilanove \
arduino-leonardo arduino-mega2560 arduino-mkr1000 \ arduino-leonardo arduino-mega2560 arduino-mkr1000 \
arduino-mkrzero arduino-uno arduino-zero avsextrem \ arduino-mkrzero arduino-uno arduino-zero avsextrem \
b-l072z-lrwan1 b-l475e-iot01a bluepill cc2538dk ek-lm4f120xl \ b-l072z-lrwan1 b-l475e-iot01a blackpill blackpill-128kib \
bluepill bluepill-128kib cc2538dk ek-lm4f120xl \
feather-m0 fox frdm-k22f frdm-k64f ikea-tradfri i-nucleo-lrwan1 \ feather-m0 fox frdm-k22f frdm-k64f ikea-tradfri i-nucleo-lrwan1 \
iotlab-a8-m3 iotlab-m3 limifrog-v1 maple-mini msba2 msbiot \ iotlab-a8-m3 iotlab-m3 limifrog-v1 maple-mini msba2 msbiot \
mulle nrf52840dk nrf52dk nrf6310 nucleo-f207zg nucleo-f303ze \ mulle nrf52840dk nrf52dk nrf6310 nucleo-f207zg nucleo-f303ze \

View File

@ -31,7 +31,9 @@ BOARD_INSUFFICIENT_MEMORY := airfy-beacon \
arduino-zero \ arduino-zero \
b-l072z-lrwan1 \ b-l072z-lrwan1 \
blackpill \ blackpill \
blackpill-128kib \
bluepill \ bluepill \
bluepill-128kib \
calliope-mini \ calliope-mini \
cc2650-launchpad \ cc2650-launchpad \
cc2650stk \ cc2650stk \