#19161·esp-idf

PARLIO TX loop transmission: buffer update is silently ignored when the buffer uses fewer DMA descriptors than max_transfer_size allocates (IDFGH-18375)

Author: technosfCreated Oct 1, 2026Updated Oct 1, 2026
LabelsType: BugStatus: Opened

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

IDF version.

6.1

Espressif SoC revision.

ESP32-H2 (revision v1.2)

Operating System used.

Linux

How did you build your project?

Command line with idf.py

If you are using Windows, please specify command line type.

None

Development Kit.

Waveshare ESP32-H2-Zero

Power Supply used.

USB

What is the expected behavior?

The playing list is chained to the new list from its last mounted item, so the switch takes effect at the next loop boundary regardless of buffer length. Alternatively, if this is unsupported, parlio_tx_unit_transmit() should return an error rather than on_buffer_switched reporting a switch that did not happen.

What is the actual behavior?

Driving two LED driver chips from a looping PARLIO buffer and double-buffer the updates, building each new frame into the buffer that on_buffer_switched says is not playing. The display skipped exactly every other update. The update after a lost one was written into the buffer that was in fact still playing, so it appeared immediately and hid the problem.

Apparently while a loop transmission is running, calling parlio_tx_unit_transmit() with a new buffer is supposed to switch the loop to that buffer at the next loop boundary. If the new or the playing buffer needs fewer DMA descriptors than the link list was allocated with, the switch never happens: the hardware keeps looping the old buffer. on_buffer_switched still fires and reports new_buffer_addr as the new buffer, so the application has no way to notice.

Steps to reproduce.

  1. Create a PARLIO TX unit with max_transfer_size = 8192 and a data width greater than 1.
  2. Start a loop transmission from buffer A, 5376 bytes (two descriptors).
  3. While it runs, call parlio_tx_unit_transmit() with loop transmission on, using buffer B (same length, different content).
  4. Wait for on_buffer_switched. It fires and reports new_buffer_addr == B.
  5. Observe the output pins: buffer A's content is still being sent.

Config: • Component: esp_driver_parlio (src/parlio_tx.c) • PARLIO TX config: 4-bit data width, internal clock (500 kHz sample rate), max_transfer_size = 8192, buffers in internal DMA-capable RAM • Transmit config: flags.loop_transmission = 1, on_buffer_switched callback registered

Debug Logs.

plain

Diagnostic report archive.

No response

More Information.

Root cause

The link lists are sized from max_transfer_size (parlio_tx.c:164):

size_t num_dma_nodes = esp_dma_calculate_node_count(config->max_transfer_size, buffer_alignment, PARLIO_DMA_DESCRIPTOR_BUFFER_MAX_SIZE);

With max_transfer_size = 8192, each of the two link lists has 3 items. For a loop update, parlio_mount_buffer() mounts the new buffer into the other link list and then chains the playing list to it (parlio_tx.c:467 and :471):

gdma_link_mount_buffers(tx_unit->dma_link[next_link_idx], 0, &mount_config, 1, NULL);
...
gdma_link_concat(tx_unit->dma_link[t->dma_link_idx], -1, tx_unit->dma_link[next_link_idx], 0);

Suggested fix

gdma_link_mount_buffers() already returns the last item it used through end_item_index. Store it per link list and concatenate at that index:

// parlio_tx_unit_t: int dma_link_end[PARLIO_DMA_LINK_NUM]; initialised to -1

int end_idx = -1;
gdma_link_mount_buffers(tx_unit->dma_link[next_link_idx], 0, &mount_config, 1, &end_idx);
tx_unit->dma_link_end[next_link_idx] = end_idx;

if (t->flags.loop_transmission) {
    gdma_link_concat(tx_unit->dma_link[t->dma_link_idx], tx_unit->dma_link_end[t->dma_link_idx],
                     tx_unit->dma_link[next_link_idx], 0);
    t->dma_link_idx = next_link_idx;
}

This is a sketch and has not been built or tested against the driver.

Workaround

Make every loop buffer occupy exactly as many descriptors as max_transfer_size allocates. For example, set max_transfer_size to 8160 (two descriptors) and only transmit buffers of 4096 to 8160 bytes. This fixed the problem on our hardware.