Compare commits
11 Commits
cf56cdd993
...
pwm-testin
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
72d89790c3
|
||
|
|
3ab3c2fe13
|
||
|
|
a33f71217c
|
||
| 7035780beb | |||
|
|
e82effb2e4
|
||
| 6a886651fc | |||
|
|
191642d76a | ||
| c1e4935d22 | |||
|
|
e692f922a4
|
||
| ce02b38ff6 | |||
| 993a0bcd3e |
19
README.md
19
README.md
@@ -61,6 +61,16 @@ 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
|
||||
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
|
||||
|
||||
Install [probe-rs](https://probe.rs/docs/getting-started/installation/) first.
|
||||
@@ -80,15 +90,6 @@ available for persistent flashing.
|
||||
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.
|
||||
|
||||
### 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
|
||||
|
||||
Assuming a working debug connection to your VA416xx board, you can debug using VS Code with
|
||||
|
||||
@@ -6,7 +6,7 @@ edition = "2021"
|
||||
[dependencies]
|
||||
cortex-m = "0.7"
|
||||
cortex-m-rt = "0.7"
|
||||
defmt-rtt = "0.4"
|
||||
defmt-rtt = "1"
|
||||
defmt = "1"
|
||||
panic-probe = { version = "1", features = ["defmt"] }
|
||||
crc = "3"
|
||||
|
||||
@@ -8,12 +8,11 @@ cortex-m = "0.7"
|
||||
cortex-m-rt = "0.7"
|
||||
cfg-if = "1"
|
||||
embedded-io = "0.6"
|
||||
embedded-can = "0.4"
|
||||
embedded-hal-async = "1"
|
||||
embedded-io-async = "0.6"
|
||||
|
||||
heapless = "0.8"
|
||||
defmt-rtt = "0.4"
|
||||
defmt-rtt = "1"
|
||||
defmt = "1"
|
||||
panic-probe = { version = "1", features = ["print-defmt"] }
|
||||
static_cell = "2"
|
||||
@@ -21,7 +20,7 @@ critical-section = "1"
|
||||
ringbuf = { version = "0.4", default-features = false }
|
||||
|
||||
nb = "1"
|
||||
embassy-sync = "0.6"
|
||||
embassy-sync = "0.7"
|
||||
embassy-time = "0.4"
|
||||
embassy-executor = { version = "0.7", features = [
|
||||
"arch-cortex-m",
|
||||
|
||||
@@ -5,7 +5,7 @@ edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
cortex-m = { version = "0.7", features = ["critical-section-single-core"] }
|
||||
defmt-rtt = "0.4"
|
||||
defmt-rtt = "1"
|
||||
defmt = "1"
|
||||
panic-probe = { version = "1", features = ["defmt"] }
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ edition = "2021"
|
||||
cortex-m = { version = "0.7", features = ["critical-section-single-core"] }
|
||||
cortex-m-rt = "0.7"
|
||||
critical-section = "1"
|
||||
defmt-rtt = "0.4"
|
||||
defmt-rtt = "1"
|
||||
defmt = "1"
|
||||
panic-probe = { version = "1", features = ["defmt"] }
|
||||
embedded-hal = "1"
|
||||
|
||||
44
examples/simple/examples/pwm_test.rs
Normal file
44
examples/simple/examples/pwm_test.rs
Normal file
@@ -0,0 +1,44 @@
|
||||
//! 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();
|
||||
}
|
||||
}
|
||||
@@ -6,15 +6,15 @@ edition = "2021"
|
||||
[dependencies]
|
||||
cortex-m = "0.7"
|
||||
embedded-io = "0.6"
|
||||
defmt-rtt = "0.4"
|
||||
defmt-rtt = "1"
|
||||
defmt = "1"
|
||||
panic-probe = { version = "1", features = ["defmt"] }
|
||||
static_cell = "2"
|
||||
satrs = { version = "0.3.0-alpha.0", default-features = false }
|
||||
satrs = { version = "0.3.0-alpha.1", default-features = false }
|
||||
ringbuf = { version = "0.4", default-features = false }
|
||||
once_cell = { version = "1", default-features = false, features = ["critical-section"] }
|
||||
spacepackets = { version = "0.13", default-features = false, features = ["defmt"] }
|
||||
cobs = { version = "0.3", default-features = false }
|
||||
spacepackets = { version = "0.15", default-features = false, features = ["defmt"] }
|
||||
cobs = { version = "0.4", default-features = false }
|
||||
|
||||
va416xx-hal = { version = "0.5", features = ["va41630", "defmt"], path = "../va416xx-hal" }
|
||||
|
||||
|
||||
@@ -347,7 +347,7 @@ mod app {
|
||||
defmt::warn!("PUS TC error: {}", pus_tc.unwrap_err());
|
||||
return;
|
||||
}
|
||||
let (pus_tc, _) = pus_tc.unwrap();
|
||||
let pus_tc = pus_tc.unwrap();
|
||||
let mut write_and_send = |tm: &PusTmCreator| {
|
||||
let written_size = tm.write_to_bytes(cx.local.verif_buf).unwrap();
|
||||
cx.shared.tm_prod.lock(|prod| {
|
||||
@@ -356,18 +356,18 @@ mod app {
|
||||
.push_slice(&cx.local.verif_buf[0..written_size]);
|
||||
});
|
||||
};
|
||||
let token = cx.local.verif_reporter.add_tc(&pus_tc);
|
||||
let (tm, accepted_token) = cx
|
||||
let request_id = VerificationReportCreator::read_request_id_from_tc(&pus_tc);
|
||||
let tm = cx
|
||||
.local
|
||||
.verif_reporter
|
||||
.acceptance_success(cx.local.src_data_buf, token, 0, 0, &[])
|
||||
.acceptance_success(cx.local.src_data_buf, &request_id, 0, 0, &[])
|
||||
.expect("acceptance success failed");
|
||||
write_and_send(&tm);
|
||||
|
||||
let (tm, started_token) = cx
|
||||
let tm = cx
|
||||
.local
|
||||
.verif_reporter
|
||||
.start_success(cx.local.src_data_buf, accepted_token, 0, 0, &[])
|
||||
.start_success(cx.local.src_data_buf, &request_id, 0, 0, &[])
|
||||
.expect("acceptance success failed");
|
||||
write_and_send(&tm);
|
||||
|
||||
@@ -387,7 +387,7 @@ mod app {
|
||||
let tm = cx
|
||||
.local
|
||||
.verif_reporter
|
||||
.completion_success(cx.local.src_data_buf, started_token, 0, 0, &[])
|
||||
.completion_success(cx.local.src_data_buf, &request_id, 0, 0, &[])
|
||||
.expect("completion success failed");
|
||||
write_and_send(&tm);
|
||||
};
|
||||
@@ -405,7 +405,7 @@ mod app {
|
||||
let tm = cx
|
||||
.local
|
||||
.verif_reporter
|
||||
.completion_success(cx.local.src_data_buf, started_token, 0, 0, &[])
|
||||
.completion_success(cx.local.src_data_buf, &request_id, 0, 0, &[])
|
||||
.expect("completion success failed");
|
||||
write_and_send(&tm);
|
||||
} else if pus_tc.service() == PusServiceId::MemoryManagement as u8 {
|
||||
@@ -414,7 +414,7 @@ mod app {
|
||||
.verif_reporter
|
||||
.step_success(
|
||||
cx.local.src_data_buf,
|
||||
&started_token,
|
||||
&request_id,
|
||||
0,
|
||||
0,
|
||||
&[],
|
||||
@@ -460,7 +460,7 @@ mod app {
|
||||
let tm = cx
|
||||
.local
|
||||
.verif_reporter
|
||||
.completion_success(cx.local.src_data_buf, started_token, 0, 0, &[])
|
||||
.completion_success(cx.local.src_data_buf, &request_id, 0, 0, &[])
|
||||
.expect("completion success failed");
|
||||
write_and_send(&tm);
|
||||
defmt::info!("NVM operation done");
|
||||
|
||||
@@ -11,7 +11,7 @@ keywords = ["no-std", "hal", "cortex-m", "vorago", "va416xx"]
|
||||
categories = ["aerospace", "embedded", "no-std", "hardware-support"]
|
||||
|
||||
[dependencies]
|
||||
vorago-shared-periphs = { git = "https://egit.irs.uni-stuttgart.de/rust/vorago-shared-periphs.git", features = ["vor4x"] }
|
||||
vorago-shared-periphs = { git = "https://egit.irs.uni-stuttgart.de/rust/vorago-shared-periphs.git", rev = "c8e475cbba820a4b235b46f3d284e23d72396855", features = ["vor4x"] }
|
||||
va416xx-hal = { path = "../va416xx-hal" }
|
||||
|
||||
[features]
|
||||
|
||||
@@ -13,9 +13,9 @@ categories = ["embedded", "no-std", "hardware-support"]
|
||||
[dependencies]
|
||||
cortex-m = { version = "0.7", features = ["critical-section-single-core"] }
|
||||
va416xx = { version = "0.4", features = ["critical-section"], default-features = false }
|
||||
derive-mmio = { version = "0.4", git = "https://github.com/knurling-rs/derive-mmio.git" }
|
||||
derive-mmio = { git = "https://github.com/knurling-rs/derive-mmio.git", version = "0.6" }
|
||||
static_assertions = "1.1"
|
||||
vorago-shared-periphs = { git = "https://egit.irs.uni-stuttgart.de/rust/vorago-shared-periphs.git", features = ["vor4x"] }
|
||||
vorago-shared-periphs = { git = "https://egit.irs.uni-stuttgart.de/rust/vorago-shared-periphs.git", rev = "c8e475cbba820a4b235b46f3d284e23d72396855", features = ["vor4x"] }
|
||||
|
||||
libm = "0.2"
|
||||
nb = "1"
|
||||
@@ -26,10 +26,10 @@ bitbybit = "1.3"
|
||||
arbitrary-int = "1.3"
|
||||
fugit = "0.3"
|
||||
embedded-can = "0.4"
|
||||
embassy-sync = "0.6"
|
||||
embassy-sync = "0.7"
|
||||
thiserror = { version = "2", default-features = false }
|
||||
|
||||
defmt = { version = "0.3", optional = true }
|
||||
defmt = { version = "1", optional = true }
|
||||
|
||||
[features]
|
||||
default = ["rt", "revb"]
|
||||
|
||||
@@ -357,10 +357,10 @@ impl defmt::Format for DiagnosticRegister {
|
||||
#[mmio(const_inner)]
|
||||
#[repr(C)]
|
||||
pub struct Can {
|
||||
#[mmio(inner)]
|
||||
#[mmio(Inner)]
|
||||
cmbs: [CanMsgBuf; 15],
|
||||
/// Hidden CAN message buffer. Only allowed to be used internally by the peripheral.
|
||||
#[mmio(inner)]
|
||||
#[mmio(Inner)]
|
||||
_hcmb: CanMsgBuf,
|
||||
control: Control,
|
||||
timing: TimingConfig,
|
||||
|
||||
@@ -8,6 +8,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
## [unreleased]
|
||||
|
||||
## [v0.4.1] 2025-07-22
|
||||
|
||||
defmt v1
|
||||
|
||||
## [v0.4.0] 2025-02-18
|
||||
|
||||
- Re-generated PAC with `svd2rust` v0.35.0 and added optional `defmt` and `Debug` implementations
|
||||
@@ -32,3 +36,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
Related issue: https://github.com/rust-embedded/svd2rust/issues/557
|
||||
Clippy is disabled in CI/CD for now.
|
||||
- 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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "va416xx"
|
||||
version = "0.4.0"
|
||||
version = "0.4.1"
|
||||
authors = ["Robin Mueller <muellerr@irs.uni-stuttgart.de>"]
|
||||
edition = "2021"
|
||||
description = "PAC for the Vorago VA416xx family of MCUs"
|
||||
@@ -16,7 +16,7 @@ categories = ["embedded", "no-std", "hardware-support"]
|
||||
cortex-m = "0.7"
|
||||
vcell = "0.1.3"
|
||||
|
||||
defmt = { version = "0.3", optional = true }
|
||||
defmt = { version = "1", optional = true }
|
||||
critical-section = { version = "1", optional = true }
|
||||
|
||||
[dependencies.cortex-m-rt]
|
||||
|
||||
Reference in New Issue
Block a user