fix(p4-eth/p4-nano): Fix audio and screen to match waveshare hardware better - #701
Open
finger563 wants to merge 13 commits into
Open
fix(p4-eth/p4-nano): Fix audio and screen to match waveshare hardware better#701finger563 wants to merge 13 commits into
finger563 wants to merge 13 commits into
Conversation
On the Waveshare ESP32-P4-NANO/ETH the 10.1" ILI9881C panel does not answer MIPI-DSI DCS reads (bus turn-around), and the ESP-IDF DSI HAL busy-waits on the read with no timeout. The optional panel-ID read in Ili9881::initialize() therefore hung panel bring-up and tripped the task watchdog (IDLE0 starvation) instead of showing the display. Stop passing a read_command to the panel driver in both BSPs so it skips the ID read and initializes with writes only. Reported on hardware (esp32-p4-nano + 10.1" ILI9881C). Builds for esp32p4 on ESP-IDF 6.0. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…DSI FIFO hang) initialize_lcd() created the DPI video panel (esp_lcd_new_panel_dpi) BEFORE sending the panel controller's vendor init sequence over DBI. esp_lcd_new_panel_dpi() starts the HS video stream immediately, and while it is running the DSI cannot drain the low-power command FIFO. A short init (EK79007) fits the FIFO, but ILI9881C's 202 commands overflow it, so the HAL busy-waits on a full FIFO and the task watchdog fires during Ili9881::initialize(). Reorder so the vendor init runs while the DSI is still in command mode, then create the DPI panel and start video. Applies to both esp32-p4-nano and esp32-p4-eth. Builds for esp32p4 on ESP-IDF 6.0. Hardware test pending (esp32-p4-eth + ILI9881C). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… component Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…h/audio/backlight The waveshare/esp_lcd_jd9365 component brought the display up but internally creates its own I2C bus on hardcoded SDA=7/SCL=8 (I2C_NUM_1) for the panel's power controller at 0x45 - and never deletes it (the cleanup is commented out in its source). That second master on the BSP's own I2C pins broke every subsequent transaction on the BSP bus: GT911 probe timeouts, ES8311 and backlight writes failing with ESP_ERR_INVALID_RESPONSE. Replace the component with an espp-native driver so exactly one I2C owner exists: - New espp::Jd9365 (display_drivers/jd9365.hpp), modeled on espp::Ili9881, with the component's active 200-entry vendor init table converted verbatim (attributed, Apache-2.0), the same no-GPIO reset (DCS SWRESET + 120 ms), and the same DCS order (user page, MADCTL, COLMOD, 2-lane config, table, SLPOUT/DISPON). No DCS reads. - BSPs run the panel power-on sequence over their own internal_i2c_ before DSI init (0x45: 0x95=0x11, 0x95=0x17, 0x96=0x00, 100 ms, 0x96=0xFF, 1 s), then the espp-driver path with the identical DPI timing; on IDF >= 6.0 the JD9365 path also enables DMA2D like the vendor component did. - brightness() now writes the correct backlight register 0x96 (0-255); 0x86 is used by other panel revisions in Waveshare's BSP. - Drop the waveshare/esp_lcd_jd9365 dependency (and transitively i2c_bus). Applies to both esp32-p4-nano and esp32-p4-eth; builds green for esp32p4 on ESP-IDF 6.0. Display verified on hardware with the vendor flow; this preserves that flow byte-for-byte while unbreaking I2C. Hardware re-test pending. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…audio) The audio task drained the TX stream buffer by writing only the currently `available` bytes to I2S each cycle. With a bursty producer that makes the DMA cadence variable and interleaves full frames of silence into continuous program material, which sounds choppy/glitchy - notably worse than the m5stack-tab5, whose playback path (like esp-box and t-deck) always writes a full, frame-aligned buffer with the queued samples zero-padded to buffer_size so the DMA is fed at a constant cadence. Match that proven path in esp32-p4-eth, esp32-p4-nano, and the esp32-p4-function-ev-board (where the pattern was copied from). Builds green for esp32p4 on ESP-IDF 6.0 (eth + nano examples). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… touch Clicks were queueing: play_audio() appends to a large TX stream buffer (up to ~64 KB), so rapid touches serialized their click sounds behind whatever was still queued, playing long after the touches stopped. Add clear_audio(), which drops any queued-but-unplayed audio (the current ~16 ms DMA frame still finishes), and use it in the examples' touch handler so each new touch restarts the click immediately for responsive UI feedback. Applies to esp32-p4-eth and esp32-p4-nano; builds green on ESP-IDF 6.0. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Waveshare's own working OV5647 demos for these boards run the SCCB at 100 kHz (their Kconfig floor), while we inherited 400 kHz from the tab5. Some OV sensors probe unreliably at higher SCCB rates, and esp_video applies this frequency to the SCCB device even when reusing an external I2C bus handle, so match the vendor's proven value. Verified against the board schematics that the rest of the camera topology is correct as-is: the CSI connector's SCCB is the shared GPIO7/8 bus, the module enable line (CSI_IO0) is pulled high in hardware, and there is no reset/pwdn GPIO to drive. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… tab scroll - Gate the touch click sound (and circle draw) to the draw/status page, so touches on the Audio/Camera tabs stay silent like the other BSP examples. - Parse the WAV RIFF chunks properly and play exactly the 'data' payload. The fixed 44-byte strip played the file's trailing metadata chunks (cue/LIST/bext, 686 bytes in click.wav) as audio, causing a pop at the end of every click. - Disable LV_OBJ_FLAG_SCROLLABLE on the individual tab pages so drags inside a page don't rubber-band/scroll (the tabview content swipe was already off). Applies to esp32-p4-eth and esp32-p4-nano examples; builds green on ESP-IDF 6.0. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…own-edge only Touch drawing produced few points because Gui::draw_circle() (called from the 60 Hz touch poll task) locked the same mutex Gui::update() holds for the whole lv_task_handler() render - tens of ms per frame on the 800x1280 panel with CPU software rotation - so the touch task spent most of each frame blocked and the effective sample rate collapsed. draw_circle() now just queues the point under a small dedicated lock and the GUI update task drains the queue under the LVGL mutex, so touch sampling runs at the full poll rate regardless of render time. Also fire the click sound only on the touch-DOWN edge (prev.num_touch_points == 0) instead of on every reported change: previously each drag movement counted as a "new touch", which both restarted the click continuously while drawing and was the original source of the queued-clicks behavior. Touch is polled (~60 Hz / 16 ms; the GT911 INT line is not wired to the P4 on these boards) - the sparse points were mutex contention, not the poll rate, and not audio (play_audio is a 0-timeout non-blocking enqueue). Applies to esp32-p4-eth and esp32-p4-nano examples; builds green on ESP-IDF 6.0. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…art) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
✅Static analysis result - no issues found! ✅ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Motivation and Context
How has this been tested?
Screenshots (if appropriate, e.g. schematic, board, console logs, lab pictures):
Types of changes
Checklist:
Software
.github/workflows/build.ymlfile to add my new test to the automated cloud build github action.Hardware