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 # This file contains common pin mappings for the BIGTREETECH SKR E3
# DIP. To use this config, the firmware should be compiled for the # DIP. To use this config, the firmware should be compiled for the
# STM32F103 with a "28KiB bootloader". Also, select "Enable extra # STM32F103 with a "28KiB bootloader" and USB communication. Also,
# low-level configuration options" and configure "GPIO pins to set at # select "Enable extra low-level configuration options" and configure
# micro-controller startup" to "!PC13". # "GPIO pins to set at micro-controller startup" to "!PC13".
# The "make flash" command does not work on the SKR E3 DIP. Instead, # 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 # 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 # This file contains common pin mappings for the BIGTREETECH SKR mini
# E3. To use this config, the firmware should be compiled for the # E3. To use this config, the firmware should be compiled for the
# STM32F103 with a "28KiB bootloader". Also, select "Enable extra # STM32F103 with a "28KiB bootloader" and USB communication. Also,
# low-level configuration options" and configure "GPIO pins to set at # select "Enable extra low-level configuration options" and configure
# micro-controller startup" to "!PC13". # "GPIO pins to set at micro-controller startup" to "!PC13".
# The "make flash" command does not work on the SKR mini E3. Instead, # 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 # 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 # 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 # E3 v1.2. To use this config, the firmware should be compiled for the
# STM32F103 with a "28KiB bootloader". Also, select "Enable extra # STM32F103 with a "28KiB bootloader" and USB communication. Also,
# low-level configuration options" and configure "GPIO pins to set at # select "Enable extra low-level configuration options" and configure
# micro-controller startup" to "!PC13". # "GPIO pins to set at micro-controller startup" to "!PC13".
# The "make flash" command does not work on the SKR mini E3. Instead, # 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 # 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 # 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 # E3 v2.0. To use this config, the firmware should be compiled for the
# STM32F103 with a "28KiB bootloader". Also, select "Enable extra # STM32F103 with a "28KiB bootloader" and USB communication. Also,
# low-level configuration options" and configure "GPIO pins to set at # select "Enable extra low-level configuration options" and configure
# micro-controller startup" to "!PA14". # "GPIO pins to set at micro-controller startup" to "!PA14".
# The "make flash" command does not work on the SKR mini E3. Instead, # 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 # 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 # 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 # MZ v1.0. To use this config, the firmware should be compiled for the
# STM32F103 with a "28KiB bootloader". Also, select "Enable extra # STM32F103 with a "28KiB bootloader" and USB communication. Also,
# low-level configuration options" and configure "GPIO pins to set at # select "Enable extra low-level configuration options" and configure
# micro-controller startup" to "!PA14". # "GPIO pins to set at micro-controller startup" to "!PA14".
# The "make flash" command does not work on the SKR mini MZ. Instead, # 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 # 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 # This file contains common pin mappings for the BIGTREETECH SKR
# MINI. To use this config, the firmware should be compiled for the # 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, # The "make flash" command does not work on the SKR mini. Instead,
# after running "make", copy the generated "out/klipper.bin" file to a # 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 # This file contains pin mappings for the Creality "v4.2.7" board. To
# use this config, during "make menuconfig" select the STM32F103 with # 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" # If you prefer a direct serial connection, in "make menuconfig"
# select "Enable extra low-level configuration options" and select the # select "Enable extra low-level configuration options" and select
# USART3 serial port, which is broken out on the 10 pin IDC cable used # serial (on USART3 PB11/PB10), which is broken out on the 10 pin IDC
# for the LCD module as follows: # cable used for the LCD module as follows:
# 3: Tx, 4: Rx, 9: GND, 10: VCC # 3: Tx, 4: Rx, 9: GND, 10: VCC
# Flash this firmware by copying "out/klipper.bin" to a SD card and # 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 # This file contains common pin mappings for the Fysetc Cheetah v1.1
# board. To use this config, the firmware should be compiled for the # board. To use this config, the firmware should be compiled for the
# STM32F103 with "No bootloader" and with "Use USB for communication" # STM32F103 with "No bootloader" and serial (on USART1 PA10/PA9)
# disabled. # communication.
# The "make flash" command does not work on the Cheetah. Instead, # The "make flash" command does not work on the Cheetah. Instead,
# after running "make", run the following command to flash the board: # 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 # This file contains common pin mappings for MKS Robin E3 boards. To
# use this config, the firmware should be compiled for the STM32F103. # use this config, the firmware should be compiled for the STM32F103.
# When running "make menuconfig", enable "extra low-level # When running "make menuconfig", enable "extra low-level
# configuration setup", select the 20KiB bootloader, disable "USB for # configuration setup", select the 20KiB bootloader, and serial (on
# communication", and select USART1 for the "Serial Port". # USART1 PA10/PA9) communication.
# Note that the "make flash" command does not work with MKS Robin # Note that the "make flash" command does not work with MKS Robin
# boards. After running "make", run the following command: # 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) # 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 # boards. To use this config, the firmware should be compiled for the
# STM32F103. When running "make menuconfig", enable "extra low-level # STM32F103. When running "make menuconfig", enable "extra low-level
# configuration setup", select the 28KiB bootloader, disable "USB for # configuration setup", select the 28KiB bootloader, and serial (on
# communication", and select USART3 for the "Serial Port". # USART3 PB11/PB10) communication.
# Note that the "make flash" command does not work with MKS Robin # Note that the "make flash" command does not work with MKS Robin
# boards. After running "make", run the following command: # 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 # This file contains common pin mappings for MKS Robin Nano V2
# boards. To use this config, the firmware should be compiled for the # boards. To use this config, the firmware should be compiled for the
# STM32F103. When running "make menuconfig", enable "extra low-level # STM32F103. When running "make menuconfig", enable "extra low-level
# configuration setup", select the 28KiB bootloader, disable "USB for # configuration setup", select the 28KiB bootloader, and serial (on
# communication", and select USART3 for the "Serial Port". # USART3 PB11/PB10) communication.
# Note that the "make flash" command does not work with MKS Robin # Note that the "make flash" command does not work with MKS Robin
# boards. After running "make", run the following command: # 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. # This file contains common pin mappings for the Alfawise U30 printer.
# To use this config, the firmware should be compiled for the # To use this config, the firmware should be compiled for the
# STM32F103. When running "make menuconfig", enable "extra low-level # STM32F103. When running "make menuconfig", enable "extra low-level
# configuration setup", select the 64KiB bootloader, disable "USB for # configuration setup", select the 64KiB bootloader, serial (on USART1
# communication", and set "GPIO pins to set at micro-controller # PA10/PA9) communication, and set "GPIO pins to set at
# startup" to "!PC4,!PD12". # micro-controller startup" to "!PC4,!PD12".
# The "make flash" command does not work on the Alfawise U30. Instead, # The "make flash" command does not work on the Alfawise U30. Instead,
# after running "make", copy the generated "out/klipper.bin" file to a # 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. # This file contains pin mappings for the stock 2020 Creality CR6-SE.
# To use this config, during "make menuconfig" select the # To use this config, during "make menuconfig" select the STM32F103
# STM32F103 with a "28KiB bootloader" and with "Use USB for # with a "28KiB bootloader" and serial (on USART1 PA10/PA9)
# communication" disabled. # communication.
# Flash this firmware by copying "out/klipper.bin" to a SD card and # Flash this firmware by copying "out/klipper.bin" to a SD card and
# turning on the printer with the card inserted. The firmware # 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 # This file contains pin mappings for the stock 2020 Creality Ender 3
# V2. To use this config, during "make menuconfig" select the # V2. To use this config, during "make menuconfig" select the
# STM32F103 with a "28KiB bootloader" and with "Use USB for # STM32F103 with a "28KiB bootloader" and serial (on USART1 PA10/PA9)
# communication" disabled. # communication.
# If you prefer a direct serial connection, in "make menuconfig" # If you prefer a direct serial connection, in "make menuconfig"
# select "Enable extra low-level configuration options" and select the # select "Enable extra low-level configuration options" and select
# USART3 serial port, which is broken out on the 10 pin IDC cable used # serial (on USART3 PB11/PB10), which is broken out on the 10 pin IDC
# for the LCD module as follows: # cable used for the LCD module as follows:
# 3: Tx, 4: Rx, 9: GND, 10: VCC # 3: Tx, 4: Rx, 9: GND, 10: VCC
# Flash this firmware by copying "out/klipper.bin" to a SD card and # 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 # This file contains pin mappings for the stock 2020 Creality Ender 3
# MAX. To use this config, during "make menuconfig" select the # MAX. To use this config, during "make menuconfig" select the
# STM32F103 with a "28KiB bootloader" and with "Use USB for # STM32F103 with a "28KiB bootloader" and serial (on USART1 PA10/PA9)
# communication" disabled. # communication.
# Because this printer has factory wiring, mounts, and firmware for # Because this printer has factory wiring, mounts, and firmware for
# a BLTouch, but does not ship with one at this time, default values # 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. # customize the offsets, particularly z-offset, for their specific unit.
# If you prefer a direct serial connection, in "make menuconfig" # If you prefer a direct serial connection, in "make menuconfig"
# select "Enable extra low-level configuration options" and select the # select "Enable extra low-level configuration options" and select
# USART3 serial port, which is broken out on the 10 pin IDC cable used # serial (on USART3 PB11/PB10), which is broken out on the 10 pin IDC
# for the LCD module as follows: # cable used for the LCD module as follows:
# 3: Tx, 4: Rx, 9: GND, 10: VCC # 3: Tx, 4: Rx, 9: GND, 10: VCC
# Flash this firmware by copying "out/klipper.bin" to a SD card and # 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 # 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 # 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 # "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" # If you prefer a direct serial connection, in "make menuconfig"
# select "Enable extra low-level configuration options" and select the # select "Enable extra low-level configuration options" and select
# USART3 serial port, which is broken out on the 10 pin IDC cable used # serial (on USART3 PB11/PB10), which is broken out on the 10 pin IDC
# for the LCD module as follows: # cable used for the LCD module as follows:
# 3: Tx, 4: Rx, 9: GND, 10: VCC # 3: Tx, 4: Rx, 9: GND, 10: VCC
# Flash this firmware by copying "out/klipper.bin" to a SD card and # 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. # This file contains pin mappings for the stock 2020 Creality Ender 6.
# To use this config, during "make menuconfig" select the # To use this config, during "make menuconfig" select the STM32F103
# STM32F103 with a "28KiB bootloader" and with "Use USB for # with a "28KiB bootloader" and serial (on USART1 PA10/PA9)
# communication" disabled. # communication.
# Because this printer has factory wiring, mounts, and firmware for # Because this printer has factory wiring, mounts, and firmware for
# a BLTouch, but does not ship with one at this time, default values # 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. # customize the offsets, particularly z-offset, for their specific unit.
# If you prefer a direct serial connection, in "make menuconfig" # If you prefer a direct serial connection, in "make menuconfig"
# select "Enable extra low-level configuration options" and select the # select "Enable extra low-level configuration options" and select
# USART3 serial port, which is broken out on the 10 pin IDC cable used # serial (on USART3 PB11/PB10), which is broken out on the 10 pin IDC
# for the LCD module as follows: # cable used for the LCD module as follows:
# 3: Tx, 4: Rx, 9: GND, 10: VCC # 3: Tx, 4: Rx, 9: GND, 10: VCC
# Flash this firmware by copying "out/klipper.bin" to a SD card and # 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 # To use this config, the firmware should be compiled for the
# STM32F103. When running "make menuconfig", enable "extra low-level # STM32F103. When running "make menuconfig", enable "extra low-level
# configuration setup", select the 28KiB bootloader, disable "USB for # configuration setup", select the 28KiB bootloader, and serial (on
# communication", and select USART3 for the "Serial Port". # USART3 PB11/PB10) communication.
# Note that the "make flash" command does not work with MKS Robin # Note that the "make flash" command does not work with MKS Robin
# boards. After running "make", run the following command: # boards. After running "make", run the following command:

