You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am fairly new to Rust embedded and completely new to embassy so please let me know if this is not the right place for this issue. I'm also happy to try out anything you suggest may work. Thanks in advance for your help.
Description
Using can::frame::FdFrame as the inner type causes my debug probe to disconnect after flashing. Using probe-rs attach after the disconnect shows that the firmware was successfully flashed and is running but the probe was disconnected when running cargo run --bin test_can --release.
With reference to the minimal example below. Setting type ChannelInner = TestWorking;
Setting type ChannelInner = TestNotWorking; causes the following behaviour
$ cargo run --bin test_can --release
Finished `release` profile [optimized + debuginfo] target(s) in 0.06s
Running `probe-rs run --chip STM32G474RE --connect-under-reset target/thumbv7em-none-eabi/release/test_can`
Erasing ✔ 100% [####################] 20.00 KiB @ 64.76 KiB/s (took 0s)
Programming ✔ 100% [####################] 20.00 KiB @ 28.12 KiB/s (took 1s) Finished in 0.71s
WARN probe_rs::probe::stlink: send_jtag_command 242 failed: SwdApFault
Error: Error communicating with the probe.
Caused by:
0: An ARM specific error occurred.
1: The debug probe encountered an error.
2: An error which is specific to the debug probe in use occurred.
3: Command failed with status SwdApFault.
then after resetting the board and running probe-rs attach
As a work around, the probe remains connected if I
physically disconnect the probe from the board
hold the reset down and connect the probe
do cargo run --bin test_can --release whilst still holding reset down
$ cargo run --bin test_can --release
Finished `release` profile [optimized + debuginfo] target(s) in 0.04s
Running `probe-rs run --chip STM32G474RE --connect-under-reset target/thumbv7em-none-eabi/release/test_can`
WARN probe_rs::session: Could not clear all hardware breakpoints: An ARM specific error occurred.
Caused by:
A timeout occurred during an operation.
Error: Connecting to the chip was unsuccessful.
Caused by:
Timeout while attaching to target under reset. This can happen if the target is not responding to the reset sequence. Ensure the chip's reset pin is connected, or try attaching without reset (`connectUnderReset = false` for DAP Clients, or remove `connect-under-reset` option from CLI options.).
release reset button and flash again with cargo run --bin test_can --release
The probe should remain connected with type ChannelInner = TestNotWorking; when cargo run --bin test_can --release is run.
Minimal Example
src/bin/test_can.rs
#![no_std]#![no_main]use defmt::*;use embassy_executor::Spawner;use embassy_stm32::Config;use embassy_stm32::can;use embassy_time::Timer;use embassy_sync::blocking_mutex::raw::ThreadModeRawMutex;use embassy_sync::channel::Channel;use{defmt_rtt as _, panic_probe as _};// Define some types to make it easier to test the errortypeTestNotWorking = can::frame::FdFrame;// This doesn't worktypeTestWorking = &'static[u8];// This does worktypeChannelInner = TestNotWorking;// Change this line to trial the working vs non-working typestypeCanChannel = Channel<ThreadModeRawMutex,ChannelInner,64>;staticCHANNEL:CanChannel = Channel::new();#[embassy_executor::main]asyncfnmain(_spawner:Spawner){let _peripherals = embassy_stm32::init(Config::default());unwrap!(_spawner.spawn(serial_heartbeat()));// just for info// ERROR: This line causes probe disconnect when using can::frame::FdFrame (TestNotWorking) typeCHANNEL.send(ChannelInner::make_it()).await;//}/// Spam the serial line #[embassy_executor::task]asyncfnserial_heartbeat(){loop{info!("Boop");Timer::after_millis(1000).await;}}// "Constructor" traittraitMakeIt{fnmake_it() -> Self;}implMakeItforTestNotWorking{fnmake_it() -> Self{
can::frame::FdFrame::new_standard(0,&[0asu8;8]).unwrap()}}implMakeItforTestWorking{fnmake_it() -> Self{staticTEST_DATA:[u8;8] = [0,1,2,3,4,5,6,7];&TEST_DATA}}
.cargo/config.toml
[target.'cfg(all(target_arch="arm",target_os="none"))']
# replace STM32G071C8Rx with your chip as listed in `probe-rs chip list`runner = "probe-rs run --chip STM32G474RE --connect-under-reset"
[build]
target = "thumbv7em-none-eabi"
[env]
DEFMT_LOG = "trace"
Cargo.toml
[package]
name = "demo"version = "0.1.0"edition = "2021"publish = false
[dependencies]
embassy-executor = {version="0.7.0", features = ["arch-cortex-m", "executor-thread", "defmt"] }
embassy-futures = "0.1.1"embassy-stm32 = { version = "0.2.0", features = [
"defmt",
"time-driver-any",
"stm32g474re",
"memory-x",
"unstable-pac",
"exti",
] }
embassy-sync = { version = "0.6.1", features = ["defmt"]}
embassy-time = { version = "0.4.0", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"]}
defmt = "0.3.10"defmt-rtt = "0.4.1"cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] }
cortex-m-rt = "0.7.0"embedded-hal = "1.0.0"embedded-can = { version = "0.4" }
panic-probe = { version = "0.3", features = ["print-defmt"] }
static_cell = "2.0.0"heapless = "0.7.0"postcard = {version="1.1.1"}
[profile.release]
debug = 2
Preamble
I am fairly new to Rust embedded and completely new to embassy so please let me know if this is not the right place for this issue. I'm also happy to try out anything you suggest may work. Thanks in advance for your help.
Description
Using
can::frame::FdFrame
as the inner type causes my debug probe to disconnect after flashing. Usingprobe-rs attach
after the disconnect shows that the firmware was successfully flashed and is running but the probe was disconnected when runningcargo run --bin test_can --release
.With reference to the minimal example below. Setting
type ChannelInner = TestWorking;
Setting
type ChannelInner = TestNotWorking;
causes the following behaviourthen after resetting the board and running
probe-rs attach
As a work around, the probe remains connected if I
cargo run --bin test_can --release
whilst still holding reset downcargo run --bin test_can --release
Expected Behaviour
The probe should remain connected with
type ChannelInner = TestNotWorking;
whencargo run --bin test_can --release
is run.Minimal Example
src/bin/test_can.rs
.cargo/config.toml
Cargo.toml
build.rs
Environment
host: Ubuntu 24.04
target: NUCLEO-G474RE
The text was updated successfully, but these errors were encountered: