-
Notifications
You must be signed in to change notification settings - Fork 195
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
Implement periodic wake up for esp-lp-hal #2145
Comments
By sacrificing my soul to some C demons I was able to link Lines 60 to 96 in e7dab29
|
I tried removing the vector thing from the assembler code, it did not work either... I'm out of options :( I also tried modifying the fn ulp_lp_core_run(wakeup_src: LpCoreWakeupSource) {
let lp_aon = unsafe { &*pac::LP_AON::PTR };
let pmu = unsafe { &*pac::PMU::PTR };
let lp_peri = unsafe { &*pac::LP_PERI::PTR };
// Enable LP-Core
lp_aon.lpcore().modify(|_, w| w.disable().clear_bit());
// Allow LP core to access LP memory during sleep
lp_aon
.lpbus()
.modify(|_, w| w.fast_mem_mux_sel().clear_bit());
lp_aon
.lpbus()
.modify(|_, w| w.fast_mem_mux_sel_update().set_bit());
// Enable stall at sleep request - IDK
//pmu.lp_cpu_pwr0()
// .modify(|_, w| w.lp_cpu_slp_stall_en().set_bit());
// Enable reset after wake-up
pmu.lp_cpu_pwr0()
.modify(|_, w| w.lp_cpu_slp_reset_en().set_bit());
// Set wake-up sources
let mut src = match wakeup_src {
LpCoreWakeupSource::HpCpu => 0x01,
};
src |= 0x10; // LP_TIMER
pmu.lp_cpu_pwr1()
.modify(|_, w| unsafe { w.lp_cpu_wakeup_en().bits(src) });
// Enable JTAG debugging
lp_peri
.cpu()
.modify(|_, w| w.lpcore_dbgm_unavaliable().clear_bit());
// wake up
match wakeup_src {
LpCoreWakeupSource::HpCpu => {
pmu.hp_lp_cpu_comm().write(|w| w.hp_trigger_lp().set_bit());
}
}
} |
Motivations
It's an essential feature to use the lp core
This is half a feature request half a very uncooked draft to implement it (If there is a better place to post it, let me know), as I tried following esp-idf code and implemented it in rust. While it's a hacky way for now, first I want it to work, then I can think of ways to implement it for esp-lp-hal. I'm pretty sure any more knowledgeable person will be able to catch the issue. I revised the code twice, checked every "I'm not sure" comment three times, with no solution. I left links to the reference code for easier debugging, I hope it helps
Well here is the code, only for the esp32c6 (for now)
wakeup.rs
sleep.rs
The text was updated successfully, but these errors were encountered: