3 Commits

Author SHA1 Message Date
cf56cdd993 small improvement 2025-05-13 16:50:15 +02:00
efe62ea39e improve docs 2025-05-13 16:49:32 +02:00
72aae605d8 CAN peripheral support 2025-05-13 16:35:23 +02:00
13 changed files with 38 additions and 90 deletions

View File

@@ -61,16 +61,6 @@ You can then adapt the files in `.vscode` to your needs.
You can use CLI or VS Code for flashing, running and debugging. In any case, take You can use CLI or VS Code for flashing, running and debugging. In any case, take
care of installing the pre-requisites first. care of installing the pre-requisites first.
### Pre-Requisites
1. [SEGGER J-Link tools](https://www.segger.com/downloads/jlink/) installed
2. [Rust `thumbv7em-none-eaibhf` toolchain](https://doc.rust-lang.org/nightly/rustc/platform-support/thumbv7em-none-eabi.html).
Use the following command to install it:
```sh
rustup target add thumbv7em-none-eabihf
```
### Using CLI with probe-rs ### Using CLI with probe-rs
Install [probe-rs](https://probe.rs/docs/getting-started/installation/) first. Install [probe-rs](https://probe.rs/docs/getting-started/installation/) first.
@@ -90,6 +80,15 @@ available for persistent flashing.
Runner configuration is available in the `.cargo/def-config.toml` file to use `probe-rs` for Runner configuration is available in the `.cargo/def-config.toml` file to use `probe-rs` for
convenience. `probe-rs` is also able to process and display `defmt` strings directly. convenience. `probe-rs` is also able to process and display `defmt` strings directly.
### Pre-Requisites
1. [SEGGER J-Link tools](https://www.segger.com/downloads/jlink/) installed
2. [gdb-multiarch](https://packages.debian.org/sid/gdb-multiarch) or similar
cross-architecture debugger installed. All commands here assume `gdb-multiarch`.
### Using CLI
### Using VS Code ### Using VS Code
Assuming a working debug connection to your VA416xx board, you can debug using VS Code with Assuming a working debug connection to your VA416xx board, you can debug using VS Code with

View File

@@ -6,7 +6,7 @@ edition = "2021"
[dependencies] [dependencies]
cortex-m = "0.7" cortex-m = "0.7"
cortex-m-rt = "0.7" cortex-m-rt = "0.7"
defmt-rtt = "1" defmt-rtt = "0.4"
defmt = "1" defmt = "1"
panic-probe = { version = "1", features = ["defmt"] } panic-probe = { version = "1", features = ["defmt"] }
crc = "3" crc = "3"

View File

@@ -8,11 +8,12 @@ cortex-m = "0.7"
cortex-m-rt = "0.7" cortex-m-rt = "0.7"
cfg-if = "1" cfg-if = "1"
embedded-io = "0.6" embedded-io = "0.6"
embedded-can = "0.4"
embedded-hal-async = "1" embedded-hal-async = "1"
embedded-io-async = "0.6" embedded-io-async = "0.6"
heapless = "0.8" heapless = "0.8"
defmt-rtt = "1" defmt-rtt = "0.4"
defmt = "1" defmt = "1"
panic-probe = { version = "1", features = ["print-defmt"] } panic-probe = { version = "1", features = ["print-defmt"] }
static_cell = "2" static_cell = "2"
@@ -20,7 +21,7 @@ critical-section = "1"
ringbuf = { version = "0.4", default-features = false } ringbuf = { version = "0.4", default-features = false }
nb = "1" nb = "1"
embassy-sync = "0.7" embassy-sync = "0.6"
embassy-time = "0.4" embassy-time = "0.4"
embassy-executor = { version = "0.7", features = [ embassy-executor = { version = "0.7", features = [
"arch-cortex-m", "arch-cortex-m",

View File

@@ -5,7 +5,7 @@ edition = "2021"
[dependencies] [dependencies]
cortex-m = { version = "0.7", features = ["critical-section-single-core"] } cortex-m = { version = "0.7", features = ["critical-section-single-core"] }
defmt-rtt = "1" defmt-rtt = "0.4"
defmt = "1" defmt = "1"
panic-probe = { version = "1", features = ["defmt"] } panic-probe = { version = "1", features = ["defmt"] }

View File

@@ -7,7 +7,7 @@ edition = "2021"
cortex-m = { version = "0.7", features = ["critical-section-single-core"] } cortex-m = { version = "0.7", features = ["critical-section-single-core"] }
cortex-m-rt = "0.7" cortex-m-rt = "0.7"
critical-section = "1" critical-section = "1"
defmt-rtt = "1" defmt-rtt = "0.4"
defmt = "1" defmt = "1"
panic-probe = { version = "1", features = ["defmt"] } panic-probe = { version = "1", features = ["defmt"] }
embedded-hal = "1" embedded-hal = "1"

View File

@@ -1,44 +0,0 @@
//! Simple PWM example
//!
//! Outputs a PWM waveform on pin PG2.
#![no_main]
#![no_std]
use cortex_m_rt::entry;
use embedded_hal::pwm::SetDutyCycle;
// Import panic provider.
use panic_probe as _;
// Import logger.
use defmt_rtt as _;
use simple_examples::peb1;
use va416xx_hal::{
clock::ClockConfigurator,
pac,
pins::PinsG,
prelude::*,
pwm::{get_duty_from_percent, PwmPin},
};
#[entry]
fn main() -> ! {
defmt::println!("-- VA108xx PWM example application--");
let dp = pac::Peripherals::take().unwrap();
// Use the external clock connected to XTAL_N.
let clocks = ClockConfigurator::new(dp.clkgen)
.xtal_n_clk_with_src_freq(peb1::EXTCLK_FREQ)
.freeze()
.unwrap();
let pinsg = PinsG::new(dp.portg);
let mut pwm = PwmPin::new(pinsg.pg2, dp.tim9, &clocks, 10.kHz()).unwrap();
//let mut delay_timer = CountdownTimer::new(dp.tim0, &clocks);
//let mut current_duty_cycle = 0.0;
pwm.set_duty_cycle(get_duty_from_percent(0.5)).unwrap();
pwm.enable();
// Delete type information, increased code readibility for the rest of the code
loop {
cortex_m::asm::nop();
}
}

View File

@@ -6,15 +6,15 @@ edition = "2021"
[dependencies] [dependencies]
cortex-m = "0.7" cortex-m = "0.7"
embedded-io = "0.6" embedded-io = "0.6"
defmt-rtt = "1" defmt-rtt = "0.4"
defmt = "1" defmt = "1"
panic-probe = { version = "1", features = ["defmt"] } panic-probe = { version = "1", features = ["defmt"] }
static_cell = "2" static_cell = "2"
satrs = { version = "0.3.0-alpha.1", default-features = false } satrs = { version = "0.3.0-alpha.0", default-features = false }
ringbuf = { version = "0.4", default-features = false } ringbuf = { version = "0.4", default-features = false }
once_cell = { version = "1", default-features = false, features = ["critical-section"] } once_cell = { version = "1", default-features = false, features = ["critical-section"] }
spacepackets = { version = "0.15", default-features = false, features = ["defmt"] } spacepackets = { version = "0.13", default-features = false, features = ["defmt"] }
cobs = { version = "0.4", default-features = false } cobs = { version = "0.3", default-features = false }
va416xx-hal = { version = "0.5", features = ["va41630", "defmt"], path = "../va416xx-hal" } va416xx-hal = { version = "0.5", features = ["va41630", "defmt"], path = "../va416xx-hal" }

View File

@@ -347,7 +347,7 @@ mod app {
defmt::warn!("PUS TC error: {}", pus_tc.unwrap_err()); defmt::warn!("PUS TC error: {}", pus_tc.unwrap_err());
return; return;
} }
let pus_tc = pus_tc.unwrap(); let (pus_tc, _) = pus_tc.unwrap();
let mut write_and_send = |tm: &PusTmCreator| { let mut write_and_send = |tm: &PusTmCreator| {
let written_size = tm.write_to_bytes(cx.local.verif_buf).unwrap(); let written_size = tm.write_to_bytes(cx.local.verif_buf).unwrap();
cx.shared.tm_prod.lock(|prod| { cx.shared.tm_prod.lock(|prod| {
@@ -356,18 +356,18 @@ mod app {
.push_slice(&cx.local.verif_buf[0..written_size]); .push_slice(&cx.local.verif_buf[0..written_size]);
}); });
}; };
let request_id = VerificationReportCreator::read_request_id_from_tc(&pus_tc); let token = cx.local.verif_reporter.add_tc(&pus_tc);
let tm = cx let (tm, accepted_token) = cx
.local .local
.verif_reporter .verif_reporter
.acceptance_success(cx.local.src_data_buf, &request_id, 0, 0, &[]) .acceptance_success(cx.local.src_data_buf, token, 0, 0, &[])
.expect("acceptance success failed"); .expect("acceptance success failed");
write_and_send(&tm); write_and_send(&tm);
let tm = cx let (tm, started_token) = cx
.local .local
.verif_reporter .verif_reporter
.start_success(cx.local.src_data_buf, &request_id, 0, 0, &[]) .start_success(cx.local.src_data_buf, accepted_token, 0, 0, &[])
.expect("acceptance success failed"); .expect("acceptance success failed");
write_and_send(&tm); write_and_send(&tm);
@@ -387,7 +387,7 @@ mod app {
let tm = cx let tm = cx
.local .local
.verif_reporter .verif_reporter
.completion_success(cx.local.src_data_buf, &request_id, 0, 0, &[]) .completion_success(cx.local.src_data_buf, started_token, 0, 0, &[])
.expect("completion success failed"); .expect("completion success failed");
write_and_send(&tm); write_and_send(&tm);
}; };
@@ -405,7 +405,7 @@ mod app {
let tm = cx let tm = cx
.local .local
.verif_reporter .verif_reporter
.completion_success(cx.local.src_data_buf, &request_id, 0, 0, &[]) .completion_success(cx.local.src_data_buf, started_token, 0, 0, &[])
.expect("completion success failed"); .expect("completion success failed");
write_and_send(&tm); write_and_send(&tm);
} else if pus_tc.service() == PusServiceId::MemoryManagement as u8 { } else if pus_tc.service() == PusServiceId::MemoryManagement as u8 {
@@ -414,7 +414,7 @@ mod app {
.verif_reporter .verif_reporter
.step_success( .step_success(
cx.local.src_data_buf, cx.local.src_data_buf,
&request_id, &started_token,
0, 0,
0, 0,
&[], &[],
@@ -460,7 +460,7 @@ mod app {
let tm = cx let tm = cx
.local .local
.verif_reporter .verif_reporter
.completion_success(cx.local.src_data_buf, &request_id, 0, 0, &[]) .completion_success(cx.local.src_data_buf, started_token, 0, 0, &[])
.expect("completion success failed"); .expect("completion success failed");
write_and_send(&tm); write_and_send(&tm);
defmt::info!("NVM operation done"); defmt::info!("NVM operation done");

View File

@@ -11,7 +11,7 @@ keywords = ["no-std", "hal", "cortex-m", "vorago", "va416xx"]
categories = ["aerospace", "embedded", "no-std", "hardware-support"] categories = ["aerospace", "embedded", "no-std", "hardware-support"]
[dependencies] [dependencies]
vorago-shared-periphs = { git = "https://egit.irs.uni-stuttgart.de/rust/vorago-shared-periphs.git", rev = "c8e475cbba820a4b235b46f3d284e23d72396855", features = ["vor4x"] } vorago-shared-periphs = { git = "https://egit.irs.uni-stuttgart.de/rust/vorago-shared-periphs.git", features = ["vor4x"] }
va416xx-hal = { path = "../va416xx-hal" } va416xx-hal = { path = "../va416xx-hal" }
[features] [features]

View File

@@ -13,9 +13,9 @@ categories = ["embedded", "no-std", "hardware-support"]
[dependencies] [dependencies]
cortex-m = { version = "0.7", features = ["critical-section-single-core"] } cortex-m = { version = "0.7", features = ["critical-section-single-core"] }
va416xx = { version = "0.4", features = ["critical-section"], default-features = false } va416xx = { version = "0.4", features = ["critical-section"], default-features = false }
derive-mmio = { git = "https://github.com/knurling-rs/derive-mmio.git", version = "0.6" } derive-mmio = { version = "0.4", git = "https://github.com/knurling-rs/derive-mmio.git" }
static_assertions = "1.1" static_assertions = "1.1"
vorago-shared-periphs = { git = "https://egit.irs.uni-stuttgart.de/rust/vorago-shared-periphs.git", rev = "c8e475cbba820a4b235b46f3d284e23d72396855", features = ["vor4x"] } vorago-shared-periphs = { git = "https://egit.irs.uni-stuttgart.de/rust/vorago-shared-periphs.git", features = ["vor4x"] }
libm = "0.2" libm = "0.2"
nb = "1" nb = "1"
@@ -26,10 +26,10 @@ bitbybit = "1.3"
arbitrary-int = "1.3" arbitrary-int = "1.3"
fugit = "0.3" fugit = "0.3"
embedded-can = "0.4" embedded-can = "0.4"
embassy-sync = "0.7" embassy-sync = "0.6"
thiserror = { version = "2", default-features = false } thiserror = { version = "2", default-features = false }
defmt = { version = "1", optional = true } defmt = { version = "0.3", optional = true }
[features] [features]
default = ["rt", "revb"] default = ["rt", "revb"]

View File

@@ -357,10 +357,10 @@ impl defmt::Format for DiagnosticRegister {
#[mmio(const_inner)] #[mmio(const_inner)]
#[repr(C)] #[repr(C)]
pub struct Can { pub struct Can {
#[mmio(Inner)] #[mmio(inner)]
cmbs: [CanMsgBuf; 15], cmbs: [CanMsgBuf; 15],
/// Hidden CAN message buffer. Only allowed to be used internally by the peripheral. /// Hidden CAN message buffer. Only allowed to be used internally by the peripheral.
#[mmio(Inner)] #[mmio(inner)]
_hcmb: CanMsgBuf, _hcmb: CanMsgBuf,
control: Control, control: Control,
timing: TimingConfig, timing: TimingConfig,

View File

@@ -8,10 +8,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
## [unreleased] ## [unreleased]
## [v0.4.1] 2025-07-22
defmt v1
## [v0.4.0] 2025-02-18 ## [v0.4.0] 2025-02-18
- Re-generated PAC with `svd2rust` v0.35.0 and added optional `defmt` and `Debug` implementations - Re-generated PAC with `svd2rust` v0.35.0 and added optional `defmt` and `Debug` implementations
@@ -36,7 +32,3 @@ defmt v1
Related issue: https://github.com/rust-embedded/svd2rust/issues/557 Related issue: https://github.com/rust-embedded/svd2rust/issues/557
Clippy is disabled in CI/CD for now. Clippy is disabled in CI/CD for now.
- Initial release - Initial release
[unreleased]: https://egit.irs.uni-stuttgart.de/rust/va416xx-rs/compare/va416xx-v0.4.1...HEAD
[v0.4.1]: https://egit.irs.uni-stuttgart.de/rust/va416xx-rs/compare/va416xx-v0.4.0...va416xx-v0.4.1
[v0.4.0]: https://egit.irs.uni-stuttgart.de/rust/va416xx-rs/compare/va416xx-v0.3.0...va416xx-v0.4.0

View File

@@ -1,6 +1,6 @@
[package] [package]
name = "va416xx" name = "va416xx"
version = "0.4.1" version = "0.4.0"
authors = ["Robin Mueller <muellerr@irs.uni-stuttgart.de>"] authors = ["Robin Mueller <muellerr@irs.uni-stuttgart.de>"]
edition = "2021" edition = "2021"
description = "PAC for the Vorago VA416xx family of MCUs" description = "PAC for the Vorago VA416xx family of MCUs"
@@ -16,7 +16,7 @@ categories = ["embedded", "no-std", "hardware-support"]
cortex-m = "0.7" cortex-m = "0.7"
vcell = "0.1.3" vcell = "0.1.3"
defmt = { version = "1", optional = true } defmt = { version = "0.3", optional = true }
critical-section = { version = "1", optional = true } critical-section = { version = "1", optional = true }
[dependencies.cortex-m-rt] [dependencies.cortex-m-rt]