We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4e4461e commit bdea521Copy full SHA for bdea521
1 file changed
ports/espressif/common-hal/qspibus/QSPIBus.c
@@ -156,6 +156,15 @@ static void qspibus_send_color_bytes(
156
const uint8_t *cursor = data;
157
size_t remaining = len;
158
159
+ // Drain stale semaphore tokens that late ISR completions may have
160
+ // posted after a previous qspibus_reset_transfer_state(). Without
161
+ // this, a stale token could satisfy a future wait, causing the next
162
+ // transfer to skip its real DMA-done wait.
163
+ if (self->inflight_transfers == 0 && self->transfer_done_sem != NULL) {
164
+ while (xSemaphoreTake(self->transfer_done_sem, 0) == pdTRUE) {
165
+ }
166
167
+
168
while (remaining > 0) {
169
// inflight_transfers is only modified in task context (never from ISR),
170
// so no atomic/critical section is needed. The ISR only signals the
0 commit comments