diff options
author | Eug Krashtan <eug.krashtan@gmail.com> | 2019-12-28 13:01:58 +0200 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2020-01-14 17:05:28 -0500 |
commit | 5238c3f872929f2b1bdfe933590456bb52566fe0 (patch) | |
tree | 0eb7e49bc7af056dfbcc7d6451c1073ae0d122b8 /src | |
parent | dd77a2ec1679f2c649a0a8255a094ca06aa80e0a (diff) | |
download | kutter-5238c3f872929f2b1bdfe933590456bb52566fe0.tar.gz kutter-5238c3f872929f2b1bdfe933590456bb52566fe0.tar.xz kutter-5238c3f872929f2b1bdfe933590456bb52566fe0.zip |
stm32: HSI selection fix; Pin swap rename; Add CAN selection
Signed-off-by: Eug Krashtan <eug.krashtan@gmail.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src')
-rw-r--r-- | src/stm32/Kconfig | 12 | ||||
-rw-r--r-- | src/stm32/stm32f0.c | 6 |
2 files changed, 11 insertions, 7 deletions
diff --git a/src/stm32/Kconfig b/src/stm32/Kconfig index 1e79811c..6bfc15e2 100644 --- a/src/stm32/Kconfig +++ b/src/stm32/Kconfig @@ -131,12 +131,16 @@ config USBSERIAL bool "Use USB for communication (instead of serial)" depends on HAVE_STM32_USBFS || HAVE_STM32_USBOTG default y -config STM32F042_USB_PIN_SWAP - bool "Use PA9/PA10 for USB" if MACH_STM32F042 - depends on USBSERIAL && MACH_STM32F042 +config CANSERIAL + bool "Use CAN for communication (instead of serial)" + depends on MACH_STM32F042 && !USBSERIAL + default n +config STM32F042_PIN_SWAP + bool "Use PA9/PA10 for USB or CAN" if MACH_STM32F042 + depends on (USBSERIAL || CANSERIAL) && MACH_STM32F042 default n config SERIAL - depends on !USBSERIAL + depends on !USBSERIAL && !CANSERIAL bool default y choice diff --git a/src/stm32/stm32f0.c b/src/stm32/stm32f0.c index 6f9d994f..437747d8 100644 --- a/src/stm32/stm32f0.c +++ b/src/stm32/stm32f0.c @@ -192,7 +192,7 @@ armcm_main(void) FLASH->ACR = (1 << FLASH_ACR_LATENCY_Pos) | FLASH_ACR_PRFTBE; // Configure main clock - if (CONFIG_MACH_STM32F042 && CONFIG_STM32_CLOCK_REF_INTERNAL) + if (CONFIG_MACH_STM32F042 || CONFIG_STM32_CLOCK_REF_INTERNAL) hsi48_setup(); else pll_setup(); @@ -200,9 +200,9 @@ armcm_main(void) // Turn on hsi14 oscillator for ADC hsi14_setup(); - // Support alternate USB pins on stm32f042 + // Support alternate USB/CAN pins on stm32f042 #ifdef SYSCFG_CFGR1_PA11_PA12_RMP - if (CONFIG_STM32F042_USB_PIN_SWAP) { + if (CONFIG_STM32F042_PIN_SWAP) { enable_pclock(SYSCFG_BASE); SYSCFG->CFGR1 |= SYSCFG_CFGR1_PA11_PA12_RMP; } |