Skip to content
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

SPI: Clear DMA interrupts before (not after) DMA starts #1859

Merged
merged 2 commits into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions esp-hal/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Improve error detection in the I2C driver (#1847)
- Fix I2S async-tx (#1833)
- Fix PARL_IO async-rx (#1851)
- SPI: Clear DMA interrupts before (not after) DMA starts (#1859)

### Removed

Expand Down
1 change: 1 addition & 0 deletions esp-hal/src/otg_fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ pub mod asynch {
///
/// * `ep_out_buffer` - An internal buffer used to temporarily store
/// received packets.
///
/// Must be large enough to fit all OUT endpoint max packet sizes.
/// Endpoint allocation will fail if it is too small.
pub fn new(_peri: Usb<'d>, ep_out_buffer: &'d mut [u8], config: Config) -> Self {
Expand Down
1 change: 1 addition & 0 deletions esp-hal/src/soc/esp32/gpio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
//! two different banks:
//! * `InterruptStatusRegisterAccessBank0`
//! * `InterruptStatusRegisterAccessBank1`.
//!
//! This trait provides functions to read the interrupt status and NMI status
//! registers for both the `PRO CPU` and `APP CPU`. The implementation uses the
//! `gpio` peripheral to access the appropriate registers.
Expand Down
1 change: 1 addition & 0 deletions esp-hal/src/soc/esp32s2/gpio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
//! two different banks:
//! * `InterruptStatusRegisterAccessBank0`
//! * `InterruptStatusRegisterAccessBank1`.
//!
//! This trait provides functions to read the interrupt status and NMI status
//! registers for both the `PRO CPU` and `APP CPU`. The implementation uses the
//! `gpio` peripheral to access the appropriate registers.
Expand Down
1 change: 1 addition & 0 deletions esp-hal/src/soc/esp32s3/gpio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
//! two different banks:
//! * `InterruptStatusRegisterAccessBank0`
//! * `InterruptStatusRegisterAccessBank1`.
//!
//! This trait provides functions to read the interrupt status and NMI status
//! registers for both the `PRO CPU` and `APP CPU`. The implementation uses the
//! `gpio` peripheral to access the appropriate registers.
Expand Down
6 changes: 3 additions & 3 deletions esp-hal/src/spi/master.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2036,14 +2036,14 @@ where
self.update();

reset_dma_before_load_dma_dscr(reg_block);
self.clear_dma_interrupts();
tx_chain.fill_for_tx(false, write_buffer_ptr, write_buffer_len)?;
tx.prepare_transfer_without_start(self.dma_peripheral(), tx_chain)
.and_then(|_| tx.start_transfer())?;
rx_chain.fill_for_rx(false, read_buffer_ptr, read_buffer_len)?;
rx.prepare_transfer_without_start(self.dma_peripheral(), rx_chain)
.and_then(|_| rx.start_transfer())?;

self.clear_dma_interrupts();
reset_dma_before_usr_cmd(reg_block);

reg_block.cmd().modify(|_, w| w.usr().set_bit());
Expand Down Expand Up @@ -2086,13 +2086,13 @@ where
self.update();

reset_dma_before_load_dma_dscr(reg_block);
self.clear_dma_interrupts();
chain.fill_for_tx(false, ptr, len)?;
unsafe {
tx.prepare_transfer_without_start(self.dma_peripheral(), chain)
.and_then(|_| tx.start_transfer())?;
}

self.clear_dma_interrupts();
reset_dma_before_usr_cmd(reg_block);

reg_block.cmd().modify(|_, w| w.usr().set_bit());
Expand All @@ -2117,11 +2117,11 @@ where
self.update();

reset_dma_before_load_dma_dscr(reg_block);
self.clear_dma_interrupts();
chain.fill_for_rx(false, ptr, len)?;
rx.prepare_transfer_without_start(self.dma_peripheral(), chain)
.and_then(|_| rx.start_transfer())?;

self.clear_dma_interrupts();
reset_dma_before_usr_cmd(reg_block);

reg_block.cmd().modify(|_, w| w.usr().set_bit());
Expand Down