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

[rtl872x] hal: fix false TX DMA completion in SPI HAL. #2749

Merged
merged 1 commit into from
Mar 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion hal/src/rtl872x/spi_hal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -711,8 +711,13 @@ class Spi {
return status_.state == HAL_SPI_STATE_ENABLED;
}

// FIXME: The TX DMA exception is notified just when the source data
// is transferred to the SPI FIFO, not when the data is actually clocked out.
// Whereas the RX DMA exception is notified when the data is actually clocked in and out.
// When the RX buffer is not supplied, we may lose some TX data due to the false SPI completion.
// Hence, we add the SSI_Busy() check here.
bool isBusy() const {
return status_.transmitting || status_.receiving;
return status_.transmitting || status_.receiving || SSI_Busy(SPI_DEV_TABLE[rtlSpiIndex_].SPIx);
}

bool isSuspended() const {
Expand Down