Commit a393466a authored by Wenxi Xu's avatar Wenxi Xu
Browse files

Adding damiao motor

parent 9607144c
Loading
Loading
Loading
Loading
+1 −26
Original line number Diff line number Diff line
@@ -5,31 +5,6 @@
# as the module Kconfig entry point (see zephyr/module.yml). You can browse
# module options by going to Zephyr -> Modules in Kconfig.

# rsource "drivers/Kconfig"
rsource "drivers/Kconfig"
# rsource "lib/Kconfig"
config MOTOR_DJI
    bool "Enable MOTOR_DJI"
    default n

config ARES_SBUS
	bool "Enable SBUS"
	default n

config ARES_SBUS_INIT_PRIORITY
	int "SBUS init priority"
	default 90
	help
		fuck

config MOTOR_LOG_LEVEL
    int "Motor log level"
    default 4
    help
    	The log level of motor driver

config MOTOR_INIT_PRIORITY
    int "Motor init priority"
    default 90
    help
    	The init priority of motor driver
 No newline at end of file
+5 −0
Original line number Diff line number Diff line
# Copyright (c) 2024, ttwards <xuwenxi0517@gmail.com>
# SPDX-License-Identifier: Apache-2.0

config BOARD_DM_MC02
	select SOC_STM32H723VG
+13 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: Apache-2.0

# keep first
board_runner_args(stm32cubeprogrammer "--port=swd" "--reset-mode=hw")
board_runner_args(openocd)
board_runner_args(pyocd "--target=STM32H723VG")
board_runner_args(jlink "--device=STM32H723VG" "--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)
include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake)
+5 −0
Original line number Diff line number Diff line
board:
  name: dm_mc02
  vendor: damiao
  socs:
    - name: stm32h723vgt6
+204 −0
Original line number Diff line number Diff line
/*
 * Copyright (c) 2024, ttwards <xuwenxi0517@gmail.com>
 *
 * SPDX-License-Identifier: Apache-2.0
 */

/dts-v1/;
#include <st/h7/stm32h723Xg.dtsi>
#include <st/h7/stm32h723v(e-g)tx-pinctrl.dtsi>
#include <zephyr/dt-bindings/input/input-event-codes.h>
// #include "robomaster_board_c-pinctrl.dtsi"

/ {
	model = "Damiao DM-MC02";
	compatible = "damiao,dm-mc02";

	chosen {
		zephyr,console = &usart6;
		zephyr,shell-uart = &usart6;
		zephyr,sram = &sram0;
		zephyr,button = &user_button;
		zephyr,flash = &flash0;
		zephyr,canbus = &can1;
		sbus,uart = &usart3;
	};

	aliases {
		led0 = &led_0_blue;
		led1 = &led_1_green;
		led2 = &led_2_red;
		watchdog0 = &iwdg;
	};

	leds {
		compatible = "gpio-leds";
		led_0_blue: led_0_blue {
			gpios = <&gpioh 10 GPIO_ACTIVE_HIGH>;
			label = "LED0";
		};
		led_1_green: led_1_green {
			gpios = <&gpioh 11 GPIO_ACTIVE_HIGH>;
			label = "LED1";
		};
		led_2_red: led_2_red {
			gpios = <&gpioh 12 GPIO_ACTIVE_HIGH>;
			label = "LED2";
		};
	};

	buttons {
		compatible = "gpio-keys";
		user_button: button_0 {
			gpios = <&gpioa 0 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
			label = "User Button";
			zephyr,code = <INPUT_KEY_0>;
		};
	};
	canbus {
		canbus1: canbus1 {
				compatible = "vnd,canbus";
				status = "okay";
				can_device = <&can1>;
		};
		canbus2: canbus2 {
				compatible = "vnd,canbus";
				status = "okay";
				can_device = <&can2>;
		};
	};
    
};

&clk_lsi {
	status = "okay";
};

&clk_hse {
	clock-frequency = <DT_FREQ_M(12)>;
	status = "okay";
};

&pll {
	div-m = <6>;
	mul-n = <168>;
	div-p = <2>;
	div-q = <4>;
	clocks = <&clk_hse>;
	status = "okay";
};

&rcc {
	clocks = <&pll>;
	clock-frequency = <DT_FREQ_M(168)>;
	ahb-prescaler = <1>;
	apb1-prescaler = <4>;
	apb2-prescaler = <2>;
};

&rtc {
	clocks = <&rcc STM32_CLOCK_BUS_APB1 0x10000000>,
			<&rcc STM32_SRC_LSI RTC_SEL(2)>;
	status = "okay";
};

&rng {
	status = "okay";
};

&iwdg {
	status = "okay";
};

&usart3 {
    pinctrl-0 = <&usart3_tx_pc10 &usart3_rx_pc11>;
    pinctrl-names = "default";
    current-speed = <100000>;
    status = "okay";
    data-bits = <8>;
    stop-bits = "2";
    parity = "even";
    dmas = <&dma1 1 4 STM32_DMA_PERIPH_RX STM32_DMA_FIFO_FULL>,
		   <&dma1 3 4 STM32_DMA_PERIPH_TX STM32_DMA_FIFO_FULL>;
    dma-names = "rx", "tx";
};

&dma1 {
    status = "okay";
};

&usart6 {
	pinctrl-0 = <&usart6_tx_pg14 &usart6_rx_pg9>;
	pinctrl-names = "default";
	current-speed = <115200>;
	status = "okay";
	data-bits = <8>;
	stop-bits = "1";
};

zephyr_udc0: &usbotg_fs {
	pinctrl-0 = <&usb_otg_fs_dm_pa11 &usb_otg_fs_dp_pa12>;
	pinctrl-names = "default";
	status = "okay";

	// cdc_acm_uart0: cdc_acm_uart {
	// 	compatible = "zephyr,cdc-acm-uart";
	// };
};

&can1 {
	status = "okay";
	pinctrl-0 = <&can1_rx_pd0 &can1_tx_pd1>;
	pinctrl-names = "default";
	bitrate = <1000000>;
};

&can2 {
	pinctrl-0 = <&can2_rx_pb5 &can2_tx_pb6>;
	pinctrl-names = "default";
	bitrate = <1000000>;
	status = "okay";
};

// &timers1 {
// 	status = "okay";
// 	st,prescaler = <10000>;

// 	pwm1: pwm {
// 		status = "okay";
// 		pinctrl-0 = <&tim1_ch1_pe9
// 					&tim1_ch2_pe11
// 					&tim1_ch3_pe13
// 					&tim1_ch4_pe14>;
// 		pinctrl-names = "default";
// 	};
// };

// &adc1 {
// 	pinctrl-0 = <&adc_in4_pf6>;
// 	pinctrl-names = "default";
// 	st,adc-clock-source = <SYNC>;
// 	st,adc-prescaler = <4>;
// 	status = "okay";
// };

&spi1 {
	status = "okay";
	cs-gpios = <&gpioa 4 GPIO_ACTIVE_LOW>,
		<&gpiob 0 GPIO_ACTIVE_LOW>;
	pinctrl-0=<&spi1_mosi_pa7
			&spi1_miso_pb4
			&spi1_sck_pb3>;
	pinctrl-names="default";

};

// &lptim1 {
// 	clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000008>,
// 		 <&rcc STM32_SRC_LSI LPTIM1_SEL(2)>;
// 	status = "okay";
// };

// &timers2 {
// 	status = "okay";
// };
Loading