rtic: rtic-monotonic panics
I managed to get monotonic panic. TIM3 on stm32g030k6 should be 16bit timer.
embassy-stm32 = { git = "https://github.com/embassy-rs/embassy.git", rev = "000b022ae2e52e9abaabbd10110b4c583fe4344c", features = [
"defmt",
"stm32g030k6",
"unstable-pac",
"exti",
] }
rtic-monotonics = { version = "2.0.1", features = [
"stm32g030k6",
"stm32_tim3",
] }
rtic-sync = "1.3"
rtic = { version = "2.1", features = ["thumbv6-backend"] }
15439 INFO periodic
└─ ptubasehub::app::input_events::{async_fn#0} @ src/main.rs:176
33074 INFO periodic
└─ ptubasehub::app::input_events::{async_fn#0} @ src/main.rs:176
32779 ERROR panicked at /Users/andres/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rtic-monotonics-2.0.1/src/stm32.rs:338:1:
Monotonic must have missed an interrupt!
└─ panic_probe::print_defmt::print @ /Users/andres/.cargo/registry/src/index.crates.io-6f17d22bba15001f/panic-probe-0.3.1/src/lib.rs:104
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 46 (34 by maintainers)
@Finomnis kudos for figuring this out.
I’ll wait with merging #989 until confirmed then.
Ah now I fully understand why it occurs. It writes an accidental 0 to interrupts just triggered. And removing the enable_timer call removes the nondeterministic interrupts.
The monotonic implementation I made is out of source tree of RTIC in my own project. Due to our hardware design we needed 21 PWM outputs and a lot of ADCs, and this only allowed for TIM20 to be used for monotonic. It uses 3 capture compare units instead of the UIF due to UIF being a different interrupt on the STM32G4 than CC irq, which would cause it call two interrupt handlers. It uses the https://github.com/stm32-rs/stm32g4xx-hal . So I’ll change my snippet to always write all bits to 1 except the one I want to clear. So submitting this snippet wouldn’t really map nicely with the other stm32 monotonic implementations.