Skip to content

Commit 5eefd62

Browse files
authored
Crashout Bringup (#389)
1 parent ac682dc commit 5eefd62

9 files changed

Lines changed: 281 additions & 0 deletions

File tree

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
config BOARD_CRASHOUT
3+
select SOC_STM32F103X8

boards/arm/crashout/board.cmake

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
3+
# keep first
4+
board_runner_args(stm32cubeprogrammer "--port=swd" "--reset-mode=hw")
5+
board_runner_args(jlink "--device=STM32F103C8" "--speed=4000")
6+
7+
# keep first
8+
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)
9+
include(${ZEPHYR_BASE}/boards/common/stm32cubeprogrammer.board.cmake)
10+
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)

boards/arm/crashout/board.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
board:
2+
name: crashout
3+
full_name: CRASHOUT
4+
vendor: Launch Initiative
5+
socs:
6+
- name: stm32f103xb #lying voice. this is just to make west happy. memory map and peripherals are x8

boards/arm/crashout/crashout.dts

Lines changed: 202 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,202 @@
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+
};

boards/arm/crashout/crashout.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
identifier: crashout
2+
name: CRASHOUT
3+
type: mcu
4+
arch: arm
5+
toolchain:
6+
- zephyr
7+
- gnuarmemb
8+
ram: 20
9+
flash: 64
10+
supported:
11+
- gpio
12+
- spi
13+
- pwm
14+
- watchdog
15+
- adc
16+
- dma
17+
- nvs
18+
- counter
19+
vendor: launch
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
3+
# enable uart driver
4+
CONFIG_SERIAL=y
5+
# enable console
6+
CONFIG_CONSOLE=y
7+
CONFIG_UART_CONSOLE=y
8+
9+
# enable GPIO
10+
CONFIG_GPIO=y
11+
12+
13+
CONFIG_SENSOR_ASYNC_API=n
14+
CONFIG_SENSOR=y
15+
16+
CONFIG_QDEC_STM32=y
17+
CONFIG_PWM=y
18+
CONFIG_I2C=y
19+
20+

boards/arm/crashout/doc/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Me when i crash out
7.25 MB
Binary file not shown.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
source [find board/stlink.cfg]
2+
3+
reset_config connect_assert_srst
4+
5+
$_TARGETNAME configure -event gdb-attach {
6+
echo "Debugger attaching: halting execution"
7+
reset halt
8+
gdb_breakpoint_override hard
9+
}
10+
11+
$_TARGETNAME configure -event gdb-detach {
12+
echo "Debugger detaching: resuming execution"
13+
resume
14+
}
15+
16+
rename init old_init
17+
proc init {} {
18+
old_init
19+
reset halt
20+
}

0 commit comments

Comments
 (0)