diff --git a/boards/weact/blackpill_f411ce/blackpill_f411ce_defconfig b/boards/weact/blackpill_f411ce/blackpill_f411ce_defconfig index eea1cfeeb308..5f3106fe49b1 100644 --- a/boards/weact/blackpill_f411ce/blackpill_f411ce_defconfig +++ b/boards/weact/blackpill_f411ce/blackpill_f411ce_defconfig @@ -1,3 +1,4 @@ +# Copyright (c) 2025 Filip Stojanovic # SPDX-License-Identifier: Apache-2.0 # Enable MPU diff --git a/boards/weact/blackpill_h523ce/Kconfig.blackpill_h523ce b/boards/weact/blackpill_h523ce/Kconfig.blackpill_h523ce new file mode 100644 index 000000000000..441ecfc86cf2 --- /dev/null +++ b/boards/weact/blackpill_h523ce/Kconfig.blackpill_h523ce @@ -0,0 +1,5 @@ +# Copyright (c) 2025 Filip Stojanovic +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_BLACKPILL_H523CE + select SOC_STM32H533XX \ No newline at end of file diff --git a/boards/weact/blackpill_h523ce/blackpill_h523ce.defconfig b/boards/weact/blackpill_h523ce/blackpill_h523ce.defconfig new file mode 100644 index 000000000000..de3f594366db --- /dev/null +++ b/boards/weact/blackpill_h523ce/blackpill_h523ce.defconfig @@ -0,0 +1,16 @@ +# Copyright (c) 2025 Filip Stojanovic +# SPDX-License-Identifier: Apache-2.0 + +# Enable MPU +CONFIG_ARM_MPU=y + +# Enable HW stack protection +CONFIG_HW_STACK_PROTECTION=y + +# Serial drivers +CONFIG_SERIAL=y +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y + +# Enable GPIO +CONFIG_GPIO=y diff --git a/boards/weact/blackpill_h523ce/blackpill_h523ce.dts b/boards/weact/blackpill_h523ce/blackpill_h523ce.dts new file mode 100644 index 000000000000..5dd53823f919 --- /dev/null +++ b/boards/weact/blackpill_h523ce/blackpill_h523ce.dts @@ -0,0 +1,156 @@ +/* + * Copyright (c) 2025 Filip Stojanovic + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; +#include +#include +#include + +/ { + model = "WeAct Studio Black Pill STM32H523 Board"; + compatible = "weact,blackpill-h523ce"; + + chosen { + zephyr,console = &usart1; + zephyr,shell-uart = &usart1; + zephyr,sram = &sram1; + zephyr,flash = &flash0; + }; + + leds { + compatible = "gpio-leds"; + user_led: led { + gpios = <&gpioc 13 GPIO_ACTIVE_LOW>; + label = "User LED"; + }; + }; + + gpio_keys { + compatible = "gpio-keys"; + user_button: button { + label = "KEY"; + gpios = <&gpioa 0 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; + zephyr,code = ; + }; + }; + + aliases { + led0 = &user_led; + sw0 = &user_button; + volt-sensor0 = &vref; + volt-sensor1 = &vbat; + }; +}; + +&timers3 { + status = "okay"; + st,prescaler = <1000>; + + pwm3: pwm { + status = "okay"; + pinctrl-0 = <&tim3_ch3_pb0 &tim3_ch4_pb1>; + pinctrl-names = "default"; + }; +}; + +&usart1 { + pinctrl-0 = <&usart1_tx_pa9 &usart1_rx_pa10>; + pinctrl-names = "default"; + status = "okay"; + current-speed = <115200>; +}; + +&i2c1 { + pinctrl-0 = <&i2c1_scl_pb6 &i2c1_sda_pb7>; + pinctrl-names = "default"; + status = "okay"; + clock-frequency = ; +}; + +&spi1 { + pinctrl-0 = <&spi1_sck_pa5 &spi1_nss_pa4 + &spi1_miso_pa6 &spi1_mosi_pa7>; + pinctrl-names = "default"; + status = "okay"; +}; + +&rtc { + clocks = <&rcc STM32_CLOCK_BUS_APB3 0x00200000>, + <&rcc STM32_SRC_LSE RTC_SEL(1)>; + status = "okay"; +}; + +zephyr_udc0: &usb { + pinctrl-0 = <&usb_dm_pa11 &usb_dp_pa12>; + pinctrl-names = "default"; + status = "okay"; +}; + +&adc1 { + clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000400>, + <&rcc STM32_SRC_HCLK ADCDAC_SEL(0)>; + pinctrl-0 = <&adc1_inp1_pa1>; + pinctrl-names = "default"; + st,adc-clock-source = "ASYNC"; + st,adc-prescaler = <8>; + status = "okay"; +}; + +&clk_lsi { + status = "okay"; +}; + +&clk_lse { + status = "okay"; +}; + +&clk_hsi { + status = "okay"; +}; + +&clk_hsi48 { + status = "okay"; +}; + +&clk_hse { + status = "okay"; + clock-frequency = ; +}; + +&rcc { + clocks = <&pll>; + clock-frequency = ; + ahb-prescaler = <1>; + apb1-prescaler = <1>; + apb2-prescaler = <1>; + apb3-prescaler = <1>; +}; + +&pll { + div-m = <1>; + mul-n = <60>; + div-p = <2>; + div-q = <2>; + div-r = <2>; + clocks = <&clk_hse>; + status = "okay"; +}; + +&vref { + status = "okay"; +}; + +&vbat { + status = "okay"; +}; + +&iwdg { + status = "okay"; +}; + +&rng { + status = "okay"; +}; diff --git a/boards/weact/blackpill_h523ce/blackpill_h523ce.yaml b/boards/weact/blackpill_h523ce/blackpill_h523ce.yaml new file mode 100644 index 000000000000..1d62e472f380 --- /dev/null +++ b/boards/weact/blackpill_h523ce/blackpill_h523ce.yaml @@ -0,0 +1,18 @@ +identifier: blackpill_h523ce +name: WeAct Studio Black Pill STM32H523 +type: mcu +arch: arm +toolchain: + - zephyr + - gnuarmemb +ram: 274 +flash: 512 +supported: + - gpio + - counter + - spi + - i2c + - uart + - pwm + - adc +vendor: weact \ No newline at end of file diff --git a/boards/weact/blackpill_h523ce/board.cmake b/boards/weact/blackpill_h523ce/board.cmake new file mode 100644 index 000000000000..8a304034eac9 --- /dev/null +++ b/boards/weact/blackpill_h523ce/board.cmake @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: Apache-2.0 + +board_runner_args(dfu-util "--pid=0483:df11" "--alt=0" "--dfuse") +board_runner_args(jlink "--device=STM32H523CE" "--speed=4000") + +include(${ZEPHYR_BASE}/boards/common/dfu-util.board.cmake) +include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake) +include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) +include(${ZEPHYR_BASE}/boards/common/blackmagicprobe.board.cmake) \ No newline at end of file diff --git a/boards/weact/blackpill_h523ce/board.yml b/boards/weact/blackpill_h523ce/board.yml new file mode 100644 index 000000000000..c3fcbc93f751 --- /dev/null +++ b/boards/weact/blackpill_h523ce/board.yml @@ -0,0 +1,6 @@ +board: + name: blackpill_h523ce + full_name: Black Pill STM32H523 + vendor: weact + socs: + - name: stm32h533xx diff --git a/boards/weact/blackpill_h523ce/doc/img/blackpill_h523ce.png b/boards/weact/blackpill_h523ce/doc/img/blackpill_h523ce.png new file mode 100644 index 000000000000..127b2e1a3f30 Binary files /dev/null and b/boards/weact/blackpill_h523ce/doc/img/blackpill_h523ce.png differ diff --git a/boards/weact/blackpill_h523ce/doc/index.rst b/boards/weact/blackpill_h523ce/doc/index.rst new file mode 100644 index 000000000000..106f9b633374 --- /dev/null +++ b/boards/weact/blackpill_h523ce/doc/index.rst @@ -0,0 +1,106 @@ +.. zephyr:board:: blackpill_h523ce + +Overview +******** +The WeAct STM32H523CE Core Board is a low cost and bare-bone development +board made in famous "blackpill" package. It features STM32H523CE, high +performance microcontroller based on a Arm Cortex M33 processor. + +Hardware +******** + +The STM32H523CE based Black Pill board provides the following harware +components: + +- STM32H523CE in 48 pin package +- ARM 32-bit Cortex -M33 CPU with FPU +- 250 MHz max CPU frequency +- VDD from 1.7 V to 3.6 V +- 512 kB Flash +- 274 kB SRAM +- TIM +- ADC +- USART +- I2C +- SPI +- USBFS +- FDCAN +- RTC + +Supported Features +================== + +.. zephyr:board-supported-hw:: + +Connections and IOs +=================== + +Default Zephyr Peripheral Mapping: +---------------------------------- + +- UART_1 TX/RX : PA9/PA10 +- I2C1 SCL/SDA : PB6/PB7 +- SPI1 CS/SCK/MISO/MOSI : PA4/PA5/PA6/PA7 (Routed to footprint for external flash) +- PWM_3_CH3 : PB0 +- PWM_3_CH4 : PB1 +- ADC_1 : PA1 +- USER_PB : PA0 +- USER_LED : PC13 + +Programming and Debugging +************************* + +.. zephyr:board-supported-runners:: + +There are 2 main entry points for flashing STM32H5X SoCs, one using the ROM +bootloader, and another by using the SWD debug port (which requires additional +hardware). Flashing using the ROM bootloader requires a special activation +pattern, which can be triggered by using the BOOT0 pin. + +Flashing +======== + +Installing dfu-util +------------------- + +It is recommended to use at least v0.8 of `dfu-util`_. The package available in +debian/ubuntu can be quite old, so you might have to build dfu-util from source. + +There is also a Windows version which works, but you may have to install the +right USB drivers with a tool like `Zadig`_. + +Flashing an Application +----------------------- + +Connect a USB-C cable and the board should power ON. Force the board into DFU mode +by keeping the BOOT0 switch pressed while pressing and releasing the NRST switch. + +The dfu-util runner is supported on this board and so a sample can be built and +tested easily. + +.. zephyr-app-commands:: + :zephyr-app: samples/basic/blinky + :board: blackpill_f523ce + :goals: build flash + + +Debugging +========= + +The board can be debugged by installing the included 100 mil (0.1 inch) header, +and attaching an SWD debugger to the 3V3 (3.3V), GND, SCK, and DIO +pins on that header. + +References +********** + +.. target-notes:: + +.. _WeAct Github: +https://github.com/WeActStudio/WeActStudio.STM32H523CoreBoard/tree/master + +.. _STM32F523CE website: +https://www.st.com/en/microcontrollers-microprocessors/stm32h523ce.html + +.. _STM32F523CE reference manual: +https://www.st.com/en/microcontrollers-microprocessors/stm32h523ce.html#