-
Notifications
You must be signed in to change notification settings - Fork 32
Switched to embassy_time 0.4.0 and embassy_executor 0.7.0 #95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
src/embassy/time_driver_tim.rs
Outdated
return false; | ||
} | ||
|
||
// Write the CCR value regardless of whether we're going to enable it now or not. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The indentation should be fixed here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, thank you. Used an auto formatter.
I @joao404 Nice changes! I have tested on CH32V003 and a basic blinky and it freezes after a couple of seconds: Example from ch32-hal-template: #![no_std]
#![no_main]
#![feature(type_alias_impl_trait)]
use embassy_executor::Spawner;
use embassy_time::Timer;
use ch32_hal::gpio::{AnyPin, Level, Output, Pin};
use ch32_hal::println;
use panic_halt as _;
#[embassy_executor::task]
async fn blink(pin: AnyPin, interval_ms: u64) {
let mut led = Output::new(pin, Level::Low, Default::default());
loop {
led.set_high();
Timer::after_millis(interval_ms).await;
led.set_low();
Timer::after_millis(interval_ms).await;
}
}
#[embassy_executor::main(entry = "qingke_rt::entry")]
async fn main(spawner: Spawner) -> ! {
ch32_hal::debug::SDIPrint::enable();
let p = ch32_hal::init(ch32_hal::Config::default());
// Adjust the LED GPIO according to your board
spawner.spawn(blink(p.PC4.degrade(), 1000)).unwrap();
loop {
Timer::after_millis(1000).await;
println!("tick");
}
} Output:
Edit: I have tried on a CH32V307 and it seems to work (ran for 2 hours before I stopped). Edit 2: In the case of the V003 freeze: wlink regs
wlink status
`mepc : 0x00000992`
|
Hi, unfortunately I do not have a wch-link to try it out myself. I thought I could use my ST-Link and did not order one. I have a ch32v307vct6 dev board and use wchisp (which works great by the way, thank you for providing it). I tried it using a blocking and async UartTx connection and had no problem for 10 minutes(then I stopped testing). I will try to find a solution with your debug information |
Ok, I see. |
If I understand documentation correctly, highest bit set means that we have an interrupt and 0x26 is number of interrupt. Compared with https://github.com/ch32-rs/ch32-data/blob/main/data/interrupts/CH32V0.yaml it should be TIM2, which has thrown interrupt. This fits to our Cargo.toml where "time-driver-tim2" is activated for ch32 hal. |
Hello,
I have adapted time_driver_tim.rs in the same manner as time_driver.rs is for stm32 in embassy repo. embassy_time with version 0.4.0 should now be possible as requested by #82