stm32: Simplify USB/Serial/CANbus Kconfig selection

Combine the various communication options into a single "make
menuconfig" menu item.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2021-03-18 13:20:54 -04:00
parent c8dc3afc23
commit 1eddc0fd90
29 changed files with 186 additions and 172 deletions

View File

@ -1,8 +1,8 @@
# This file contains common pin mappings for the BIGTREETECH SKR E3
# DIP. To use this config, the firmware should be compiled for the
# STM32F103 with a "28KiB bootloader". Also, select "Enable extra
# low-level configuration options" and configure "GPIO pins to set at
# micro-controller startup" to "!PC13".
# STM32F103 with a "28KiB bootloader" and USB communication. Also,
# select "Enable extra low-level configuration options" and configure
# "GPIO pins to set at micro-controller startup" to "!PC13".
# The "make flash" command does not work on the SKR E3 DIP. Instead,
# after running "make", copy the generated "out/klipper.bin" file to a

View File

@ -1,8 +1,8 @@
# This file contains common pin mappings for the BIGTREETECH SKR mini
# E3. To use this config, the firmware should be compiled for the
# STM32F103 with a "28KiB bootloader". Also, select "Enable extra
# low-level configuration options" and configure "GPIO pins to set at
# micro-controller startup" to "!PC13".
# STM32F103 with a "28KiB bootloader" and USB communication. Also,
# select "Enable extra low-level configuration options" and configure
# "GPIO pins to set at micro-controller startup" to "!PC13".
# The "make flash" command does not work on the SKR mini E3. Instead,
# after running "make", copy the generated "out/klipper.bin" file to a

View File

@ -1,8 +1,8 @@
# This file contains common pin mappings for the BIGTREETECH SKR mini
# E3 v1.2. To use this config, the firmware should be compiled for the
# STM32F103 with a "28KiB bootloader". Also, select "Enable extra
# low-level configuration options" and configure "GPIO pins to set at
# micro-controller startup" to "!PC13".
# STM32F103 with a "28KiB bootloader" and USB communication. Also,
# select "Enable extra low-level configuration options" and configure
# "GPIO pins to set at micro-controller startup" to "!PC13".
# The "make flash" command does not work on the SKR mini E3. Instead,
# after running "make", copy the generated "out/klipper.bin" file to a

View File

@ -1,8 +1,8 @@
# This file contains common pin mappings for the BIGTREETECH SKR mini
# E3 v2.0. To use this config, the firmware should be compiled for the
# STM32F103 with a "28KiB bootloader". Also, select "Enable extra
# low-level configuration options" and configure "GPIO pins to set at
# micro-controller startup" to "!PA14".
# STM32F103 with a "28KiB bootloader" and USB communication. Also,
# select "Enable extra low-level configuration options" and configure
# "GPIO pins to set at micro-controller startup" to "!PA14".
# The "make flash" command does not work on the SKR mini E3. Instead,
# after running "make", copy the generated "out/klipper.bin" file to a

View File

@ -1,8 +1,8 @@
# This file contains common pin mappings for the BIGTREETECH SKR mini
# MZ v1.0. To use this config, the firmware should be compiled for the
# STM32F103 with a "28KiB bootloader". Also, select "Enable extra
# low-level configuration options" and configure "GPIO pins to set at
# micro-controller startup" to "!PA14".
# STM32F103 with a "28KiB bootloader" and USB communication. Also,
# select "Enable extra low-level configuration options" and configure
# "GPIO pins to set at micro-controller startup" to "!PA14".
# The "make flash" command does not work on the SKR mini MZ. Instead,
# after running "make", copy the generated "out/klipper.bin" file to a

View File

@ -1,6 +1,6 @@
# This file contains common pin mappings for the BIGTREETECH SKR
# MINI. To use this config, the firmware should be compiled for the
# STM32F103 with a "28KiB bootloader".
# STM32F103 with a "28KiB bootloader" and USB communication.
# The "make flash" command does not work on the SKR mini. Instead,
# after running "make", copy the generated "out/klipper.bin" file to a

