boards: Split off 128KiB version of bl*pill
- Created new `bluepill-128kib` as 128KiB version of the `bluepill` - Created new `blackpill-128kib` as 128KiB version of the `blackpill` - Updated `openocd.cfg` to allow flashing 128KiB of ROM
This commit is contained in:
parent
c1d5286516
commit
09d1dcf6b3
5
boards/blackpill-128kib/Makefile
Normal file
5
boards/blackpill-128kib/Makefile
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
MODULE = board
|
||||||
|
|
||||||
|
DIRS = $(RIOTBOARD)/common/blxxxpill
|
||||||
|
|
||||||
|
include $(RIOTBASE)/Makefile.base
|
||||||
1
boards/blackpill-128kib/Makefile.dep
Normal file
1
boards/blackpill-128kib/Makefile.dep
Normal file
@ -0,0 +1 @@
|
|||||||
|
include $(RIOTBOARD)/common/blxxxpill/Makefile.dep
|
||||||
1
boards/blackpill-128kib/Makefile.features
Normal file
1
boards/blackpill-128kib/Makefile.features
Normal file
@ -0,0 +1 @@
|
|||||||
|
include $(RIOTBOARD)/common/blxxxpill/Makefile.features
|
||||||
8
boards/blackpill-128kib/Makefile.include
Normal file
8
boards/blackpill-128kib/Makefile.include
Normal 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
|
||||||
9
boards/blackpill-128kib/doc.txt
Normal file
9
boards/blackpill-128kib/doc.txt
Normal 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.
|
||||||
|
|
||||||
|
*/
|
||||||
52
boards/blackpill-128kib/include/board.h
Normal file
52
boards/blackpill-128kib/include/board.h
Normal 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 */
|
||||||
|
/** @} */
|
||||||
@ -1,5 +1,5 @@
|
|||||||
MODULE = board
|
MODULE = board
|
||||||
|
|
||||||
DIRS = $(RIOTBOARD)/common/stm32f103c8
|
DIRS = $(RIOTBOARD)/common/blxxxpill
|
||||||
|
|
||||||
include $(RIOTBASE)/Makefile.base
|
include $(RIOTBASE)/Makefile.base
|
||||||
|
|||||||
@ -1,4 +1 @@
|
|||||||
ifneq (,$(filter saul_default,$(USEMODULE)))
|
include $(RIOTBOARD)/common/blxxxpill/Makefile.dep
|
||||||
USEMODULE += saul_gpio
|
|
||||||
endif
|
|
||||||
include $(RIOTBOARD)/common/stm32f103c8/Makefile.dep
|
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
include $(RIOTBOARD)/common/stm32f103c8/Makefile.features
|
include $(RIOTBOARD)/common/blxxxpill/Makefile.features
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -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);
|
|
||||||
}
|
|
||||||
1
boards/blackpill/dist/openocd.cfg
vendored
1
boards/blackpill/dist/openocd.cfg
vendored
@ -1 +0,0 @@
|
|||||||
../../common/stm32f103c8/dist/openocd.cfg
|
|
||||||
9
boards/blackpill/doc.txt
Normal file
9
boards/blackpill/doc.txt
Normal 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.
|
||||||
|
|
||||||
|
*/
|
||||||
@ -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 */
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|||||||
@ -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 */
|
|
||||||
/** @} */
|
|
||||||
5
boards/bluepill-128kib/Makefile
Normal file
5
boards/bluepill-128kib/Makefile
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
MODULE = board
|
||||||
|
|
||||||
|
DIRS = $(RIOTBOARD)/common/blxxxpill
|
||||||
|
|
||||||
|
include $(RIOTBASE)/Makefile.base
|
||||||
1
boards/bluepill-128kib/Makefile.dep
Normal file
1
boards/bluepill-128kib/Makefile.dep
Normal file
@ -0,0 +1 @@
|
|||||||
|
include $(RIOTBOARD)/common/blxxxpill/Makefile.dep
|
||||||
1
boards/bluepill-128kib/Makefile.features
Normal file
1
boards/bluepill-128kib/Makefile.features
Normal file
@ -0,0 +1 @@
|
|||||||
|
include $(RIOTBOARD)/common/blxxxpill/Makefile.features
|
||||||
8
boards/bluepill-128kib/Makefile.include
Normal file
8
boards/bluepill-128kib/Makefile.include
Normal 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
|
||||||
9
boards/bluepill-128kib/doc.txt
Normal file
9
boards/bluepill-128kib/doc.txt
Normal 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.
|
||||||
|
|
||||||
|
*/
|
||||||
45
boards/bluepill-128kib/include/board.h
Normal file
45
boards/bluepill-128kib/include/board.h
Normal 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 */
|
||||||
|
/** @} */
|
||||||
@ -1,5 +1,5 @@
|
|||||||
MODULE = board
|
MODULE = board
|
||||||
|
|
||||||
DIRS = $(RIOTBOARD)/common/stm32f103c8
|
DIRS = $(RIOTBOARD)/common/blxxxpill
|
||||||
|
|
||||||
include $(RIOTBASE)/Makefile.base
|
include $(RIOTBASE)/Makefile.base
|
||||||
|
|||||||
@ -1,4 +1 @@
|
|||||||
ifneq (,$(filter saul_default,$(USEMODULE)))
|
include $(RIOTBOARD)/common/blxxxpill/Makefile.dep
|
||||||
USEMODULE += saul_gpio
|
|
||||||
endif
|
|
||||||
include $(RIOTBOARD)/common/stm32f103c8/Makefile.dep
|
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
include $(RIOTBOARD)/common/stm32f103c8/Makefile.features
|
include $(RIOTBOARD)/common/blxxxpill/Makefile.features
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
1
boards/bluepill/dist/openocd.cfg
vendored
1
boards/bluepill/dist/openocd.cfg
vendored
@ -1 +0,0 @@
|
|||||||
../../common/stm32f103c8/dist/openocd.cfg
|
|
||||||
@ -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
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
### 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
|
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
MODULE = boards_common_stm32f103c8
|
MODULE = boards_common_blxxxpill
|
||||||
|
|
||||||
include $(RIOTBASE)/Makefile.base
|
include $(RIOTBASE)/Makefile.base
|
||||||
3
boards/common/blxxxpill/Makefile.dep
Normal file
3
boards/common/blxxxpill/Makefile.dep
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
ifneq (,$(filter saul_default,$(USEMODULE)))
|
||||||
|
USEMODULE += saul_gpio
|
||||||
|
endif
|
||||||
@ -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
|
||||||
22
boards/common/blxxxpill/dist/openocd-128kib.cfg
vendored
Normal file
22
boards/common/blxxxpill/dist/openocd-128kib.cfg
vendored
Normal 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
|
||||||
161
boards/common/blxxxpill/doc.txt
Normal file
161
boards/common/blxxxpill/doc.txt
Normal 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
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### 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
|
||||||
|
*/
|
||||||
75
boards/common/blxxxpill/include/board_common.h
Normal file
75
boards/common/blxxxpill/include/board_common.h
Normal 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 */
|
||||||
|
/** @} */
|
||||||
@ -7,7 +7,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ingroup boards_bluepill
|
* @ingroup boards_common_blxxxpill
|
||||||
* @{
|
* @{
|
||||||
*
|
*
|
||||||
* @file
|
* @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>
|
||||||
Loading…
x
Reference in New Issue
Block a user