Commit 61ef26a3 authored by NiZenMeZhiDao's avatar NiZenMeZhiDao Committed by ttwards
Browse files

Added support for robomaster_board_a

parent 62193dfb
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line


config BOARD_ROBOMASTER_BOARD_A
	select SOC_STM32F427XX
+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=STM32F427II")
board_runner_args(jlink "--device=STM32F427II" "--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: robomaster_board_a
  vendor: dji
  socs:
    - name: stm32f427xx
+365 −0
Original line number Diff line number Diff line


/dts-v1/;
#include <st/f4/stm32f427Xi.dtsi>
#include <st/f4/stm32f427i(g-i)hx-pinctrl.dtsi>
#include <zephyr/dt-bindings/input/input-event-codes.h>


/ {
	model = "DJI Robomaster Development Board A";
	compatible = "dji,robomaster-board-a";

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

	aliases {
		led0 = &led_0;
		led1 = &led_1;
		led2 = &led_2;
		led3 = &led_3;
		led4 = &led_4;
		led5 = &led_5;
		led6 = &led_6;
		led7 = &led_7;
		led8 = &led_0_green;
		led9 = &led_1_red;

		watchdog0 = &iwdg;
		
	};

	leds {
		compatible = "gpio-leds";
		led_0: led_0 {
			gpios = <&gpiog 1 GPIO_ACTIVE_HIGH>;
			label = "LED0";
		};
		led_1: led_1 {
			gpios = <&gpiog 2 GPIO_ACTIVE_HIGH>;
			label = "LED1";
		};
		led_2: led_2 {
			gpios = <&gpiog 3 GPIO_ACTIVE_HIGH>;
			label = "LED2";
		};
		led_3: led_3 {
			gpios = <&gpiog 4 GPIO_ACTIVE_HIGH>;
			label = "LED3";
		};
		led_4: led_4 {
			gpios = <&gpiog 5 GPIO_ACTIVE_HIGH>;
			label = "LED4";
		};
		led_5: led_5 {
			gpios = <&gpiog 6 GPIO_ACTIVE_HIGH>;
			label = "LED5";
		};
		led_6: led_6 {
			gpios = <&gpiog 7 GPIO_ACTIVE_HIGH>;
			label = "LED6";
		};
		led_7: led_7 {
			gpios = <&gpiog 8 GPIO_ACTIVE_HIGH>;
			label = "LED7";
		};
		led_0_green: led_0_green {
			gpios = <&gpiof 14 GPIO_ACTIVE_HIGH>;
			label = "LED0 Green";
		};
		led_1_red: led_1_red {
			gpios = <&gpioe 11 GPIO_ACTIVE_HIGH>;
			label = "LED1 Red";
		};
	};

	buttons {
		compatible = "gpio-keys";
		user_button: button_0 {
			gpios = <&gpiob 2 (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>;
		};
	};
    powerctrl {
		compatible = "gpio-leds";
		status = "okay";
		power1: power1 {
			gpios = <&gpioh 1 GPIO_ACTIVE_HIGH>;
			label = "XT30_1";
		};
		power2: power2 {
			gpios = <&gpioh 2 GPIO_ACTIVE_HIGH>;
			label = "XT30_2";
		};
		power3: power3 {
			gpios = <&gpioh 3 GPIO_ACTIVE_HIGH>;
			label = "XT30_3";
		};
		power4: power4 {
			gpios = <&gpioh 4 GPIO_ACTIVE_HIGH>;
			label = "XT30_4";
		};
	};
};

&clk_lsi {
	status = "okay";
};

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

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

&rcc {
	clocks = <&pll>;
	clock-frequency = <DT_FREQ_M(180)>;
	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";
};

&usart1 {
    pinctrl-0 = <&usart1_tx_pb6 &usart1_rx_pb7>;
    pinctrl-names = "default";
    current-speed = <100000>;
    status = "okay";
    data-bits = <8>;
    stop-bits = "2";
    parity = "even";
    dmas = <&dma2 2 5 STM32_DMA_PERIPH_RX STM32_DMA_FIFO_FULL>,
		   <&dma2 7 4 STM32_DMA_PERIPH_TX STM32_DMA_FIFO_FULL>;
    //<&dmax stream channel flags>
		   dma-names = "rx", "tx";
};
&dma2 {
	status = "okay";
};
&dma1 {
    status = "okay";
};
&usart3 {
	pinctrl-0 = <&usart3_tx_pd8 &usart3_rx_pd9>;
	pinctrl-names = "default";
	current-speed = <115200>;
	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";
	// parity = "even";
};
&uart8 {
	pinctrl-0 = <&uart8_tx_pe1 &uart8_rx_pe0>;
	pinctrl-names = "default";
	current-speed = <115200>;
	status = "okay";
	
};
&uart7 {
	pinctrl-0 = <&uart7_tx_pe8 &uart7_rx_pe7>;
	pinctrl-names = "default";
	current-speed = <115200>;
	status = "okay";
	
};

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

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

&can2 {
	pinctrl-0 = <&can2_rx_pb12 &can2_tx_pb13>;
	pinctrl-names = "default";
	bitrate = <1000000>;
	status = "okay";
};
//左上左下右下右上
&timers1 {
	status = "okay";
	st,prescaler = <10000>;
	//st,countermode = <1>;
	// four-channel-capture-support=true;
	pwm1: pwm {
		status = "okay";
		pinctrl-0 = <&tim1_ch1_pa8
					&tim1_ch2_pa9
					&tim1_ch3_pe13
					&tim1_ch4_pe14>;
		pinctrl-names = "default";
		
	};
};
//zyxw
&timers2 {
	status = "okay";
	st,prescaler = <10000>;

	pwm2: pwm {
		status = "okay";
		pinctrl-0 = <&tim2_ch1_pa0
					&tim2_ch2_pa1
					&tim2_ch3_pa2
					&tim2_ch4_pa3>;
		pinctrl-names = "default";
	};
};
//abcd
&timers4 {
	status = "okay";
	st,prescaler = <10000>;

	pwm4: pwm {
		status = "okay";
		pinctrl-0 = <&tim4_ch1_pd12
					&tim4_ch2_pd13
					&tim4_ch3_pd14
					&tim4_ch4_pd15>;
		pinctrl-names = "default";
	};
};
//efgh
&timers5 {
	status = "okay";
	st,prescaler = <10000>;

	pwm5: pwm {
		status = "okay";
		pinctrl-0 = <&tim5_ch1_ph10
					&tim5_ch2_ph11
					&tim5_ch3_ph12
					&tim5_ch4_pi0>;
		pinctrl-names = "default";
	};
};
//vuts
&timers8 {
	status = "okay";
	st,prescaler = <10000>;

	pwm8: pwm {
		status = "okay";
		pinctrl-0 = <&tim8_ch1_pi5
					&tim8_ch2_pi6
					&tim8_ch3_pi7
					&tim8_ch4_pi2>;
		pinctrl-names = "default";
	};
};
&adc1 {
	#address-cells = <1>;
	#size-cells = <0>;
	st,adc-prescaler = <4>;
	status = "okay";
	
	// vref-mv
	// num-sampling-time-common-channels
	channel@8 {
        reg = <8>;              // 通道8,最多15,l2m2n2o2l1m1n1o1
        zephyr,gain = "ADC_GAIN_1";           // 增益1倍
        zephyr,reference = "ADC_REF_INTERNAL"; // 内部参考
        zephyr,acquisition-time = <ADC_ACQ_TIME(ADC_ACQ_TIME_MICROSECONDS, 10)>; // 采样时间10us
        zephyr,resolution = <12>;     // 12位分辨率
		// zephyr,differential
		// zephyr,input-positive
		// zephyr,input-negative
		// zephyr,oversampling
		// zephyr,current-source-pin
		// zephyr,vbias-pins
	};
};
&dac1{
	status = "okay";//out1out2-p2p1 exit9-q2
};
&i2c2 {
	status = "okay";
	pinctrl-0 = <&i2c2_sda_pf0 &i2c2_scl_pf1>;//i2 i1
	pinctrl-names = "default";
	//clock-frequency = <>;
	//scl-gpio
	//sda-gpio
	//sq-size
	//cq-size
};
//k1j1k2j2
&spi4 {
	status = "okay";
	pinctrl-0=<&spi4_mosi_pe6
			&spi4_miso_pe5
			&spi4_sck_pe12
			&spi4_nss_pe4>;
	pinctrl-names="default";
	
};

&spi5 {
	status = "okay";
	pinctrl-0=<&spi5_mosi_pf9
			&spi5_miso_pf8
			&spi5_sck_pf7
			&spi5_nss_pf6>;
	pinctrl-names="default";
	// mpu6600@0 
};



+21 −0
Original line number Diff line number Diff line
identifier: robomaster_board_a
name: DJI Robomaster Development Board A
type: mcu
arch: arm
toolchain:
  - zephyr
  - gnuarmemb
  - xtools
ram: 256
flash: 2048
supported:
  - counter
  - gpio
  - watchdog
  - can
testing:
  ignore_tags:
    - net
    - shell
    - console
vendor: dji
 No newline at end of file
Loading