Skip to content

feat(spi): abort active slave transactions - #128

Open
floitsch wants to merge 1 commit into
patch-head-5.4.2from
floitsch/spi-slave-abort
Open

feat(spi): abort active slave transactions#128
floitsch wants to merge 1 commit into
patch-head-5.4.2from
floitsch/spi-slave-abort

Conversation

@floitsch

@floitsch floitsch commented Aug 16, 2026

Copy link
Copy Markdown
Member

Summary

  • Add a private spi_slave_abort_transaction API for the transaction currently mounted in the SPI target peripheral.
  • Disconnect CS before requesting abort, and let the ISR retire the descriptor only after the peripheral and DMA no longer reference it.
  • Serialize abort with natural completion so a racing completion cannot abort the next queued transaction.
  • Delay classic ESP32 completion callbacks until the shared DMA reset has finished, making buffer ownership explicit and safe.
  • Leave queued follow-up transactions intact and reconnect CS only after the next descriptor is fully armed.

Testing

  • Built and linked downstream Toit firmware for classic ESP32.
  • Ran the downstream two-board SPI target matrix, including DMA and non-DMA idle abort, active abort while CS remains asserted, and two recovery transfers on the same target.
  • Stress-ran the autonomous buffer-target matrix five consecutive times during development, then reran it after closing the completion/re-arm race; it includes active close and immediate peripheral/pin reuse.
  • Verified the asynchronous-controller child matrix on the same classic ESP32 rig.
  • git diff --check.

The current ESP-IDF master checkout has no equivalent SPI target abort API; this is intentionally kept in the private driver interface.

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.

1 participant