View File

@ -1,7 +1,6 @@
# This file contains common pin mappings for the 2017 Monoprice # This file contains common pin mappings for the 2017 Monoprice
# Mini Delta. To use this config, the firmware should be compiled for the # Mini Delta. To use this config, the firmware should be compiled for the
# STM32F070 microcontroller with an 8MHz crystal and USB for communication # STM32F070 microcontroller with an 8MHz crystal and USB for communication.
# (instead of serial).
# #
# IMPORTANT: Use of Kipper with a Monoprice Mini Delta requires a power supply # 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 # 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 # This file contains common pin mappings for the 2019 Monoprice
# Select Mini v2. To use this config, the firmware should be compiled for the # Select Mini v2. To use this config, the firmware should be compiled for the
# STM32F070 microcontroller with an 8MHz crystal and USB for communication # STM32F070 microcontroller with an 8MHz crystal and USB for communication.
# (instead of serial).
# #
# Use the following settings in make menuconfig: # Use the following settings in make menuconfig:
# #

View File

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

View File

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

View File

@ -17,6 +17,11 @@ config BOARD_DIRECTORY
string string
default "stm32" default "stm32"
######################################################################
# Chip selection
######################################################################
choice choice
prompt "Processor model" prompt "Processor model"
config MACH_STM32F103 config MACH_STM32F103
@ -61,12 +66,13 @@ config MACH_STM32F4
bool bool
config HAVE_STM32_USBFS config HAVE_STM32_USBFS
bool bool
default y if MACH_STM32F103 || MACH_STM32F0 default y if MACH_STM32F103 || MACH_STM32F042 || MACH_STM32F070
default n
config HAVE_STM32_USBOTG config HAVE_STM32_USBOTG
bool bool
default y if MACH_STM32F2 || MACH_STM32F4 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 config MCU
string string
@ -118,6 +124,11 @@ config STACK_SIZE
int int
default 512 default 512
######################################################################
# Bootloader
######################################################################
choice choice
prompt "Bootloader offset" if MACH_STM32F207 || MACH_STM32F407 || MACH_STM32F405 || MACH_STM32F103 || MACH_STM32F070 prompt "Bootloader offset" if MACH_STM32F207 || MACH_STM32F407 || MACH_STM32F405 || MACH_STM32F103 || MACH_STM32F070
config STM32_FLASH_START_2000 config STM32_FLASH_START_2000
@ -161,6 +172,11 @@ config ARMCM_RAM_VECTORTABLE
default y if MACH_STM32F0 && FLASH_START != 0x8000000 default y if MACH_STM32F0 && FLASH_START != 0x8000000
default n default n
######################################################################
# Clock
######################################################################
choice choice
prompt "Clock Reference" if LOW_LEVEL_OPTIONS prompt "Clock Reference" if LOW_LEVEL_OPTIONS
config STM32_CLOCK_REF_8M config STM32_CLOCK_REF_8M
@ -182,35 +198,6 @@ config CLOCK_REF_FREQ
default 1 if STM32_CLOCK_REF_INTERNAL default 1 if STM32_CLOCK_REF_INTERNAL
default 8000000 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 config STM32F0_TRIM
int "Internal clock trim override" if LOW_LEVEL_OPTIONS && MACH_STM32F0 && STM32_CLOCK_REF_INTERNAL && !USBSERIAL int "Internal clock trim override" if LOW_LEVEL_OPTIONS && MACH_STM32F0 && STM32_CLOCK_REF_INTERNAL && !USBSERIAL
default 16 default 16
@ -220,39 +207,69 @@ config STM32F0_TRIM
Default is 16 (use factory default). Each increment increases Default is 16 (use factory default). Each increment increases
the clock rate by ~240KHz. 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 # Communication inteface
default y if (USBSERIAL || CANSERIAL) ######################################################################
default n
help config USBSERIAL
Remaps logical pins PA11/PA12 to physical PA9/PA10 on low pincount F042 devices. bool
config SERIAL config SERIAL
depends on !USBSERIAL && !CANSERIAL bool
config CANSERIAL
bool bool
default y
choice choice
depends on SERIAL prompt "Communication interface"
prompt "Serial Port" if LOW_LEVEL_OPTIONS config STM32_USB_PA11_PA12
help bool "USB (on PA11/PA12)" if HAVE_STM32_USBFS || HAVE_STM32_USBOTG
Select the serial device to use. 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 config STM32_SERIAL_USART1
bool "USART1" bool "Serial (on USART1 PA10/PA9)"
select SERIAL
config STM32_SERIAL_USART1_ALT 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 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 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 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 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 endchoice
config SERIAL_PORT
int config CANBUS_FREQUENCY
default 3 if STM32_SERIAL_USART3 || STM32_SERIAL_USART3_ALT int "CAN bus speed" if LOW_LEVEL_OPTIONS && CANSERIAL
default 2 if STM32_SERIAL_USART2 || STM32_SERIAL_USART2_ALT default 500000
default 1
endif endif

View File

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

View File

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

View File

@ -224,7 +224,8 @@ armcm_main(void)
// Support pin remapping USB/CAN pins on low pinout stm32f042 // Support pin remapping USB/CAN pins on low pinout stm32f042
#ifdef SYSCFG_CFGR1_PA11_PA12_RMP #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); enable_pclock(SYSCFG_BASE);
SYSCFG->CFGR1 |= SYSCFG_CFGR1_PA11_PA12_RMP; SYSCFG->CFGR1 |= SYSCFG_CFGR1_PA11_PA12_RMP;
} }

View File

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

View File

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

View File

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