View File

@ -1,11 +1,11 @@
# This file contains pin mappings for the Creality "v4.2.7" board. To
# use this config, during "make menuconfig" select the STM32F103 with
# a "28KiB bootloader" and with "Use USB for communication" disabled.
# a "28KiB bootloader" and serial (on USART1 PA10/PA9) communication.
# If you prefer a direct serial connection, in "make menuconfig"
# select "Enable extra low-level configuration options" and select the
# USART3 serial port, which is broken out on the 10 pin IDC cable used
# for the LCD module as follows:
# select "Enable extra low-level configuration options" and select
# serial (on USART3 PB11/PB10), which is broken out on the 10 pin IDC
# cable used for the LCD module as follows:
# 3: Tx, 4: Rx, 9: GND, 10: VCC
# Flash this firmware by copying "out/klipper.bin" to a SD card and

View File

@ -1,7 +1,7 @@
# This file contains common pin mappings for the Fysetc Cheetah v1.1
# board. To use this config, the firmware should be compiled for the
# STM32F103 with "No bootloader" and with "Use USB for communication"
# disabled.
# STM32F103 with "No bootloader" and serial (on USART1 PA10/PA9)
# communication.
# The "make flash" command does not work on the Cheetah. Instead,
# after running "make", run the following command to flash the board:

View File

@ -1,8 +1,8 @@
# This file contains common pin mappings for MKS Robin E3 boards. To
# use this config, the firmware should be compiled for the STM32F103.
# When running "make menuconfig", enable "extra low-level
# configuration setup", select the 20KiB bootloader, disable "USB for
# communication", and select USART1 for the "Serial Port".
# configuration setup", select the 20KiB bootloader, and serial (on
# USART1 PA10/PA9) communication.
# Note that the "make flash" command does not work with MKS Robin
# boards. After running "make", run the following command:

View File

@ -1,8 +1,8 @@
# This file contains common pin mappings for MKS Robin Nano (v1.2.004)
# boards. To use this config, the firmware should be compiled for the
# STM32F103. When running "make menuconfig", enable "extra low-level
# configuration setup", select the 28KiB bootloader, disable "USB for
# communication", and select USART3 for the "Serial Port".
# configuration setup", select the 28KiB bootloader, and serial (on
# USART3 PB11/PB10) communication.
# Note that the "make flash" command does not work with MKS Robin
# boards. After running "make", run the following command:

View File

@ -1,8 +1,8 @@
# This file contains common pin mappings for MKS Robin Nano V2
# boards. To use this config, the firmware should be compiled for the
# STM32F103. When running "make menuconfig", enable "extra low-level
# configuration setup", select the 28KiB bootloader, disable "USB for
# communication", and select USART3 for the "Serial Port".
# configuration setup", select the 28KiB bootloader, and serial (on
# USART3 PB11/PB10) communication.
# Note that the "make flash" command does not work with MKS Robin
# boards. After running "make", run the following command:

View File

@ -1,9 +1,9 @@
# This file contains common pin mappings for the Alfawise U30 printer.
# To use this config, the firmware should be compiled for the
# STM32F103. When running "make menuconfig", enable "extra low-level
# configuration setup", select the 64KiB bootloader, disable "USB for
# communication", and set "GPIO pins to set at micro-controller
# startup" to "!PC4,!PD12".
# configuration setup", select the 64KiB bootloader, serial (on USART1
# PA10/PA9) communication, and set "GPIO pins to set at
# micro-controller startup" to "!PC4,!PD12".
# The "make flash" command does not work on the Alfawise U30. Instead,
# after running "make", copy the generated "out/klipper.bin" file to a

View File

@ -1,7 +1,7 @@
# This file contains pin mappings for the stock 2020 Creality CR6-SE.
# To use this config, during "make menuconfig" select the
# STM32F103 with a "28KiB bootloader" and with "Use USB for
# communication" disabled.
# To use this config, during "make menuconfig" select the STM32F103
# with a "28KiB bootloader" and serial (on USART1 PA10/PA9)
# communication.
# Flash this firmware by copying "out/klipper.bin" to a SD card and
# turning on the printer with the card inserted. The firmware

View File

@ -1,12 +1,12 @@
# This file contains pin mappings for the stock 2020 Creality Ender 3
# V2. To use this config, during "make menuconfig" select the
# STM32F103 with a "28KiB bootloader" and with "Use USB for
# communication" disabled.
# STM32F103 with a "28KiB bootloader" and serial (on USART1 PA10/PA9)
# communication.
# If you prefer a direct serial connection, in "make menuconfig"
# select "Enable extra low-level configuration options" and select the
# USART3 serial port, which is broken out on the 10 pin IDC cable used
# for the LCD module as follows:
# select "Enable extra low-level configuration options" and select
# serial (on USART3 PB11/PB10), which is broken out on the 10 pin IDC
# cable used for the LCD module as follows:
# 3: Tx, 4: Rx, 9: GND, 10: VCC
# Flash this firmware by copying "out/klipper.bin" to a SD card and

View File

@ -1,7 +1,7 @@
# This file contains pin mappings for the stock 2020 Creality Ender 3
# MAX. To use this config, during "make menuconfig" select the
# STM32F103 with a "28KiB bootloader" and with "Use USB for
# communication" disabled.
# STM32F103 with a "28KiB bootloader" and serial (on USART1 PA10/PA9)
# communication.
# Because this printer has factory wiring, mounts, and firmware for
# a BLTouch, but does not ship with one at this time, default values
@ -10,9 +10,9 @@
# customize the offsets, particularly z-offset, for their specific unit.
# If you prefer a direct serial connection, in "make menuconfig"
# select "Enable extra low-level configuration options" and select the
# USART3 serial port, which is broken out on the 10 pin IDC cable used
# for the LCD module as follows:
# select "Enable extra low-level configuration options" and select
# serial (on USART3 PB11/PB10), which is broken out on the 10 pin IDC
# cable used for the LCD module as follows:
# 3: Tx, 4: Rx, 9: GND, 10: VCC
# Flash this firmware by copying "out/klipper.bin" to a SD card and

View File

@ -1,12 +1,12 @@
# This file contains pin mappings for the stock 2020 Creality Ender 3
# Pro with the 32-bit Creality 4.2.2 board. To use this config, during
# "make menuconfig" select the STM32F103 with a "28KiB bootloader" and
# with "Use USB for communication" disabled.
# serial (on USART1 PA10/PA9) communication.
# If you prefer a direct serial connection, in "make menuconfig"
# select "Enable extra low-level configuration options" and select the
# USART3 serial port, which is broken out on the 10 pin IDC cable used
# for the LCD module as follows:
# select "Enable extra low-level configuration options" and select
# serial (on USART3 PB11/PB10), which is broken out on the 10 pin IDC
# cable used for the LCD module as follows:
# 3: Tx, 4: Rx, 9: GND, 10: VCC
# Flash this firmware by copying "out/klipper.bin" to a SD card and

View File

@ -1,7 +1,7 @@
# This file contains pin mappings for the stock 2020 Creality Ender 6.
# To use this config, during "make menuconfig" select the
# STM32F103 with a "28KiB bootloader" and with "Use USB for
# communication" disabled.
# To use this config, during "make menuconfig" select the STM32F103
# with a "28KiB bootloader" and serial (on USART1 PA10/PA9)
# communication.
# Because this printer has factory wiring, mounts, and firmware for
# a BLTouch, but does not ship with one at this time, default values
@ -10,9 +10,9 @@
# customize the offsets, particularly z-offset, for their specific unit.
# If you prefer a direct serial connection, in "make menuconfig"
# select "Enable extra low-level configuration options" and select the
# USART3 serial port, which is broken out on the 10 pin IDC cable used
# for the LCD module as follows:
# select "Enable extra low-level configuration options" and select
# serial (on USART3 PB11/PB10), which is broken out on the 10 pin IDC
# cable used for the LCD module as follows:
# 3: Tx, 4: Rx, 9: GND, 10: VCC
# Flash this firmware by copying "out/klipper.bin" to a SD card and

