Skip to content

DMA hangs after it reaches descriptor with Owner::CPU #3251

Open
@George-Miao

Description

@George-Miao

Bug description

I was testing out the experimental DMA TX stream buf from @Dominaezzz (I originally found this in a discussion). I have esp32-s3 and a lcd driven by st7701s (datasheet). The screen has a parallel RGB (DPI) with 3-wire SPI interface. The example in the code works well and I do get the expected pure red and blue flashing screen. But whenever I add some time-consuming logic (initialize and update slint, for example) between start of transmission and subsequent data push, the screen turned dark.

I created a MRE repo, however it is just for showcasing the code more easily and I don't expect anyone to happen to have the exact same hardware. After some digging, I found all subsequent pushes was eventually early-returned by following code that was supposed to reclaim buffer from DMA:

https://github.com/George-Miao/esp-dma-lcd-mre/blob/eb52c69a275a80a1602ea00fa6e621c72143e05b/src/dma.rs#L298-L300

That's how I come to the conclusion that DMA hangs, since auto write back is turned on but the descriptor was never given back to CPU and no bytes was written to the screen after the delay.

To Reproduce

  1. Run cargo run --release
  2. The screen should turn red and blue normally
  3. Uncomment src/main.rs:159, which delays 10ms before the main loop starts
  4. DMA hangs and nothing got transmitted to the screen

Expected behavior

The descriptor should have owner bit set to CPU and data should be transmitted to LCD_CAM normally.

Environment

  • Target device: esp32s3 (revision v0.2)
  • Crate name and version: esp-hal 1.0.0-beta.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions