Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
2c8ddda
create feature flags to manage can ids between images
Sep 28, 2025
76ce1ab
Merge pull request #16 from psas/bugfix/can/feature_flag_id
wjeffreys96 Sep 28, 2025
39aad49
WIP: start working on motor fixes
erfi-x2 Sep 28, 2025
5b1dafb
WIP: start working on motor fixes
erfi-x2 Sep 28, 2025
33da073
fix git conflicts
erfi-x2 Sep 28, 2025
31d7144
went over dac numbers , re-did calculations and flow
erfi-x2 Sep 29, 2025
6dbaab1
added a timeout loop checking for ringposition
erfi-x2 Sep 29, 2025
ec4306d
Merge branch 'ers-embassy' into ers-embassy-motorfix
wjeffreys96 Oct 1, 2025
92faed3
Merge pull request #17 from psas/ers-embassy-motorfix
wjeffreys96 Oct 1, 2025
ab3de91
create motor struct
wjeffreys96 Oct 1, 2025
28351a8
remove debug prints; handle timeout error
wjeffreys96 Oct 2, 2025
906880f
fix errors
wjeffreys96 Oct 2, 2025
bc47d31
change sensor limits to fit new values & fixed endless motor driving
erfi-x2 Oct 2, 2025
3848b8d
Change ring position channel to a Watch
wjeffreys96 Oct 2, 2025
0ff387d
Reorganize project structure
wjeffreys96 Oct 4, 2025
937e983
Change adc batt_read tasks to use watch instead of channel
wjeffreys96 Oct 6, 2025
ff06a18
sensor limits set to fit new values after hardware changes
erfi-x2 Oct 7, 2025
02a80b4
send can acknowledgement messages
wjeffreys96 Oct 8, 2025
fe7f972
add batt command to parachute board image
wjeffreys96 Oct 8, 2025
bb65c06
add feature flag to flash blinky onto actual ers board
wjeffreys96 Oct 8, 2025
761b2f2
move watch and mutex statics to their respective files
Oct 9, 2025
93b58c3
create parachute board heartbeat can messages
Oct 9, 2025
d781ff7
use constant for drive curr
wjeffreys96 Oct 9, 2025
f7cfb58
better data values for the everchanging hardware
erfi-x2 Oct 10, 2025
379d5f7
use ID constants from can module for acknowledgement messages
Oct 10, 2025
5dd85db
Attempt to recover from bus off mode
Oct 10, 2025
ea1515f
blink led while board is on
Oct 10, 2025
a15a007
Always beep on startup
Oct 10, 2025
c8c1d8e
implement beep command
wjeffreys96 Oct 14, 2025
bfab9db
update state when can message comes in or shore power is read.
wjeffreys96 Oct 14, 2025
0b79caa
create watch for sensor readings, implement pos cmd
wjeffreys96 Oct 14, 2025
96c67be
remove random conditional compilation
wjeffreys96 Oct 14, 2025
cbb7788
implement the version command
wjeffreys96 Oct 14, 2025
3d98b0c
implement --poll flag for pos cmd
wjeffreys96 Oct 15, 2025
11c4b2e
fix message formatting for pos --poll command
wjeffreys96 Oct 15, 2025
2ed9cbc
fix broken version command
wjeffreys96 Oct 15, 2025
b4de617
clean up logs
wjeffreys96 Oct 17, 2025
c80698c
Print a csv of motor_isense while motor is driving
wjeffreys96 Oct 17, 2025
449e319
fix conditional compilation erros
wjeffreys96 Oct 17, 2025
dce15f6
add id and ready state fields to parachute boards
wjeffreys96 Oct 20, 2025
1a72a0d
Clean up imports
Oct 28, 2025
6064dc9
Bin dir README
Oct 28, 2025
0c781cf
Remove unecessary arguments to tasks, struct constructors
Oct 29, 2025
00fdded
Fix bug in can_reader
Oct 31, 2025
e22eb45
Rename TELEMETRUM_HEARTBEAT_ID -> SENDER_HEARTBEAT_ID
Oct 31, 2025
35d4d92
Write README for src/bin
Oct 31, 2025
cb5a687
Rename *_STATUS_ID -> *_HEARTBEAT_ID
Nov 1, 2025
e6d3e48
Move motor consts to motor module
Nov 1, 2025
663a98e
Delete unused types
Nov 1, 2025
b1f316b
Write src README.md
Nov 1, 2025
a4546ef
Update py can testing scripts
Nov 1, 2025
d176208
rename test_can.py -> echo_can.py
wjeffreys96 Nov 1, 2025
ecb6f99
Write pytests to verify acknowledgement of deployment CAN messages
wjeffreys96 Nov 1, 2025
e5115be
update gitignore to ignore pycache
wjeffreys96 Nov 1, 2025
f06653b
Update src/bin/README.md
wjeffreys96 Nov 2, 2025
2b8f3ea
Update src/README.md
wjeffreys96 Nov 2, 2025
7ba5be2
Fix buffer overflow when recording motor_isense csv
wjeffreys96 Nov 2, 2025
c7637c0
Add flash memory storage of motor actuations
wjeffreys96 Nov 7, 2025
2345f73
Add embedded-test crate and config
wjeffreys96 Nov 9, 2025
30d0d23
Make reading the ring position non_blocking
wjeffreys96 Nov 12, 2025
b0cf112
use BOARD env var instead of feature flags to manage parachute boards
wjeffreys96 Nov 12, 2025
3921de8
Make flashing drogue vs main board easier
wjeffreys96 Nov 20, 2025
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,4 @@ fp-info-cache
# Rust generated files
controlSystem/RecoveryBoard/firmware-rs/target
controlSystem/RecoveryBoard/firmware-rs/Cargo.lock
controlSystem/RecoveryBoard/firmware-rs/__pycache__
4 changes: 4 additions & 0 deletions controlSystem/RecoveryBoard/firmware-rs/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
[target.thumbv6m-none-eabi]
runner = 'probe-rs run --chip STM32F091RCTX'