View File

@ -3,8 +3,8 @@
# To use this config, the firmware should be compiled for the
# STM32F103. When running "make menuconfig", enable "extra low-level
# configuration setup", select the 28KiB bootloader, disable "USB for
# communication", and select USART3 for the "Serial Port".
# configuration setup", select the 28KiB bootloader, and serial (on
# USART3 PB11/PB10) communication.
# Note that the "make flash" command does not work with MKS Robin
# boards. After running "make", run the following command:

View File

@ -1,7 +1,6 @@
# This file contains common pin mappings for the 2017 Monoprice
# Mini Delta. To use this config, the firmware should be compiled for the
# STM32F070 microcontroller with an 8MHz crystal and USB for communication
# (instead of serial).
# STM32F070 microcontroller with an 8MHz crystal and USB for communication.
#
# IMPORTANT: Use of Kipper with a Monoprice Mini Delta requires a power supply
# with a _minimum_ 120 W (i.e. 10 A) capacity! The stock power supply will not

View File

@ -1,7 +1,6 @@
# This file contains common pin mappings for the 2019 Monoprice
# Select Mini v2. To use this config, the firmware should be compiled for the
# STM32F070 microcontroller with an 8MHz crystal and USB for communication
# (instead of serial).
# STM32F070 microcontroller with an 8MHz crystal and USB for communication.
#
# Use the following settings in make menuconfig:
#

View File

@ -1,15 +1,15 @@
# This is a Klipper configuration for TronXY X5SA, with
# CXY-V6 motherboard.
# This is a Klipper configuration for TronXY X5SA, with CXY-V6
# motherboard.
# === FLASHING WITH STOCK BOOTLOADER ===
# You should make firmware for STM32F103 with bootloader offset
# at 0x8008800 (Chitu v6 Bootloader). Uncheck USB, and leave default
# serial settings.
#
# Use "./scripts/update_chitu.py ./out/klipper.bin ./out/update.cbd" after make to generate update.cbd.
# Put `update.cbd` onto SD card, and reboot the printer.
# It will be automatically installed, and you will be able to update it this way.
# at 0x8008800 (Chitu v6 Bootloader) and serial (on USART1 PA10/PA9)
# communication.
# Use "./scripts/update_chitu.py ./out/klipper.bin ./out/update.cbd"
# after make to generate update.cbd. Put `update.cbd` onto SD card,
# and reboot the printer. It will be automatically installed, and you
# will be able to update it this way.
[mcu]
serial: /dev/serial/by-id/usb-1a86_USB_Serial-if00-port0

View File

@ -5,8 +5,7 @@
# When running "make menuconfig" you have to:
# - enable "extra low-level configuration setup",
# - select the 28KiB bootloader,
# - disable "USB for communication"
# - select USART3 for the "Serial Port"
# - select serial (on USART3 PB11/PB10) communication
# - set "GPIO pins to set at micro-controller startup" to "!PC6,!PD13"
# Note that the "make flash" command does not work with the Sapphire

View File

@ -17,6 +17,11 @@ config BOARD_DIRECTORY
string
default "stm32"
######################################################################
# Chip selection
######################################################################
choice
prompt "Processor model"
config MACH_STM32F103
@ -61,12 +66,13 @@ config MACH_STM32F4
bool
config HAVE_STM32_USBFS
bool
default y if MACH_STM32F103 || MACH_STM32F0
default n
default y if MACH_STM32F103 || MACH_STM32F042 || MACH_STM32F070
config HAVE_STM32_USBOTG
bool
default y if MACH_STM32F2 || MACH_STM32F4
default n
config HAVE_STM32_CANBUS
bool
default y if MACH_STM32F1 || MACH_STM32F2 || MACH_STM32F4 || MACH_STM32F042
config MCU
string
@ -118,6 +124,11 @@ config STACK_SIZE
int
default 512
######################################################################
# Bootloader
######################################################################
choice
prompt "Bootloader offset" if MACH_STM32F207 || MACH_STM32F407 || MACH_STM32F405 || MACH_STM32F103 || MACH_STM32F070
config STM32_FLASH_START_2000
@ -161,6 +172,11 @@ config ARMCM_RAM_VECTORTABLE
default y if MACH_STM32F0 && FLASH_START != 0x8000000
default n
######################################################################
# Clock
######################################################################
choice
prompt "Clock Reference" if LOW_LEVEL_OPTIONS
config STM32_CLOCK_REF_8M
@ -182,35 +198,6 @@ config CLOCK_REF_FREQ
default 1 if STM32_CLOCK_REF_INTERNAL
default 8000000
config USBSERIAL
bool "Use USB for communication (instead of serial)"
depends on HAVE_STM32_USBFS || HAVE_STM32_USBOTG
default y
config CANSERIAL
bool "Use CAN for communication (instead of serial)"
depends on !USBSERIAL
default n
config CANBUS_FREQUENCY
int "CAN bus speed" if LOW_LEVEL_OPTIONS && CANSERIAL
default 500000
choice
depends on CANSERIAL
prompt "CAN pins"
config CAN_PINS_PA11_PA12
bool "Pins PA11(rx) and PA12(tx)"
config CAN_PINS_PB8_PB9
bool "Pins PB8(rx) and PB9(tx)"
config CAN_PINS_PI8_PH13
bool "Pins PI9(rx) and PH13(tx)" if MACH_STM32F4
config CAN_PINS_PB5_PB6
bool "Pins PB5(rx) and PB6(tx)" if MACH_STM32F4
config CAN_PINS_PB12_PB13
bool "Pins PB12(rx) and PB13(tx)" if MACH_STM32F4
config CAN_PINS_PD0_PD1
bool "Pins PD0(rx) and PD1(tx)" if MACH_STM32F4
endchoice
config STM32F0_TRIM
int "Internal clock trim override" if LOW_LEVEL_OPTIONS && MACH_STM32F0 && STM32_CLOCK_REF_INTERNAL && !USBSERIAL
default 16
@ -220,39 +207,69 @@ config STM32F0_TRIM
Default is 16 (use factory default). Each increment increases
the clock rate by ~240KHz.
config STM32F042_PIN_SWAP
bool "Use PA9/PA10 for USB or CAN" if MACH_STM32F042
depends on (USBSERIAL || CANSERIAL) && MACH_STM32F042
default y if (USBSERIAL || CANSERIAL)
default n
help
Remaps logical pins PA11/PA12 to physical PA9/PA10 on low pincount F042 devices.
config SERIAL
depends on !USBSERIAL && !CANSERIAL
######################################################################
# Communication inteface
######################################################################
config USBSERIAL
bool
config SERIAL
bool
config CANSERIAL
bool
default y
choice
depends on SERIAL
prompt "Serial Port" if LOW_LEVEL_OPTIONS
help
Select the serial device to use.
prompt "Communication interface"
config STM32_USB_PA11_PA12
bool "USB (on PA11/PA12)" if HAVE_STM32_USBFS || HAVE_STM32_USBOTG
select USBSERIAL
config STM32_USB_PA11_PA12_REMAP
bool "USB (on PA9/PA10)" if LOW_LEVEL_OPTIONS && MACH_STM32F042
select USBSERIAL
config STM32_SERIAL_USART1
bool "USART1"
bool "Serial (on USART1 PA10/PA9)"
select SERIAL
config STM32_SERIAL_USART1_ALT
bool "USART1 (on PA15/PA14)" if MACH_STM32F0
bool "Serial (on USART1 PA15/PA14)" if LOW_LEVEL_OPTIONS && MACH_STM32F0
select SERIAL
config STM32_SERIAL_USART2
bool "USART2 (on PA3/PA2)"
bool "Serial (on USART2 PA3/PA2)" if LOW_LEVEL_OPTIONS
select SERIAL
config STM32_SERIAL_USART2_ALT
bool "USART2 (on PA15/PA14)" if MACH_STM32F0
bool "Serial (on USART2 PA15/PA14)" if LOW_LEVEL_OPTIONS && MACH_STM32F0
select SERIAL
config STM32_SERIAL_USART3
bool "USART3"
bool "Serial (on USART3 PB11/PB10)" if LOW_LEVEL_OPTIONS && !MACH_STM32F0
select SERIAL
config STM32_SERIAL_USART3_ALT
bool "USART3 (on PD9/PD8)" if MACH_STM32F405 || MACH_STM32F407
depends on LOW_LEVEL_OPTIONS && (MACH_STM32F405 || MACH_STM32F407)
bool "Serial (on USART3 PD9/PD8)"
select SERIAL
config STM32_CANBUS_PA11_PA12
bool "CAN bus (on PA11/PA12)" if HAVE_STM32_CANBUS
select CANSERIAL
config STM32_CANBUS_PA11_PA12_REMAP
bool "CAN bus (on PA9/PA10)" if LOW_LEVEL_OPTIONS && MACH_STM32F042
select CANSERIAL
config STM32_CANBUS_PB8_PB9
bool "CAN bus (on PB8/PB9)" if LOW_LEVEL_OPTIONS && HAVE_STM32_CANBUS
select CANSERIAL
config STM32_CANBUS_PI8_PH13
bool "CAN bus (on PI9/PH13)" if LOW_LEVEL_OPTIONS && MACH_STM32F4
select CANSERIAL
config STM32_CANBUS_PB5_PB6
bool "CAN bus (on PB5/PB6)" if LOW_LEVEL_OPTIONS && MACH_STM32F4
select CANSERIAL
config STM32_CANBUS_PB12_PB13
bool "CAN bus (on PB12/PB13)" if LOW_LEVEL_OPTIONS && MACH_STM32F4
select CANSERIAL
config STM32_CANBUS_PD0_PD1
bool "CAN bus (on PD0/PD1)" if LOW_LEVEL_OPTIONS && MACH_STM32F4
select CANSERIAL
endchoice
config SERIAL_PORT
int
default 3 if STM32_SERIAL_USART3 || STM32_SERIAL_USART3_ALT
default 2 if STM32_SERIAL_USART2 || STM32_SERIAL_USART2_ALT
default 1
config CANBUS_FREQUENCY
int "CAN bus speed" if LOW_LEVEL_OPTIONS && CANSERIAL
default 500000
endif

