Skip to content

Bus_Parallel8/16 (ESP32-S3): never queue a zero-length DMA chunk - #332

Merged
lovyan03 merged 1 commit into
m5stack:developfrom
ainyan03:parallel_copy_chunk
Oct 2, 2026
Merged

lovyan03 merged 1 commit into
m5stack:developfrom
ainyan03:parallel_copy_chunk

Conversation

@ainyan03

@ainyan03 ainyan03 commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Brings the ESP32-S3 parallel bus fix of 0.2.32 (#330) to develop.

The copy path of Bus_Parallel8 / Bus_Parallel16 on the ESP32-S3 splits a transfer into chunks whose first four bytes go out as LCD command cycles and the rest by DMA. For some lengths (for example 257 to 260 bytes, or 5 bytes with no pending byte) a chunk was only four bytes long, so the DMA descriptor had no payload; Bus_Parallel16 then waited forever for its TX FIFO to fill. DMA-inaccessible sources (#324) take this path, so the lengths are reached more often.

  • Bus_Parallel16 fills each chunk up to the buffer size (one byte less when a byte is pending from an odd length) and sends a five-byte remainder as four command bytes plus the pending byte.
  • Bus_Parallel8 enlarges a four-byte chunk so that it carries a payload.

Checked on the host by running the chunking code over every length from 1 to 2000 (and both pending-byte states for Bus_Parallel16) under ASan / UBSan: every DMA payload is non-empty and stays within the buffer.

The copy path splits a transfer into chunks whose first four bytes go
out as LCD command cycles and the rest by DMA. For some lengths (for
example 257 to 260 bytes) a chunk was only four bytes long, so the DMA
descriptor had no payload; Bus_Parallel16 then waited forever for its
TX FIFO to fill. These lengths reach the copy path more often now that
DMA-inaccessible sources are copied.

Bus_Parallel16 now fills each chunk up to the buffer size (one byte less
when a byte is pending from an odd length) and sends a five-byte
remainder as four command bytes plus the pending byte. Bus_Parallel8
enlarges a four-byte chunk so that it carries a payload.
@lovyan03
lovyan03 merged commit e5efd90 into m5stack:develop Oct 2, 2026
35 of 36 checks passed
@ainyan03
ainyan03 deleted the parallel_copy_chunk branch October 2, 2026 07:43
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