|
| 1 | +/* |
| 2 | + * Copyright (c) 2026 Launch Initiative |
| 3 | + * |
| 4 | + * SPDX-License-Identifier: Apache-2.0 |
| 5 | + */ |
| 6 | + |
| 7 | +/dts-v1/; |
| 8 | +#include <st/f1/stm32f103X8.dtsi> |
| 9 | +#include <st/f1/stm32f103c(8-b)tx-pinctrl.dtsi> |
| 10 | +#include <zephyr/dt-bindings/input/input-event-codes.h> |
| 11 | + |
| 12 | +&pinctrl{ |
| 13 | + swj-cfg = "jtag-disable"; |
| 14 | +}; |
| 15 | + |
| 16 | +/ { |
| 17 | + model = "CRASHOUT"; |
| 18 | + compatible = "launch,crashout"; |
| 19 | + |
| 20 | + chosen { |
| 21 | + zephyr,console = &usart2; |
| 22 | + zephyr,shell-uart = &usart2; |
| 23 | + zephyr,sram = &sram0; |
| 24 | + zephyr,flash = &flash0; |
| 25 | + }; |
| 26 | + |
| 27 | + leds: leds { |
| 28 | + compatible = "gpio-leds"; |
| 29 | + led1: led1{ |
| 30 | + |
| 31 | + gpios = <&gpiob 15 GPIO_ACTIVE_HIGH>; |
| 32 | + label = "LED"; |
| 33 | + }; |
| 34 | + |
| 35 | + flip_servo_pwr_en: flip_servo_pwr_en { |
| 36 | + // 8.4v buck |
| 37 | + gpios = <&gpioa 15 GPIO_ACTIVE_HIGH>; |
| 38 | + label = "Flip Servo Power Enable"; |
| 39 | + }; |
| 40 | + wrist_servo_pwr_en: wrist_servo_pwr_en { |
| 41 | + // 5v efuse |
| 42 | + gpios = <&gpioc 13 GPIO_ACTIVE_HIGH>; |
| 43 | + label = "Wrist Servo Power Enable"; |
| 44 | + }; |
| 45 | + nsleep: nsleep { |
| 46 | + // motor nsleep |
| 47 | + gpios = <&gpioc 15 GPIO_ACTIVE_HIGH>; |
| 48 | + label = "nsleep driver pin"; |
| 49 | + }; |
| 50 | + }; |
| 51 | + |
| 52 | + aliases { |
| 53 | + led0 = &led1; |
| 54 | + die-temp0 = &die_temp; |
| 55 | + }; |
| 56 | + |
| 57 | + servos: servos{ |
| 58 | + status="okay"; |
| 59 | + compatible = "pwm-leds"; |
| 60 | + // 500 -2500 for wrist servo |
| 61 | + min-pulse = <PWM_USEC(100)>; // 800 maybe |
| 62 | + max-pulse = <PWM_USEC(3000)>; //1700 maybe |
| 63 | + |
| 64 | + servo1: servo1 { |
| 65 | + // 5v one |
| 66 | + label = "Servo 1 PWM"; |
| 67 | + // name of pin |
| 68 | + pwms = <&pwm1 4 PWM_MSEC(3) PWM_POLARITY_NORMAL>; |
| 69 | + }; |
| 70 | + servo2: servo2 { |
| 71 | + label = "Servo 2 PWM"; |
| 72 | + // name of pin |
| 73 | + pwms = <&pwm1 3 PWM_MSEC(3) PWM_POLARITY_NORMAL>; |
| 74 | + }; |
| 75 | + servo3: servo3 { |
| 76 | + label = "Servo 3 PWM"; |
| 77 | + // name of pin |
| 78 | + pwms = <&pwm1 2 PWM_MSEC(3) PWM_POLARITY_NORMAL>; |
| 79 | + }; |
| 80 | + servo4: servo4 { |
| 81 | + label = "Servo 4 PWM"; |
| 82 | + // name of pin |
| 83 | + pwms = <&pwm1 1 PWM_MSEC(3) PWM_POLARITY_NORMAL>; |
| 84 | + }; |
| 85 | + }; |
| 86 | + |
| 87 | +}; |
| 88 | + |
| 89 | +&clk_lsi { |
| 90 | + status = "okay"; |
| 91 | +}; |
| 92 | + |
| 93 | +&pll { |
| 94 | + mul = <7>; |
| 95 | + clocks = <&clk_hsi>; |
| 96 | + status = "okay"; |
| 97 | +}; |
| 98 | + |
| 99 | +&rcc { |
| 100 | + clocks = <&pll>; |
| 101 | + clock-frequency = <DT_FREQ_M(28)>; |
| 102 | + ahb-prescaler = <1>; |
| 103 | + apb1-prescaler = <1>; |
| 104 | + apb2-prescaler = <1>; |
| 105 | +}; |
| 106 | + |
| 107 | +// Debug Header UART |
| 108 | +&usart2 { |
| 109 | + pinctrl-0 = <&usart2_tx_pa2 &usart2_rx_pa3>; |
| 110 | + pinctrl-names = "default"; |
| 111 | + current-speed = <115200>; |
| 112 | + status = "okay"; |
| 113 | +}; |
| 114 | + |
| 115 | +motor_i2c: &i2c1 { |
| 116 | + // motor i2c |
| 117 | + pinctrl-0 = <&i2c1_scl_remap1_pb8 &i2c1_sda_remap1_pb9>; |
| 118 | + pinctrl-names = "default"; |
| 119 | + status = "okay"; |
| 120 | + clock-frequency = <I2C_BITRATE_FAST>; |
| 121 | +}; |
| 122 | + |
| 123 | +imu_i2c:&i2c2 { |
| 124 | + // imu i2c |
| 125 | + pinctrl-0 = <&i2c2_scl_pb10 &i2c2_sda_pb11>; |
| 126 | + pinctrl-names = "default"; |
| 127 | + status = "okay"; |
| 128 | + clock-frequency = <I2C_BITRATE_FAST>; |
| 129 | + |
| 130 | + link1_imu: lis3dh@18 { |
| 131 | + compatible = "st,lis3dh"; |
| 132 | + reg = <0x18>; |
| 133 | + status = "okay"; |
| 134 | + }; |
| 135 | + |
| 136 | + link2_imu: lis3dh@19 { |
| 137 | + compatible = "st,lis3dh"; |
| 138 | + reg = <0x19>; |
| 139 | + status = "okay"; |
| 140 | + }; |
| 141 | + |
| 142 | +}; |
| 143 | + |
| 144 | +&spi1 { |
| 145 | + pinctrl-0 = <&spi1_sck_slave_pa5 &spi1_miso_slave_pa6 &spi1_mosi_slave_pa7>; |
| 146 | + pinctrl-names = "default"; |
| 147 | + cs-gpios = <&gpiob 6 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; |
| 148 | + status = "okay"; |
| 149 | +}; |
| 150 | + |
| 151 | +&timers1 { |
| 152 | + st,prescaler = <100>; |
| 153 | + status = "okay"; |
| 154 | + |
| 155 | + pwm1: pwm { |
| 156 | + status = "okay"; |
| 157 | + // corresponds to servo 4-1 |
| 158 | + pinctrl-0 = <&tim1_ch1_pwm_out_pa8 &tim1_ch2_pwm_out_pa9 &tim1_ch3_pwm_out_pa10 &tim1_ch4_pwm_out_pa11>; |
| 159 | + pinctrl-names = "default"; |
| 160 | + }; |
| 161 | +}; |
| 162 | + |
| 163 | +&timers2 { |
| 164 | + dcm_enc1: qdec { |
| 165 | + compatible = "st,stm32-qdec"; |
| 166 | + status = "okay"; |
| 167 | + st,input-filter-level = <NO_FILTER>; |
| 168 | + pinctrl-0 = <&tim2_ch1_pwm_in_pa0 &tim2_ch2_pwm_in_pa1>; |
| 169 | + pinctrl-names = "default"; |
| 170 | + // https://docs.zephyrproject.org/latest/build/dts/api/bindings/sensor/st%2Cstm32-qdec.html |
| 171 | + st,counts-per-revolution = <4172>; // 298:1 gearbox 298 rotations of output to 1 input. 7 PPR hall sensor |
| 172 | + }; |
| 173 | +}; |
| 174 | + |
| 175 | +&timers3 { |
| 176 | + dcm_enc2: qdec { |
| 177 | + compatible = "st,stm32-qdec"; |
| 178 | + status = "okay"; |
| 179 | + st,input-filter-level = <NO_FILTER>; |
| 180 | + pinctrl-0 = <&tim3_ch1_remap1_pwm_in_pb4 &tim3_ch2_remap1_pwm_in_pb5>; |
| 181 | + pinctrl-names = "default"; |
| 182 | + // https://docs.zephyrproject.org/latest/build/dts/api/bindings/sensor/st%2Cstm32-qdec.html |
| 183 | + st,counts-per-revolution = <4172>; // 298:1 gearbox 298 rotations of output to 1 input. 7 PPR hall sensor |
| 184 | + }; |
| 185 | +}; |
| 186 | + |
| 187 | +&timers4 { |
| 188 | + dcm_enc3: qdec { |
| 189 | + compatible = "st,stm32-qdec"; |
| 190 | + status = "okay"; |
| 191 | + st,input-filter-level = <NO_FILTER>; |
| 192 | + pinctrl-0 = <&tim4_ch1_pwm_in_pb6 &tim4_ch2_pwm_in_pb7>; |
| 193 | + pinctrl-names = "default"; |
| 194 | + // https://docs.zephyrproject.org/latest/build/dts/api/bindings/sensor/st%2Cstm32-qdec.html |
| 195 | + st,counts-per-revolution = <4172>; // 298:1 gearbox 298 rotations of output to 1 input. 7 PPR hall sensor |
| 196 | + }; |
| 197 | +}; |
| 198 | + |
| 199 | + |
| 200 | +&die_temp { |
| 201 | + status = "okay"; |
| 202 | +}; |
0 commit comments