diff --git a/boards/arm/nucleo_f303k8/Kconfig.board b/boards/arm/nucleo_f303k8/Kconfig.board new file mode 100644 index 00000000000..88b26aab9a3 --- /dev/null +++ b/boards/arm/nucleo_f303k8/Kconfig.board @@ -0,0 +1,9 @@ +# NUCLEO-32 F303k8 board configuration + +# Copyright (c) 2020 Sebastian Schwabe +# Fabian Paschke +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_NUCLEO_F303K8 + bool "NUCLEO-32 F303K8 Development Board" + depends on SOC_STM32F303X8 diff --git a/boards/arm/nucleo_f303k8/Kconfig.defconfig b/boards/arm/nucleo_f303k8/Kconfig.defconfig new file mode 100644 index 00000000000..c52e0887f31 --- /dev/null +++ b/boards/arm/nucleo_f303k8/Kconfig.defconfig @@ -0,0 +1,12 @@ +# NUCLEO-32 F303k8 board configuration + +# Copyright (c) 2020 Sebastian Schwabe +# Fabian Paschke +# SPDX-License-Identifier: Apache-2.0 + +if BOARD_NUCLEO_F303K8 + +config BOARD + default "nucleo_f303k8" + +endif # BOARD_NUCLEO_F303K8 diff --git a/boards/arm/nucleo_f303k8/board.cmake b/boards/arm/nucleo_f303k8/board.cmake new file mode 100644 index 00000000000..f061108044a --- /dev/null +++ b/boards/arm/nucleo_f303k8/board.cmake @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: Apache-2.0 + +board_runner_args(jlink "--device=STM32F303K8" "--speed=4000") + +include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake) +include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) diff --git a/boards/arm/nucleo_f303k8/doc/img/nucleo_f303k8.jpg b/boards/arm/nucleo_f303k8/doc/img/nucleo_f303k8.jpg new file mode 100644 index 00000000000..94626b4ad6f Binary files /dev/null and b/boards/arm/nucleo_f303k8/doc/img/nucleo_f303k8.jpg differ diff --git a/boards/arm/nucleo_f303k8/doc/img/nucleo_f303k8_pinout.png b/boards/arm/nucleo_f303k8/doc/img/nucleo_f303k8_pinout.png new file mode 100644 index 00000000000..8cb167a146e Binary files /dev/null and b/boards/arm/nucleo_f303k8/doc/img/nucleo_f303k8_pinout.png differ diff --git a/boards/arm/nucleo_f303k8/doc/index.rst b/boards/arm/nucleo_f303k8/doc/index.rst new file mode 100644 index 00000000000..2f17685d7db --- /dev/null +++ b/boards/arm/nucleo_f303k8/doc/index.rst @@ -0,0 +1,163 @@ +.. _nucleo_f303k8_board: + +ST Nucleo F303K8 +################ + +Overview +******** + +The Nucleo F303K8 board features an ARM Cortex-M4 based STM32F303K8 +mixed-signal MCU with FPU and DSP instructions capable of running at 72 MHz. +Here are some highlights of the Nucleo F303K8 board: + +- STM32 microcontroller in LQFP32 package +- one type of extension resources: + +- Arduinoâ„¢ Nano V3 connectivity support + +- On-board ST-LINK/V2-1 debugger/programmer with SWD connector +- Flexible board power supply: + +- 5 V from ST-LINK/V2-1 USB VBUS +- External power sources: 3.3 V, 5V and 7 - 12 V + +- One user LED +- One push-buttons: RESET + +.. image:: img/nucleo_f303k8.jpg + :width: 500px + :height: 367px + :align: center + :alt: Nucleo F303K8 + +More information about the board can be found at the `Nucleo F303K8 website`_, +and in the `STM32 Nucleo-32 board User Manual`_. + +Hardware +******** + +The Nucleo F303K8 provides the following hardware components: + +- STM32F303K8T6 in LQFP32 package +- ARM |reg| 32-bit Cortex |reg| -M4 CPU with FPU +- 72 MHz max CPU frequency +- VDD from 2.0 V to 3.6 V +- 64 MB Flash +- 12 KB SRAM +- RTC +- Advanced-control Timer +- General Purpose Timers (5) +- Basic Timer (2) +- Watchdog Timers (2) +- PWM channels (12) +- SPI/I2S (1) +- I2C (1) +- USART/UART (2) +- CAN (1) +- GPIO with external interrupt capability +- DMA channels (7) +- Capacitive sensing channels (18) +- 12-bit ADC with 21 channels +- 12-bit D/A converter +- Analog comparator (3) +- Op amp + + +More information about the STM32F303K8 can be found here: + +- `STM32F303K8 on www.st.com`_ +- `STM32F303K8 reference manual`_ +- `STM32F303K8 datasheet`_ + +Supported Features +================== + +The Zephyr nucleo_f303k8 board configuration supports the following hardware +features: + ++-----------+------------+-------------------------------------+ +| Interface | Controller | Driver/Component | ++===========+============+=====================================+ +| NVIC | on-chip | nested vector interrupt controller | ++-----------+------------+-------------------------------------+ +| UART | on-chip | serial port-polling; | +| | | serial port-interrupt | ++-----------+------------+-------------------------------------+ +| PINMUX | on-chip | pinmux | ++-----------+------------+-------------------------------------+ +| GPIO | on-chip | gpio | ++-----------+------------+-------------------------------------+ +| PWM | on-chip | pwm | ++-----------+------------+-------------------------------------+ +| I2C | on-chip | i2c | ++-----------+------------+-------------------------------------+ +| SPI | on-chip | spi | ++-----------+------------+-------------------------------------+ +| ADC | on-chip | ADC Controller | ++-----------+------------+-------------------------------------+ + +Other hardware features are not yet supported on this Zephyr port. + +The default configuration can be found in the defconfig file: +``boards/arm/nucleo_f303k8/nucleo_f303k8_defconfig`` + +Connections and IOs +=================== + +The Nucleo F303K8 Board has 1 GPIO controller. This controllers is responsible +for input/output, pull-up, etc. + +Board connectors: +----------------- +.. image:: img/nucleo_f303k8_pinout.png + :width: 800px + :align: center + :height: 619px + :alt: Nucleo F303K8 connectors + +Default Zephyr Peripheral Mapping: +---------------------------------- + +The Nucleo F303K8 board features an Arduino Zero V3 connector. Board is configured as follows: + +- UART_2 TX/RX : PA2/PA15 (ST-Link Virtual Port Com) +- I2C1 SCL/SDA : PB7/PB6 +- SPI1 CS/SCK/MISO/MOSI : PA_4/PA_5/PB_4/PA_7 +- LD2 : PB3 + +System Clock +------------ + +The Nucleo F303K8 System Clock can be driven by an internal or +external oscillator, as well as by the main PLL clock. By default the +System Clock is driven by the PLL clock at 72 MHz. The input to the +PLL is an 8 MHz internal clock supply. + +Serial Port +----------- + +The Nucleo F303K8 board has 2 UARTs. The Zephyr console output is assigned +to UART2. Default settings are 115200 8N1. + + +Programming and Debugging +************************* + +The Nucleo F303K8 board includes an ST-LINK/V2-1 embedded debug tool interface. +This interface is supported by the openocd version included in Zephyr SDK. + + +.. _Nucleo F303K8 website: + http://www.st.com/en/evaluation-tools/nucleo-F303K8.html + +.. _STM32 Nucleo-32 board User Manual: + https://www.st.com/resource/en/user_manual/dm00231744-stm32-nucleo32-boards-mb1180-stmicroelectronics.pdf + +.. _STM32F303K8 on www.st.com: + http://www.st.com/en/microcontrollers/stm32F303K8.html + +.. _STM32F303K8 reference manual: + https://www.st.com/resource/en/reference_manual/dm00043574-stm32f303xbcde-stm32f303x68-stm32f328x8-stm32f358xc-stm32f398xe-advanced-armbased-mcus-stmicroelectronics.pdf + +.. _STM32F303K8 datasheet: + https://www.st.com/resource/en/datasheet/stm32f303k8.pdf diff --git a/boards/arm/nucleo_f303k8/nucleo_f303k8.dts b/boards/arm/nucleo_f303k8/nucleo_f303k8.dts new file mode 100644 index 00000000000..88e94124272 --- /dev/null +++ b/boards/arm/nucleo_f303k8/nucleo_f303k8.dts @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2020 Sebastian Schwabe + * Fabian Paschke + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; +#include +#include + +/ { + model = "STMicroelectronics STM32F303K8-NUCLEO board"; + compatible = "st,stm32f303k8-nucleo"; + + chosen { + zephyr,console = &usart2; + zephyr,shell-uart = &usart2; + zephyr,sram = &sram0; + zephyr,flash = &flash0; + }; + + leds { + compatible = "gpio-leds"; + green_led_3: green_led_3 { + gpios = <&gpiob 3 GPIO_ACTIVE_HIGH>; + label = "LD3"; + }; + }; + pwmleds { + compatible = "pwm-leds"; + green_pwm_led: green_pwm_led { + pwms = <&pwm2 2 0 PWM_POLARITY_NORMAL>; + }; + }; + + aliases { + led0 = &green_led_3; + pwm-led0 = &green_pwm_led; + }; +}; + +&timers2 { + status = "okay"; + + pwm2: pwm { + status = "okay"; + pinctrl-0 = <&tim2_ch2_pb3>; + }; +}; + +&usart2 { + pinctrl-0 = <&usart2_tx_pa2 &usart2_rx_pa15>; + current-speed = <115200>; + status = "okay"; +}; + + +&i2c1 { + pinctrl-0 = <&i2c1_scl_pb6 &i2c1_sda_pb7>; + status = "okay"; + clock-frequency = ; +}; + +&spi1 { + pinctrl-0 = <&spi1_nss_pa4 &spi1_sck_pa5 + &spi1_miso_pa6 &spi1_mosi_pa7>; + status = "okay"; +}; + +&adc1 { + pinctrl-0 = <&adc1_in1_pa0>; + status = "okay"; +}; + +&rtc { + status = "okay"; +}; diff --git a/boards/arm/nucleo_f303k8/nucleo_f303k8.yaml b/boards/arm/nucleo_f303k8/nucleo_f303k8.yaml new file mode 100644 index 00000000000..41da953bb6c --- /dev/null +++ b/boards/arm/nucleo_f303k8/nucleo_f303k8.yaml @@ -0,0 +1,16 @@ +identifier: nucleo_f303k8 +name: ST Nucleo F303k8 +type: mcu +arch: arm +toolchain: + - zephyr + - gnuarmemb + - xtools +ram: 12 +flash: 64 +supported: + - i2c + - spi + - gpio + - pwm + - counter diff --git a/boards/arm/nucleo_f303k8/nucleo_f303k8_defconfig b/boards/arm/nucleo_f303k8/nucleo_f303k8_defconfig new file mode 100644 index 00000000000..5cc8f5df0e6 --- /dev/null +++ b/boards/arm/nucleo_f303k8/nucleo_f303k8_defconfig @@ -0,0 +1,34 @@ +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_SOC_SERIES_STM32F3X=y +CONFIG_SOC_STM32F303X8=y +# 72 MHz system clock +CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=72000000 + +CONFIG_SERIAL=y + +# console +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y + +# enable pinmux +CONFIG_PINMUX=y + +# enable GPIO +CONFIG_GPIO=y + +# clock configuration +CONFIG_CLOCK_CONTROL=y + +# Clock configuration for Cube Clock control driver +CONFIG_CLOCK_STM32_SYSCLK_SRC_PLL=y +# use HSI as PLL input +CONFIG_CLOCK_STM32_PLL_SRC_HSI=y +# however, the board does not have an external oscillator, so just use +# the 8MHz clock signal coming from integrated STLink +# produce 72MHz clock at PLL output +CONFIG_CLOCK_STM32_PLL_PREDIV=1 +CONFIG_CLOCK_STM32_PLL_MULTIPLIER=9 +CONFIG_CLOCK_STM32_AHB_PRESCALER=1 +CONFIG_CLOCK_STM32_APB1_PRESCALER=2 +CONFIG_CLOCK_STM32_APB2_PRESCALER=1 diff --git a/boards/arm/nucleo_f303k8/support/openocd.cfg b/boards/arm/nucleo_f303k8/support/openocd.cfg new file mode 100644 index 00000000000..8aec0b4f1f4 --- /dev/null +++ b/boards/arm/nucleo_f303k8/support/openocd.cfg @@ -0,0 +1,12 @@ +source [find board/st_nucleo_f3.cfg] + +$_TARGETNAME configure -event gdb-attach { + echo "Debugger attaching: halting execution" + reset halt + gdb_breakpoint_override hard +} + +$_TARGETNAME configure -event gdb-detach { + echo "Debugger detaching: resuming execution" + resume +}