Skip to content

library/spi_engine: fix deadlock #2021

Closed
LBFFilho wants to merge 1 commit into
mainfrom
spi_wait_fix
Closed

library/spi_engine: fix deadlock #2021
LBFFilho wants to merge 1 commit into
mainfrom
spi_wait_fix

Conversation

@LBFFilho
Copy link
Copy Markdown
Contributor

@LBFFilho LBFFilho commented Mar 4, 2026

Fix a possible deadlock that could happen if the offload program has a chip-select or sleep instruction after a transfer instruction.

If the data stream stopped after the last transfer instruction (the DMA stopping receiving SDI data, for instance), any following instruction that uses the sleep counter (including chip-select instructions with non-zero delay) would lock up and never finish execution.

This was causing timeouts on cn0540/de10nano when disabling offload.

PR Type

  • Bug fix (change that fixes an issue)
  • New feature (change that adds new functionality)
  • Breaking change (has dependencies in other repos or will cause CI to fail)
  • Documentation

PR Checklist

  • I have followed the code style guidelines
  • I have performed a self-review of changes
  • I have compiled all hdl projects and libraries affected by this PR
  • I have tested in hardware affected projects, at least on relevant boards
  • I have commented my code, at least hard-to-understand parts
  • I have signed off all commits from this PR
  • I have updated the documentation (wiki pages, ReadMe files, Copyright etc)
  • I have not introduced new Warnings/Critical Warnings on compilation
  • I have added new hdl testbenches or updated existing ones

Fix a possible deadlock that could happen if the offload program ended with a
chip-select or sleep instruction after a transfer instruction.

If the data stream stopped after the last transfer instruction, any following
instruction that uses the sleep counter (including chip-select instructions
 with non-zero delay) would lock up and never finish execution.

Signed-off-by: Laez Barbosa <laez.barbosa@analog.com>
@LBFFilho LBFFilho added the bug label Mar 4, 2026
@LBFFilho LBFFilho marked this pull request as ready for review March 10, 2026 13:29
@LBFFilho LBFFilho requested a review from caosjr March 10, 2026 13:29
@LBFFilho LBFFilho marked this pull request as draft April 14, 2026 13:03
@LBFFilho LBFFilho closed this Apr 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant