Skip to content

A port of Open Source Car Control written in Rust

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

jonlamb-gh/oxcc

Repository files navigation

OxCC

Overview

A port of Open Source Car Control written in Rust.

OxCC runs on the NUCLEO-F767ZI STM32F767ZI board.

It is built around the traits and patterns provided by the embedded-hal project and community: see the BSP crate, the HAL crate, and the device crate.

OSCC Divergence

Apart from the change in MCU/board, OxCC combines all of the OSCC modules (throttle, brake, steering, CAN gateway) into a single application.

Hardware

A new layout and schematic is currently in the works, check out the rough pinout to get started.

  • CAN

    OxCC uses the stm's on-board bxCAN controller. For a transceiver I've been using the SN65HVD230 from Waveshare.

Getting Started

Dependencies

Building

The default Cargo configuration will build for the Kia Soul EV vehicle with the panic-over-abort strategy.

See the [features] section of the Cargo.toml to change configurations.

  • Install system package dependencies:
    sudo apt-get install openocd
    sudo apt-get install gdb-arm-none-eabi
    sudo apt-get install binutils-arm-none-eabi
  • Install stlink from source: guide
  • Install Rust nightly and additional components:
    curl https://sh.rustup.rs -sSf | sh
    rustup install nightly
    rustup component add rust-src
    rustup component add rustfmt-preview --toolchain nightly
    rustup target add thumbv7em-none-eabihf
  • Install svd2rust:
    cargo install svd2rust
  • Build OxCC firmware:
    cargo build

Deploying

Deploy the firmware Using st-flash (provided by stlink):

# Convert ELF to ihex format
arm-none-eabi-objcopy \
    -O ihex \
    target/thumbv7em-none-eabihf/release/oxcc \
    target/thumbv7em-none-eabihf/release/oxcc.hex

# Upload to flash
st-flash \
    --format ihex \
    write \
    target/thumbv7em-none-eabihf/release/oxcc.hex

Debugging

In one terminal, start openocd:

openocd -f board/stm32f7discovery.cfg

In the OxCC terminal, use the runner to start a gdb session:

cargo run

License

Licensed under either of

at your option.