Repository navigation
fix(parlio): keep data pins driven while the TX unit is re-created (#4669) - #4677
Conversation
…4669) The engine deletes and recreates the PARLIO TX unit on every frame (that is what routes a pad another driver borrowed back to PARLIO). parlio_del_tx_unit() calls gpio_output_disable() on each data pin before tearing the unit down, which takes ~350 us on an ESP32-P4, so every frame began with the data line floating. On the P4 loopback bench (RX pad pulled up) RMT RX saw a rising edge, >100 us of HIGH, hit its idle threshold and ended before the frame: PARLIO looked like it emitted nothing (class=zero_capture). A real strip's DIN floated for the same window. Latch each data pad with gpio_hold_en() across the delete, re-drive it low as a plain GPIO, then release the hold. parlio_new_tx_unit() re-routes it.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. 🧰 Additional context used📚 Code guidelines (1)No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (1)
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review. 📝 WalkthroughWalkthroughThe ESP32 PARLIO implementation now tracks configured data pins. During TX-unit deletion, it holds the pins and, on success, drives them low and configures them as GPIO outputs. On failure, it releases the holds and retains the pin tracking. ChangesPARLIO pin cleanup
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Sequence Diagram(s)sequenceDiagram
participant Cleanup as deleteTxUnitKeepingPins
participant GPIO
participant PARLIO as PARLIO TX unit
Cleanup->>GPIO: Hold tracked pins
Cleanup->>PARLIO: Delete TX unit
alt Deletion succeeds
Cleanup->>GPIO: Drive pins low and configure GPIO outputs
Cleanup->>GPIO: Release holds
Cleanup->>Cleanup: Clear TX-unit handle and pin tracking
else Deletion fails
Cleanup->>GPIO: Release holds
Cleanup->>Cleanup: Retain pin tracking
end
Merge Risk: 🔵 Low · up to This change keeps PARLIO data lines driven low while the TX unit is re-created, and the author reports it fixed the failing ESP32-P4 bench test. A small risk remains on boards where another driver shares a PARLIO pad, and the ESP32-C6 was not re-tested. It is mergeable with owner awareness of both points. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The change preserves output-pin state during cleanup without adding a public interface. Risk appears limited, but concurrent pin reuse and hardware failure recovery are not fully established. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Cross-checked on an ESP32-C6, which shares the PARLIO peripheral code. This branch with |
Fixes the PARLIO half of #4669 (
class=zero_captureon ESP32-P4).Root cause
ChannelDriverPARLIO::beginTransmission()callsParlioEngine::initialize()every frame. When the config matches, the engine deletes and recreates the TX unit on purpose ("Reinitializing TX unit for clean DMA state"). That re-create is load-bearing: it routes the pad back to PARLIO after another driver (for example RMT) has borrowed it. Skipping it made PARLIO fail as soon as RMT had run on the same pin.parlio_del_tx_unit()(IDF v5.5parlio_tx.c) callsgpio_output_disable()on every data pin, then tears the unit down inparlio_destroy_tx_unit(). So every frame began with the data line floating for that teardown time.Bench evidence (P4, GPIO5→GPIO6 jumper):
deinitialize(). The RX pad has a pull-up from the GPIO pre-test.0x8000: a rising edge, then more than its 100 µs idle threshold of HIGH, so it ended before the frame began. SPI on the same RX recorded 2400 symbols.0x1B02vs0x1A82).On a real strip, DIN floats for the same window on every frame.
Fix
In
ParlioPeripheralESPImpl, latch each data pad withgpio_hold_en()acrossparlio_del_tx_unit(), re-drive it low as a plain GPIO (the idle level every transmit uses), thengpio_hold_dis().parlio_new_tx_unit()re-routes the pad to PARLIO. If the delete fails, the hold is still released.Evidence (ESP32-P4,
80:F1:B2:D1:DF:B1, fbuild 2.5.31)Before (master):
After (this branch):
Stress run over RPC, interleaving drivers on the same TX pin. All passed:
--allwith this PR plus the LCD_RGB fix (#4669 companion PR), on current master:Notes
driver/gpio.hAPIs available on all PARLIO targets.bash lintpasses,bash test parliopasses, and/code-reviewfound no issues on this change.Summary by CodeRabbit