Compare commits

...

2 Commits

Author SHA1 Message Date
Dario Nieuwenhuis
b49bc449d7 repro on f4. 2023-05-03 22:52:59 +02:00
Dario Nieuwenhuis
a21a2901ac hangs. 2023-05-02 22:45:54 +02:00
3 changed files with 15 additions and 8 deletions

View File

@ -3,7 +3,7 @@ build-std = ["core"]
build-std-features = ["panic_immediate_abort"]
[target.'cfg(all(target_arch = "arm", target_os = "none"))']
runner = "teleprobe client run --target bluepill-stm32f103c8 --elf"
runner = "teleprobe client run --target nucleo-stm32f429zi --elf"
#runner = "teleprobe local run --chip STM32F103C8 --elf"
rustflags = [

View File

@ -9,7 +9,11 @@ fn main() -> Result<(), Box<dyn Error>> {
println!("cargo:rustc-link-arg-bins=--nmagic");
// too little RAM to run from RAM.
if cfg!(any(feature = "stm32f103c8", feature = "stm32c031c6")) {
if cfg!(any(
feature = "stm32f429zi",
feature = "stm32f103c8",
feature = "stm32c031c6"
)) {
println!("cargo:rustc-link-arg-bins=-Tlink.x");
println!("cargo:rerun-if-changed=link.x");
} else {

View File

@ -127,7 +127,7 @@ async fn main(spawner: Spawner) {
let mut config = Config::default();
// this is the fastest we can go without tuning RCC
// some chips have default pclk=8mhz, and uart can run at max pclk/16
config.baudrate = 500_000;
config.baudrate = 1_000_000;
config.data_bits = DataBits::DataBits8;
config.stop_bits = StopBits::STOP1;
config.parity = Parity::ParityNone;
@ -154,7 +154,7 @@ async fn transmit_task(mut tx: UartTx<'static, board::Uart, board::TxDma>) {
let mut i: u8 = 0;
loop {
let mut buf = [0; 256];
let mut buf = [0; 32];
let len = 1 + (rng.next_u32() as usize % buf.len());
for b in &mut buf[..len] {
*b = i;
@ -162,7 +162,9 @@ async fn transmit_task(mut tx: UartTx<'static, board::Uart, board::TxDma>) {
}
tx.write(&buf[..len]).await.unwrap();
Timer::after(Duration::from_micros((rng.next_u32() % 1000) as _)).await;
info!("sent {=usize}", len);
Timer::after(Duration::from_micros((rng.next_u32() % 500) as _)).await;
}
}
@ -175,7 +177,7 @@ async fn receive_task(mut rx: RingBufferedUartRx<'static, board::Uart, board::Rx
let mut i = 0;
let mut expected = 0;
loop {
let mut buf = [0; 256];
let mut buf = [0; 32];
let max_len = 1 + (rng.next_u32() as usize % buf.len());
let received = match rx.read(&mut buf[..max_len]).await {
Ok(r) => r,
@ -183,6 +185,7 @@ async fn receive_task(mut rx: RingBufferedUartRx<'static, board::Uart, board::Rx
panic!("Test fail! read error: {:?}", e);
}
};
info!("received {=usize}", received);
for byte in &buf[..received] {
assert_eq!(*byte, expected);
@ -190,12 +193,12 @@ async fn receive_task(mut rx: RingBufferedUartRx<'static, board::Uart, board::Rx
}
if received < max_len {
Timer::after(Duration::from_micros((rng.next_u32() % 1000) as _)).await;
Timer::after(Duration::from_micros((rng.next_u32() % 500) as _)).await;
}
i += received;
if i > 100000 {
if i > 1000000 {
info!("Test OK!");
cortex_m::asm::bkpt();
}