something worng with can clk calc?

This commit is contained in:
2025-05-12 12:09:49 +02:00
parent 629ba4f8f2
commit ec954fcb16
10 changed files with 195 additions and 129 deletions

View File

@ -13,7 +13,7 @@ embedded-io-async = "0.6"
heapless = "0.8"
defmt-rtt = "0.4"
defmt = "1"
panic-probe = { version = "1", features = ["defmt"] }
panic-probe = { version = "1", features = ["print-defmt"] }
static_cell = "2"
critical-section = "1"
ringbuf = { version = "0.4", default-features = false }

View File

@ -29,7 +29,10 @@ async fn main(_spawner: Spawner) {
.unwrap();
// Safety: Only called once here.
va416xx_embassy::init(dp.tim15, dp.tim14, &clocks);
let clk_config = ClockConfig::from_bitrate_and_segments(&clocks, 250.kHz(), 16, 4, 4).unwrap();
defmt::info!("creating CAN peripheral driver");
defmt::info!("clocks: {}", clocks);
let clk_config = ClockConfig::from_bitrate_and_segments(&clocks, 250.kHz(), 16, 4, 4)
.expect("CAN clock config error");
let mut can = Can::new(dp.can0, clk_config);
can.set_loopback(true);
can.set_bufflock(true);
@ -48,6 +51,7 @@ async fn main(_spawner: Spawner) {
tx.transmit_frame(send_frame).unwrap();
let _frame = nb::block!(rx.receive(true)).expect("invalid CAN rx state");
defmt::info!("received CAN frame with data");
loop {}
}
#[interrupt]