diff options
| author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2022-03-29 22:13:30 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-03-29 22:13:30 +0000 |
| commit | f028b0064b1ccb8846bfbbb670d1b647b8c7c1cc (patch) | |
| tree | fad539aedf92daa624f5b9834e2515058a98dc0f | |
| parent | 1a31cda3c37c1e82e592566d683091180d1c3a08 (diff) | |
| parent | d052631118d8cc998696cf353a5ae7f5b28bbd69 (diff) | |
Merge #685
685: Fix STM32 timer interrupt bug r=Dirbaio a=chemicstry
Previously timer overflow interrupts were not firing correctly, because Update Interrupt Enable (UIE) was not set.
The timers still worked somewhat correclty, because overflow was handled together with other interrupts.
Co-authored-by: chemicstry <[email protected]>
| -rw-r--r-- | embassy-stm32/src/time_driver.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/embassy-stm32/src/time_driver.rs b/embassy-stm32/src/time_driver.rs index 5b3efca72..d936a11a2 100644 --- a/embassy-stm32/src/time_driver.rs +++ b/embassy-stm32/src/time_driver.rs | |||
| @@ -172,8 +172,11 @@ impl RtcDriver { | |||
| 172 | // Mid-way point | 172 | // Mid-way point |
| 173 | r.ccr(0).write(|w| w.set_ccr(0x8000)); | 173 | r.ccr(0).write(|w| w.set_ccr(0x8000)); |
| 174 | 174 | ||
| 175 | // Enable CC0, disable others | 175 | // Enable overflow and half-overflow interrupts |
| 176 | r.dier().write(|w| w.set_ccie(0, true)); | 176 | r.dier().write(|w| { |
| 177 | w.set_uie(true); | ||
| 178 | w.set_ccie(0, true); | ||
| 179 | }); | ||
| 177 | 180 | ||
| 178 | let irq: <T as BasicInstance>::Interrupt = core::mem::transmute(()); | 181 | let irq: <T as BasicInstance>::Interrupt = core::mem::transmute(()); |
| 179 | irq.unpend(); | 182 | irq.unpend(); |
| @@ -197,6 +200,7 @@ impl RtcDriver { | |||
| 197 | // miss interrupts. | 200 | // miss interrupts. |
| 198 | r.sr().write_value(regs::SrGp(!sr.0)); | 201 | r.sr().write_value(regs::SrGp(!sr.0)); |
| 199 | 202 | ||
| 203 | // Overflow | ||
| 200 | if sr.uif() { | 204 | if sr.uif() { |
| 201 | self.next_period(); | 205 | self.next_period(); |
| 202 | } | 206 | } |
