diff --git a/boards/fanke/fk723m1_zgt6/Kconfig.fk723m1_zgt6 b/boards/fanke/fk723m1_zgt6/Kconfig.fk723m1_zgt6 new file mode 100644 index 0000000000000..3f76aecc92d02 --- /dev/null +++ b/boards/fanke/fk723m1_zgt6/Kconfig.fk723m1_zgt6 @@ -0,0 +1,12 @@ +# Copyright (c) 2025 Paul Wedeck +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_FK723M1_ZGT6 + select SOC_STM32H723XX + +if BOARD_FK723M1_ZGT6 + +config SDMMC_STM32_CLOCK_CHECK + default n + +endif # BOARD_FK723M1_ZGT6 diff --git a/boards/fanke/fk723m1_zgt6/board.cmake b/boards/fanke/fk723m1_zgt6/board.cmake new file mode 100644 index 0000000000000..3a15a136bbaba --- /dev/null +++ b/boards/fanke/fk723m1_zgt6/board.cmake @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: Apache-2.0 + +# keep first +board_runner_args(stm32cubeprogrammer "--port=swd" "--reset-mode=sw") +board_runner_args(jlink "--device=STM32H723ZG" "--speed=4000") + +# keep first +include(${ZEPHYR_BASE}/boards/common/stm32cubeprogrammer.board.cmake) +include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake) +include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) diff --git a/boards/fanke/fk723m1_zgt6/board.yml b/boards/fanke/fk723m1_zgt6/board.yml new file mode 100644 index 0000000000000..f3c98b0117342 --- /dev/null +++ b/boards/fanke/fk723m1_zgt6/board.yml @@ -0,0 +1,6 @@ +board: + name: fk723m1_zgt6 + full_name: FK723M1-ZGT6 + vendor: fanke + socs: + - name: stm32h723xx diff --git a/boards/fanke/fk723m1_zgt6/doc/img/fk723m1_zgt6.webp b/boards/fanke/fk723m1_zgt6/doc/img/fk723m1_zgt6.webp new file mode 100644 index 0000000000000..efbd91cc022b7 Binary files /dev/null and b/boards/fanke/fk723m1_zgt6/doc/img/fk723m1_zgt6.webp differ diff --git a/boards/fanke/fk723m1_zgt6/doc/index.rst b/boards/fanke/fk723m1_zgt6/doc/index.rst new file mode 100644 index 0000000000000..10c76dc797199 --- /dev/null +++ b/boards/fanke/fk723m1_zgt6/doc/index.rst @@ -0,0 +1,173 @@ +.. zephyr:board:: fk723m1_zgt6 + +Overview +******** + +The FK723M1-ZGT6 board is a development board for the STM32H723ZGT6 SoC. + +Key Features + +- STM32 microcontroller in LQFP144 package +- USB OTG or full-speed device +- 1 user LEDs +- 1 boot and reset push-buttons +- 15 MHz and 32.768 kHz crystal oscillators + +Board connectors: +- USB with USB-C +- FPC10P LCD connector +- FPC20P Camera connector +- 8 pin debug connector + +More information about the board can be found at the `FK723M1-ZGT6 Schematic`_. + +Hardware +******** + +FK723M1-ZGT6 provides the following hardware components: + +- STM32H723ZG in LQFP144 package +- ARM 32-bit Cortex-M7 CPU with FPU +- Chrom-ART Accelerator +- Hardware JPEG Codec +- 550 MHz max CPU frequency +- VDD from 1.62 V to 3.6 V +- 1 MB Flash +- 562 kB SRAM max (376 kb used currently) +- High-resolution timer (2.1 ns) +- 32-bit timers(2) +- 16-bit timers(12) +- SPI(6) +- I2C(4) +- I2S (3) +- USART(4) +- UART(4) +- USB OTG Full Speed(1) +- CAN FD(2) +- SAI(2) +- SPDIF_Rx(4) +- HDMI_CEC(1) +- Dual Mode Quad SPI(1) +- Camera Interface +- GPIO (up to 114) with external interrupt capability +- 16-bit ADC(3) with 36 channels / 3.6 MSPS +- 12-bit DAC with 2 channels(2) +- True Random Number Generator (RNG) +- 16-channel DMA +- LCD-TFT Controller with XGA resolution + +Supported Features +================== + +.. zephyr:board-supported-hw:: + +Default Zephyr Peripheral Mapping: +---------------------------------- + +The FK723M1-ZGT6 board features one USB port, two 30x2 pin headers, one 4x2 debug header, +one micro SD slot, one FPC10P LCD interface, one FPC20P Camera interface and one built-in external Quad SPI flash. +The board is configured as follows: + +- UART_1 TX/RX : PA9/PA10 (debug header UART) +- LD1 : PG7 + +System Clock +------------ + +FK723M1-ZGT6 System Clock could be driven by an internal or external +oscillator, as well as the main PLL clock. By default, the System clock is +driven by the PLL clock at 550MHz, driven by an 15MHz high-speed external clock. + +Serial Port +----------- + +FK723M1-ZGT6 board has 4 UARTs and 4 USARTs. The Zephyr console output is +assigned to UART1. Default settings are 115200 8N1. + +Programming and Debugging +************************* + +FK723M1-ZGT6 provides a special SWD header. + +Flashing +======== + +The board is configured to be flashed using west `STM32CubeProgrammer`_ runner, +so its :ref:`installation ` is required. + +Alternatively, OpenOCD or JLink can also be used to flash the board using +the ``--runner`` (or ``-r``) option: + +.. code-block:: console + + $ west flash --runner openocd + $ west flash --runner jlink + +Flashing an application to FK723M1-ZGT6 +---------------------------------------- + +First, connect a SWD capable debugger to the debug header on FK723M1-ZGT6. +Then connect the debugger to the host computer to prepare the board for flashing. +Finally, build and flash your application. + +Here is an example for the :zephyr:code-sample:`blinky` application. + +Optional: Connect a USB-to-serial adapter to RX and TX (cross connect!). + +.. code-block:: console + + $ minicom -b 115200 -D /dev/ttyACM0 + +or use screen: + +.. code-block:: console + + $ screen /dev/ttyACM0 115200 + +Build and flash the application: + +.. zephyr-app-commands:: + :zephyr-app: samples/basic/blinky + :board: fk723m1_zgt6 + :goals: build flash + +You should see the following messages on the console repeatedly: + +.. code-block:: console + + $ LED state: ON + $ LED state: OFF + +Hello World example can also be used: + +.. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: fk723m1_zgt6 + :goals: build flash + +Debugging +========= + +You can debug an application in the usual way. Here is an example for the +:zephyr:code-sample:`hello_world` application. + +.. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: fk723m1_zgt6 + :maybe-skip-config: + :goals: debug + +.. _FK723M1-ZGT6 Schematic: + https://community.st.com/ysqtg83639/attachments/ysqtg83639/mcu-boards-hardware-tools-forum/20009/1/FK723M1-ZGT6.zh-CN.en.pdf + +.. _STM32H723ZG on www.st.com: + https://www.st.com/en/microcontrollers-microprocessors/stm32h723zg.html + +.. _STM32H723 reference manual: + https://www.st.com/resource/en/reference_manual/dm00603761-stm32h723733-stm32h725735-and-stm32h730-value-line-advanced-armbased-32bit-mcus-stmicroelectronics.pdf + +.. _STM32CubeIDE: + https://www.st.com/en/development-tools/stm32cubeide.html + +.. _STM32CubeProgrammer: + https://www.st.com/en/development-tools/stm32cubeprog.html diff --git a/boards/fanke/fk723m1_zgt6/fk723m1_zgt6.dts b/boards/fanke/fk723m1_zgt6/fk723m1_zgt6.dts new file mode 100644 index 0000000000000..603f80fdd0065 --- /dev/null +++ b/boards/fanke/fk723m1_zgt6/fk723m1_zgt6.dts @@ -0,0 +1,158 @@ +/* + * Copyright (c) 2020 Alexander Kozhinov + * Copyright (c) 2024 zack jiang <1125934312@qq.com> + * Copyright (c) 2025 Paul Wedeck + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; +#include +#include + +/ { + model = "FK723M1-ZGT6 board"; + compatible = "fanke,fk723m1-zgt6"; + + chosen { + zephyr,console = &usart1; + zephyr,shell-uart = &usart1; + zephyr,dtcm = &dtcm; + zephyr,sram = &sram0; + zephyr,flash = &flash0; + zephyr,canbus = &fdcan1; + }; + + leds: leds { + compatible = "gpio-leds"; + + blue_led: led_0 { + gpios = <&gpiog 7 GPIO_ACTIVE_LOW>; + label = "User LED"; + }; + }; + + aliases { + led0 = &blue_led; + sdhc0 = &sdmmc1; + }; +}; + +&clk_lsi { + status = "okay"; +}; + +&clk_hsi { + status = "okay"; +}; + +&clk_hsi48 { + status = "okay"; +}; + +&clk_hse { + clock-frequency = ; + status = "okay"; +}; + +&clk_lse { + status = "okay"; +}; + +&pll { + div-m = <2>; + mul-n = <44>; + div-p = <1>; + div-q = <22>; + div-r = <2>; + clocks = <&clk_hse>; + status = "okay"; +}; + +&pll2 { + div-m = <2>; + mul-n = <32>; + div-p = <5>; + div-q = <5>; + div-r = <5>; + clocks = <&clk_hse>; + status = "okay"; +}; + +&rcc { + clocks = <&pll>; + clock-frequency = ; + d1cpre = <1>; + hpre = <2>; /* HCLK: 275 MHz */ + d1ppre = <2>; /* APB1: 137.5 MHz */ + d2ppre1 = <2>; /* APB2: 137.5 MHz */ + d2ppre2 = <2>; /* APB3: 137.5 MHz */ + d3ppre = <2>; /* APB4: 137.5 MHz */ +}; + +&usart1 { + pinctrl-0 = <&usart1_tx_pa9 &usart1_rx_pa10>; + pinctrl-names = "default"; + current-speed = <115200>; + status = "okay"; +}; + +&rtc { + clocks = <&rcc STM32_CLOCK_BUS_APB4 0x00010000>, + <&rcc STM32_SRC_LSI RTC_SEL(2)>; + status = "okay"; +}; + +&backup_sram { + status = "okay"; +}; + +zephyr_udc0: &usbotg_hs { + pinctrl-0 = <&usb_otg_hs_dm_pa11 &usb_otg_hs_dp_pa12>; + pinctrl-names = "default"; + status = "okay"; +}; + +&rng { + status = "okay"; +}; + +&sdmmc1 { + pinctrl-0 = <&sdmmc1_d0_pc8 &sdmmc1_d1_pc9 &sdmmc1_d2_pc10 + &sdmmc1_d3_pc11 &sdmmc1_ck_pc12 &sdmmc1_cmd_pd2>; + pinctrl-names = "default"; + clocks = <&rcc STM32_CLOCK(AHB3, 16U)>, + <&rcc STM32_SRC_PLL1_Q SDMMC_SEL(0)>; + disk-name = "SD"; + status = "okay"; + bus-width = <4>; +}; + +&octospi1 { + pinctrl-0 = <&octospim_p1_ncs_pg6 &octospim_p1_clk_pf10 + &octospim_p1_io0_pf8 &octospim_p1_io1_pf9 + &octospim_p1_io2_pf7 &octospim_p1_io3_pf6>; + pinctrl-names = "default"; + status = "okay"; + + /* Winbond external flash */ + qspi: qspi-nor-flash@0 { + compatible = "st,stm32-ospi-nor"; + reg = <0 DT_SIZE_M(8)>; /* 64 Mbits */ + ospi-max-frequency = ; + spi-bus-width = ; + data-rate = ; + writeoc = "PP_1_1_4"; + size = ; + status = "okay"; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + storage_partition: partition@0 { + reg = <0x00000000 DT_SIZE_M(8)>; /* 64 Mbits */ + }; + }; + }; +}; diff --git a/boards/fanke/fk723m1_zgt6/fk723m1_zgt6.yaml b/boards/fanke/fk723m1_zgt6/fk723m1_zgt6.yaml new file mode 100644 index 0000000000000..d537352e82427 --- /dev/null +++ b/boards/fanke/fk723m1_zgt6/fk723m1_zgt6.yaml @@ -0,0 +1,22 @@ +identifier: fk723m1_zgt6 +name: FK723M1-ZGT6 +type: mcu +arch: arm +toolchain: + - zephyr + - gnuarmemb + - xtools +ram: 432 +flash: 1024 +supported: + - uart + - gpio + - counter + - i2c + - pwm + - spi + - backup_sram + - usb_device + - rtc + - can +vendor: other diff --git a/boards/fanke/fk723m1_zgt6/fk723m1_zgt6_defconfig b/boards/fanke/fk723m1_zgt6/fk723m1_zgt6_defconfig new file mode 100644 index 0000000000000..2ccb0d375b5be --- /dev/null +++ b/boards/fanke/fk723m1_zgt6/fk723m1_zgt6_defconfig @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: Apache-2.0 + +# Enable MPU +CONFIG_ARM_MPU=y + +# Enable HW stack protection +CONFIG_HW_STACK_PROTECTION=y + +# Enable UART +CONFIG_SERIAL=y + +# Console +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y + +# Enable GPIO +CONFIG_GPIO=y diff --git a/boards/fanke/fk723m1_zgt6/pre_dt_board.cmake b/boards/fanke/fk723m1_zgt6/pre_dt_board.cmake new file mode 100644 index 0000000000000..4f5460c5821aa --- /dev/null +++ b/boards/fanke/fk723m1_zgt6/pre_dt_board.cmake @@ -0,0 +1 @@ +list(APPEND EXTRA_DTC_FLAGS "-Wno-spi_bus_bridge") \ No newline at end of file diff --git a/boards/fanke/fk723m1_zgt6/support/openocd.cfg b/boards/fanke/fk723m1_zgt6/support/openocd.cfg new file mode 100644 index 0000000000000..362f9966bf512 --- /dev/null +++ b/boards/fanke/fk723m1_zgt6/support/openocd.cfg @@ -0,0 +1,29 @@ +# FK723M1-ZGT6 V1.0 configuration +# +# Copyright (c) 2020 Alexander Kozhinov +# Copyright (c) 2025 Paul Wedeck +# SPDX-License-Identifier: Apache-2.0 +# + +#debug_level 3 + +source [find interface/stlink.cfg] +transport select hla_swd + +set CHIPNAME STM32H723ZG +set WORKAREASIZE 0x3000 +set BOARDNAME FM723M1_ZGTV6V1 + + + +source [find target/stm32h7x.cfg] + +$_CHIPNAME.cpu0 configure -event gdb-attach { + echo "Debugger attaching: halting execution" + gdb_breakpoint_override hard +} + +$_CHIPNAME.cpu0 configure -event gdb-detach { + echo "Debugger detaching: resuming execution" + resume +}