diff options
| author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2023-02-23 15:44:43 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-02-23 15:44:43 +0000 |
| commit | f0f92909c11c4f147e1d2fb3d32c7413a999affc (patch) | |
| tree | 657157c892d904ded6b2aa7873bedc25c96ae5ba | |
| parent | dda5a4cc9dc25dba681aa7469e9d73fe0d20cce7 (diff) | |
| parent | 4e884ee2d2f0c3f4a46f1bc539a12e9fdce173e2 (diff) | |
Merge #1227
1227: stm32/dma: fix spurious transfer complete interrupts r=Dirbaio a=pattop
DMA interrupts must be acknowledged by writing to the DMA_{L,H}IFCR
register.
Writing to the CR register is unnecessary as the channel (EN bit) is
disabled by hardware on completion of the transfer.
Co-authored-by: Patrick Oppenlander <[email protected]>
| -rw-r--r-- | embassy-stm32/src/dma/dma.rs | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/embassy-stm32/src/dma/dma.rs b/embassy-stm32/src/dma/dma.rs index 385a833f7..59937f4b0 100644 --- a/embassy-stm32/src/dma/dma.rs +++ b/embassy-stm32/src/dma/dma.rs | |||
| @@ -432,12 +432,8 @@ mod low_level_api { | |||
| 432 | } | 432 | } |
| 433 | 433 | ||
| 434 | if isr.tcif(channel_num % 4) && cr.read().tcie() { | 434 | if isr.tcif(channel_num % 4) && cr.read().tcie() { |
| 435 | if cr.read().dbm() == vals::Dbm::DISABLED { | 435 | /* acknowledge transfer complete interrupt */ |
| 436 | cr.write(|_| ()); // Disable channel with the default value. | 436 | dma.ifcr(channel_num / 4).write(|w| w.set_tcif(channel_num % 4, true)); |
| 437 | } else { | ||
| 438 | // for double buffered mode, clear TCIF flag but do not stop the transfer | ||
| 439 | dma.ifcr(channel_num / 4).write(|w| w.set_tcif(channel_num % 4, true)); | ||
| 440 | } | ||
| 441 | STATE.channels[state_index].waker.wake(); | 437 | STATE.channels[state_index].waker.wake(); |
| 442 | } | 438 | } |
| 443 | } | 439 | } |