View File

@ -17,32 +17,32 @@
#include "internal.h" // enable_pclock
#include "sched.h" // DECL_INIT
#if CONFIG_CAN_PINS_PA11_PA12
#if CONFIG_STM32_CANBUS_PA11_PA12 || CONFIG_STM32_CANBUS_PA11_PA12_REMAP
DECL_CONSTANT_STR("RESERVE_PINS_CAN", "PA11,PA12");
#define GPIO_Rx GPIO('A', 11)
#define GPIO_Tx GPIO('A', 12)
#endif
#if CONFIG_CAN_PINS_PB8_PB9
#if CONFIG_STM32_CANBUS_PB8_PB9
DECL_CONSTANT_STR("RESERVE_PINS_CAN", "PB8,PB9");
#define GPIO_Rx GPIO('B', 8)
#define GPIO_Tx GPIO('B', 9)
#endif
#if CONFIG_CAN_PINS_PI8_PH13
#if CONFIG_STM32_CANBUS_PI8_PH13
DECL_CONSTANT_STR("RESERVE_PINS_CAN", "PI9,PH13");
#define GPIO_Rx GPIO('I', 9)
#define GPIO_Tx GPIO('H', 13)
#endif
#if CONFIG_CAN_PINS_PB5_PB6
#if CONFIG_STM32_CANBUS_PB5_PB6
DECL_CONSTANT_STR("RESERVE_PINS_CAN", "PB5,PB6");
#define GPIO_Rx GPIO('B', 5)
#define GPIO_Tx GPIO('B', 6)
#endif
#if CONFIG_CAN_PINS_PB12_PB13
#if CONFIG_STM32_CANBUS_PB12_PB13
DECL_CONSTANT_STR("RESERVE_PINS_CAN", "PB12,PB13");
#define GPIO_Rx GPIO('B', 12)
#define GPIO_Tx GPIO('B', 13)
#endif
#if CONFIG_CAN_PINS_PD0_PD1
#if CONFIG_STM32_CANBUS_PD0_PD1
DECL_CONSTANT_STR("RESERVE_PINS_CAN", "PD0,PD1");
#define GPIO_Rx GPIO('D', 0)
#define GPIO_Tx GPIO('D', 1)
@ -68,14 +68,14 @@
#if CONFIG_MACH_STM32F4
#warning CAN on STM32F4 is untested
#if (CONFIG_CAN_PINS_PA11_PA12 || CONFIG_CAN_PINS_PB8_PB9 \
|| CONFIG_CAN_PINS_PD0_PD1 || CONFIG_CAN_PINS_PI9_PH13)
#if (CONFIG_STM32_CANBUS_PA11_PA12 || CONFIG_STM32_CANBUS_PB8_PB9 \
|| CONFIG_STM32_CANBUS_PD0_PD1 || CONFIG_STM32_CANBUS_PI9_PH13)
#define SOC_CAN CAN1
#define CAN_RX0_IRQn CAN1_RX0_IRQn
#define CAN_RX1_IRQn CAN1_RX1_IRQn
#define CAN_TX_IRQn CAN1_TX_IRQn
#define CAN_SCE_IRQn CAN1_SCE_IRQn
#elif CONFIG_CAN_PINS_PB5_PB6 || CONFIG_CAN_PINS_PB12_PB13
#elif CONFIG_STM32_CANBUS_PB5_PB6 || CONFIG_STM32_CANBUS_PB12_PB13
#define SOC_CAN CAN2
#define CAN_RX0_IRQn CAN2_RX0_IRQn
#define CAN_RX1_IRQn CAN2_RX1_IRQn

