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

Fix SPI async busy wait #35

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft

Fix SPI async busy wait #35

wants to merge 5 commits into from

Conversation

andelf
Copy link
Collaborator

@andelf andelf commented Sep 30, 2024

See-also #33

only async write is fixed.

To get END irq work:

  • DMA Bust must 1 for SPI
  • DMA transize must be actual_size + 1 for SPI

UPDATE

After some investigation:

  • Only special values trigger this bug
  • SPI END interrupt state is marked (INTRST.ENDINT is set), SPI interrupt is enabled(both peripheral and PLIC). But irq handler is never reached

@andelf andelf requested a review from HaoboGu September 30, 2024 09:43
@andelf
Copy link
Collaborator Author

andelf commented Sep 30, 2024

To use Async SPI:

bind_interrupts!(struct Irqs {
    SPI1 => hal::spi::InterruptHandler<peripherals::SPI1>;
});

let mut config = hal::spi::Config::default();
config.frequency = Hertz::mhz(2);
let spi = hal::spi::Spi::new_txonly(r.spi1, r.sclk, r.mosi, Irqs, r.dma_ch0, config);

src/dma/v2.rs Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants