Post Go back to editing

adi_mdma_IsCopyInProgress() always returning true on adi_mdma_CopyList() with source XMODIFY = 0

Thread Summary

The user is experiencing an issue with MDMA descriptors list mode where adi_mdma_IsCopyInProgress() returns true indefinitely when trying to clear a 4096-byte SDRAM buffer using a 32-byte zero-filled source buffer. The solution involves setting the source XCount to 32 and XModify to 0 to ensure 32 transfers of 32 bytes each, matching the destination XCount and XModify settings. This configuration prevents the DMA from stalling and completes the buffer clearing process.
AI Generated Content
Category: Hardware
Product Number: ADSP-21569

Hello,

I'm unsuccessfully trying to clear a big size SDRAM buffer using MDMA descriptors list mode by pointing to a 32-bytes buffer (since I'm using MSIZE = 32 bytes) filled with zeros as source buffer, and setting XCOUNT = 1 and XMODIFY = 0 in source descriptor.

The problem I'm experiencing is basically that after starting a list descriptors copy with using such descriptors, adi_mdma_IsCopyInProgress() is returning true forever.

My current project code is based on MemCopyListMode sample code, which I modified as follows.

Added MEMCOPY_XMODIFY_BYTES definition in header:

Source data buffer resized to MSIZE and number of src/dst descriptors doubled (see comment in code):

PrepareDataBuffers() adapted:

Modified PrepareDescriptors():

Resulting behavior is that main() is looping forever here in this loop:

This is DMA8 and DMA9 registers content when the DSP is looping forever in while loop above, nothing looks out of place from my point of view:

Thanks in advance to everybody would like to contribute

BR

Edit Notes

missing part
[edited by: SpoonMan999 at 8:57 AM (GMT -4) on 29 Jul 2025]
Parents
  • Hi,

    From your description we understand that you are using MDMA copy in descriptor list mode to clear 4096 bytes (4 descriptors × 1024 bytes) of SDRAM. A small 32-byte zero-filled buffer is used as the source. The intent is to repeatedly copy the 32-byte zero buffer across the full 4 KB region. Please confirm our understanding.

    If it's correct, please refer the attached project which copy the data correctly.

     MemCopyListMode.zip

    Initially, the configuration had:

    Source XCount = 1, XModify = 0
    Destination XCount = 32, XModify = 32

    This caused only 32 bytes to be transferred, and the DMA stalled. Each MDMA descriptor is configured to transfer 1024 bytes (i.e., MEMCOPY_BYTES_PER_DESC = 1024). Since the MSIZE is 32 bytes, that means:

    1024 bytes / 32 bytes-per-transfer = 32 transfers

    To match this, the source must perform 32 transfers of 32 bytes each. Setting XCount = 32, XModify = 0 tells MDMA to read the same 32-byte source buffer repeatedly without incrementing. The destination will receive 32 transfers, filling 1024 bytes with repeated 32-byte data.

    If XCount is incorrectly set to 1 in the source, only 1 transfer of 32 bytes is initiated. The destination waits for 32 transfers leads to DMA hang issue. 

    Regards,
    Nandini C

  • Thank you Nandini, problem solved.

    The error was in XCount value for the source descriptor, which must not reflect the size of the 32-byte buffer but the total number of MSIZE transfers that need to be performed by the DMA controller from source to destination.

Reply Children
No Data