[alias]
sender = "run -r --bin sender"
parachute = "run -r --bin parachute"

[build]
target = "thumbv6m-none-eabi"

Expand Down
11 changes: 11 additions & 0 deletions controlSystem/RecoveryBoard/firmware-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,17 @@ embedded-hal-nb = "1.0.0"
noline = "0.5.1"
heapless = "0.9.1"
format_no_std = "1.2.0"
embedded-test-linker-script = { version = "0.1.0" }

[dev-dependencies]
embedded-test = { version = "0.7.0", features=["embassy", "defmt"] }

[lib]
harness = false # Important: As we bring our own test harness for all tests

[[test]]
name = "blinky"
harness = false

[profile.release]
debug = 2
24 changes: 24 additions & 0 deletions controlSystem/RecoveryBoard/firmware-rs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ With all the dependencies installed, you should now be able to navigate to the d
cargo run --bin blinky --release
```

If you are flashing blinky directly onto one of the ERS boards, you will need to set the BOARD environment variable to `"main"`.

After it builds, terminal output should look like this if everything went according to plan:

```bash
Expand All @@ -38,3 +40,25 @@ Programming ✔ 100% [####################] 15.00 KiB @ 20.53 KiB/s (took 1s)
```

and the led should be blinking.

## Flashing

The commands to flash the binaries are as follows:

*Sender*:

```rust
cargo sender
```

*Drogue parachute*:

```rust
BOARD=drogue cargo parachute
```

*Main parachute*:

```rust
BOARD=main cargo parachute
```
16 changes: 16 additions & 0 deletions controlSystem/RecoveryBoard/firmware-rs/build.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
use std::env;

fn main() {
println!("cargo::rerun-if-env-changed=BOARD");
println!("cargo:rustc-link-arg-bins=--nmagic");
println!("cargo:rustc-link-arg-bins=-Tlink.x");
println!("cargo:rustc-link-arg-bins=-Tdefmt.x");
println!("cargo::rustc-link-arg=-Tembedded-test.x");
println!("cargo:rustc-link-arg-tests=-Tdefmt.x");
println!("cargo:rustc-link-arg-tests=-Tlink.x");

println!("cargo::rustc-check-cfg=cfg(drogue,main)");
if let Ok(board) = env::var("BOARD") {
if board == "drogue" {
println!("cargo::rustc-cfg=drogue");
}
if board == "main" {
println!("cargo::rustc-cfg=main");
}
}
}
52 changes: 52 additions & 0 deletions controlSystem/RecoveryBoard/firmware-rs/echo_can.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
"""
This script is used to test that your can bus is set up properly.
With a VulCAN plugged in, run this script in one terminal,
making sure to pass in the proper path to the VulCAN with the `-d` flag.
Then have the ERS board or Nucleo run the `echo_can` task in another.
You should see the two boards echoing CAN messages back and forth.
* Requires python-can v4.5, pySerial v3.5 *
"""

import can
import argparse
import logging
from typing import cast

logger = logging.getLogger(__name__)
logging.basicConfig(
format="%(asctime)s - [%(levelname)s]: %(message)s",
datefmt="%H:%M:%S",
level=logging.INFO,
)

parser = argparse.ArgumentParser(
prog="VulCAN Tester",
description="Send or Receive messages via CAN using a VulCAN adapter",
)

_ = parser.add_argument("--device", "-d", required=True, help="Path to VulCAN")

args = parser.parse_args()

# Ensure proper arg types
device = cast(str, args.device)
device = str(device)


def main():
logger.info("Connecting to VulCAN")
bitrate = 1e6

# Configure the connection to the VulCAN
bus = can.interface.Bus(channel="can0", interface="socketcan", bitrate=bitrate)

logger.info("Echoing CAN messages")
while True:
message = bus.recv(timeout=None)
if message:
bus.send(message)
logger.info("Echoed message: %s", message)


if __name__ == "__main__":
main()
26 changes: 21 additions & 5 deletions controlSystem/RecoveryBoard/firmware-rs/spoof_ers_can.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
# Requires python-can v4.5, pySerial v3.5
"""
This script uses the Vulcan to spoof the other two parachute boards when you only have one board to use.
It's purpose is to test that the sender board is functioning properly.
Make sure to pass in the path to your Vulcan with the `-d` flag when invoking this script.
You should see that the Vulcan is sending good status messages over the CAN bus that match both drogue and main parachute board heartbeat IDs.
* Requires python-can v4.5, pySerial v3.5 *
"""

import can
import time
import argparse
Expand Down Expand Up @@ -33,17 +40,26 @@ def main():
# Configure the connection to the VulCAN
bus = can.interface.Bus(channel="can0", interface="socketcan", bitrate=bitrate)

status_buf = [
2, # Ring locked
100, # Battery voltage in 0.1 volts (> 9.9v is good)
1, # Batt_ok == True
1, # Shore power Off == true
1, # Received sender message in last two seconds
1, # Board is ready to release parachute
0, # unused
0, # unused
]

while True:
message_id = 0x710
data_bytes = [0x01]
msg = can.Message(
arbitration_id=message_id, data=data_bytes, is_extended_id=False
arbitration_id=message_id, data=status_buf, is_extended_id=False
)
bus.send(msg)
message2_id = 0x720
data_bytes2 = [0x01]
msg2 = can.Message(
arbitration_id=message2_id, data=data_bytes2, is_extended_id=False
arbitration_id=message2_id, data=status_buf, is_extended_id=False
)
bus.send(msg2)
logger.info("Sent messages: %s %s", msg, msg2)
Expand Down
Loading