Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable motorctl in td2kw #103

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 34 additions & 18 deletions boards/arm/td2kw/td2kw.dts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

zephyr,user {
io-channels = <&adc1 1>, <&adc1 3>, <&adc1 15>, <&adc1 8>,
/* For phase current */ <&adc2 11>, <&adc2 12>, <&adc2 13>;
/* For phase current */ <&adc1 11>, <&adc2 12>, <&adc3 13>;
io-channel-names = "adc1-1", "adc1-3", "adc1-15", "adc1-8",
"motor_iu", "motor_iv", "motor_iw";
};
Expand Down Expand Up @@ -56,13 +56,13 @@

servo: servo {
compatible = "coriander,bldc";
pwms = <&pwm 1 PWM_USEC(500) PWM_POLARITY_NORMAL>,
<&pwm 2 PWM_USEC(500) PWM_POLARITY_NORMAL>,
<&pwm 3 PWM_USEC(500) PWM_POLARITY_NORMAL>,
<&pwm 4 PWM_USEC(500) PWM_POLARITY_NORMAL>,
<&pwm 1 PWM_USEC(500) (PWM_POLARITY_NORMAL | STM32_PWM_COMPLEMENTARY)>,
<&pwm 2 PWM_USEC(500) (PWM_POLARITY_NORMAL | STM32_PWM_COMPLEMENTARY)>,
<&pwm 3 PWM_USEC(500) (PWM_POLARITY_NORMAL | STM32_PWM_COMPLEMENTARY)>;
pwms = <&pwm 1 PWM_USEC(200) PWM_POLARITY_NORMAL>,
<&pwm 2 PWM_USEC(200) PWM_POLARITY_NORMAL>,
<&pwm 3 PWM_USEC(200) PWM_POLARITY_NORMAL>,
<&pwm 4 PWM_USEC(200) PWM_POLARITY_NORMAL>,
<&pwm 1 PWM_USEC(200) (PWM_POLARITY_NORMAL | STM32_PWM_COMPLEMENTARY)>,
<&pwm 2 PWM_USEC(200) (PWM_POLARITY_NORMAL | STM32_PWM_COMPLEMENTARY)>,
<&pwm 3 PWM_USEC(200) (PWM_POLARITY_NORMAL | STM32_PWM_COMPLEMENTARY)>;
pwm-names = "motor-u", "motor-v", "motor-w", "adc-trigger", "motor-un", "motor-vn", "motor-wn";
enable-pin = <&gpioc 7 GPIO_ACTIVE_LOW>;
max_pulse = <PWM_USEC(490)>;
Expand Down Expand Up @@ -129,7 +129,8 @@

st,adc-prescaler = <8>;

pinctrl-0 = <&adc1_in1_pa1 &adc1_in3_pa3 &adc1_in8_pb0 &adc1_in15_pc5>;
pinctrl-0 = <&adc1_in1_pa1 &adc1_in3_pa3 &adc1_in8_pb0
&adc1_in11_pc1 &adc1_in15_pc5>;
pinctrl-names = "default";

channel@1 {
Expand Down Expand Up @@ -164,6 +165,14 @@
zephyr,resolution = <12>;
};

channel@11 {
reg = <11>;
zephyr,gain = "ADC_GAIN_1";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME(ADC_ACQ_TIME_TICKS, 56)>;
zephyr,resolution = <8>;
};

channel@15 {
reg = <15>;
zephyr,gain = "ADC_GAIN_1";
Expand All @@ -179,23 +188,28 @@
#size-cells = <0>;
st,adc-prescaler = <4>;

pinctrl-0 = <&adc2_in11_pc1 &adc2_in12_pc2 &adc2_in13_pc3>;
pinctrl-0 = <&adc2_in11_pc1 &adc2_in12_pc2>;
pinctrl-names = "default";

channel@11 {
reg = <11>;
zephyr,gain = "ADC_GAIN_1";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME(ADC_ACQ_TIME_TICKS, 56)>;
zephyr,resolution = <8>;
};
channel@12 {
reg = <12>;
zephyr,gain = "ADC_GAIN_1";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME(ADC_ACQ_TIME_TICKS, 56)>;
zephyr,resolution = <8>;
};

};

&adc3 {
status = "okay";
#address-cells = <1>;
#size-cells = <0>;
st,adc-prescaler = <4>;

pinctrl-0 = <&adc3_in13_pc3>;
pinctrl-names = "default";

channel@13 {
reg = <13>;
zephyr,gain = "ADC_GAIN_1";
Expand All @@ -211,7 +225,9 @@

pwm: pwm {
status = "okay";
pinctrl-0 = <&tim1_ch1_pa8 &tim1_ch2_pa9 &tim1_ch3_pa10>;
pinctrl-0 = <&tim1_ch1_pa8 &tim1_ch1n_pb13
&tim1_ch2_pa9 &tim1_ch2n_pb14
&tim1_ch3_pa10 &tim1_ch3n_pb15>;
pinctrl-names = "default";
};
};
Expand Down
Loading