View File

@ -12,28 +12,28 @@
#include "sched.h" // DECL_INIT
// Select the configured serial port
#if CONFIG_SERIAL_PORT == 1
#if CONFIG_STM32_SERIAL_USART1
DECL_CONSTANT_STR("RESERVE_PINS_serial", "PA10,PA9");
#define GPIO_Rx GPIO('A', 10)
#define GPIO_Tx GPIO('A', 9)
#define USARTx USART1
#define USARTx_IRQn USART1_IRQn
#elif CONFIG_SERIAL_PORT == 2
#elif CONFIG_STM32_SERIAL_USART2
DECL_CONSTANT_STR("RESERVE_PINS_serial", "PA3,PA2");
#define GPIO_Rx GPIO('A', 3)
#define GPIO_Tx GPIO('A', 2)
#define USARTx USART2
#define USARTx_IRQn USART2_IRQn
#elif CONFIG_SERIAL_PORT == 3
#if CONFIG_STM32_SERIAL_USART3_ALT
DECL_CONSTANT_STR("RESERVE_PINS_serial", "PD9,PD8");
#define GPIO_Rx GPIO('D', 9)
#define GPIO_Tx GPIO('D', 8)
#else
DECL_CONSTANT_STR("RESERVE_PINS_serial", "PB11,PB10");
#define GPIO_Rx GPIO('B', 11)
#define GPIO_Tx GPIO('B', 10)
#endif
#elif CONFIG_STM32_SERIAL_USART3
DECL_CONSTANT_STR("RESERVE_PINS_serial", "PB11,PB10");
#define GPIO_Rx GPIO('B', 11)
#define GPIO_Tx GPIO('B', 10)
#define USARTx USART3
#define USARTx_IRQn USART3_IRQn
#elif CONFIG_STM32_SERIAL_USART3_ALT
DECL_CONSTANT_STR("RESERVE_PINS_serial", "PD9,PD8");
#define GPIO_Rx GPIO('D', 9)
#define GPIO_Tx GPIO('D', 8)
#define USARTx USART3
#define USARTx_IRQn USART3_IRQn
#endif

View File

@ -224,7 +224,8 @@ armcm_main(void)
// Support pin remapping USB/CAN pins on low pinout stm32f042
#ifdef SYSCFG_CFGR1_PA11_PA12_RMP
if (CONFIG_STM32F042_PIN_SWAP) {
if (CONFIG_STM32_USB_PA11_PA12_REMAP
|| CONFIG_STM32_CANBUS_PA11_PA12_REMAP) {
enable_pclock(SYSCFG_BASE);
SYSCFG->CFGR1 |= SYSCFG_CFGR1_PA11_PA12_RMP;
}

View File

@ -12,28 +12,28 @@
#include "sched.h" // DECL_INIT
// Select the configured serial port
#if CONFIG_SERIAL_PORT == 1
#if CONFIG_STM32_SERIAL_USART1_ALT
DECL_CONSTANT_STR("RESERVE_PINS_serial", "PA15,PA14");
#define GPIO_Rx GPIO('A', 15)
#define GPIO_Tx GPIO('A', 14)
#else
DECL_CONSTANT_STR("RESERVE_PINS_serial", "PA10,PA9");
#define GPIO_Rx GPIO('A', 10)
#define GPIO_Tx GPIO('A', 9)
#endif
#if CONFIG_STM32_SERIAL_USART1
DECL_CONSTANT_STR("RESERVE_PINS_serial", "PA10,PA9");
#define GPIO_Rx GPIO('A', 10)
#define GPIO_Tx GPIO('A', 9)
#define USARTx USART1
#define USARTx_IRQn USART1_IRQn
#elif CONFIG_SERIAL_PORT == 2
#if CONFIG_STM32_SERIAL_USART2_ALT
DECL_CONSTANT_STR("RESERVE_PINS_serial", "PA15,PA14");
#define GPIO_Rx GPIO('A', 15)
#define GPIO_Tx GPIO('A', 14)
#else
DECL_CONSTANT_STR("RESERVE_PINS_serial", "PA3,PA2");
#define GPIO_Rx GPIO('A', 3)
#define GPIO_Tx GPIO('A', 2)
#endif
#elif CONFIG_STM32_SERIAL_USART1_ALT
DECL_CONSTANT_STR("RESERVE_PINS_serial", "PA15,PA14");
#define GPIO_Rx GPIO('A', 15)
#define GPIO_Tx GPIO('A', 14)
#define USARTx USART1
#define USARTx_IRQn USART1_IRQn
#elif CONFIG_STM32_SERIAL_USART2
DECL_CONSTANT_STR("RESERVE_PINS_serial", "PA3,PA2");
#define GPIO_Rx GPIO('A', 3)
#define GPIO_Tx GPIO('A', 2)
#define USARTx USART2
#define USARTx_IRQn USART2_IRQn
#elif CONFIG_STM32_SERIAL_USART2_ALT
DECL_CONSTANT_STR("RESERVE_PINS_serial", "PA15,PA14");
#define GPIO_Rx GPIO('A', 15)
#define GPIO_Tx GPIO('A', 14)
#define USARTx USART2
#define USARTx_IRQn USART2_IRQn
#endif

View File

@ -1,4 +1,3 @@
# Base config file for STM32F031 boards
CONFIG_MACH_STM32=y
CONFIG_MACH_STM32F031=y
CONFIG_USBSERIAL=n

View File

@ -1,4 +1,4 @@
# Base config file for STM32F1 ARM processor using serial communication
CONFIG_MACH_STM32=y
CONFIG_MACH_STM32F103=y
CONFIG_USBSERIAL=n
CONFIG_STM32_SERIAL_USART1=y