Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

DMA xmc4xxx fixes: Inlcude ongoing transfer in the pending_length field of dma_status() #83870

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

talih0
Copy link
Contributor

@talih0 talih0 commented Jan 12, 2025

The PR addresses two problems in XMC4xxx DMA driver:

  1. Occasional incorrect pending_length returned by the dma_status() call. The driver assumed that the ongoing transfer had completed, while it may be still be ongoing.

I received feedback from Infineon support in this thread:
https://community.infineon.com/t5/XMC/GPDMA-Unreliable-CTL-BLOCK-TS-for-checking-transferred-items-to-MCU/td-p/763264

  1. Allow calling dma_config() -> dma_stop() -> dma_start() as is done in the loop transfer test.

@zephyrbot zephyrbot added area: DMA Direct Memory Access platform: Infineon Infineon Technologies AG labels Jan 12, 2025
@talih0 talih0 force-pushed the dma_xmc4xxx_fixes branch from 7a0f694 to 84944c3 Compare January 12, 2025 21:20
…length

When quering the DMA status we need to return the number of pending bytes
left in the transfer. Currently this is inferred by calling
XMC_DMA_CH_GetTransferredData(). However, this function actually returns
the number of items read from the source peripheral (via CTL.BLOCK_TS).
It doesn't guarantee that the last item was fully transferred to the
destination.

When using the ADDR_ADJ_INCREMENT/DECREMENT options it is better to use
DAR register to infer the number of transferred bytes. This points to the
memory address where the next data will be written. It only increments
after the ongoing transfer from source to destination is completed.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
In the dma loop_transfer test (test_loop_repeated_start_stop()), the
order of calls is dma_config() -> dma_stop() -> dma_start().  This
currently does not work on xmc4xxx because after calling dma_stop(), the
dma would be in a suspended state. Fix this by leaving the suspended state
before exiting dma_stop().

Also don't clear the context (dma_channel->dlr_line and dma_channel->cb)
that was setup by dma_config().

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
Adds overlays for xmc45_relax_kit and xmc47_relax_kit boards.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
@talih0 talih0 force-pushed the dma_xmc4xxx_fixes branch from 84944c3 to 979b464 Compare January 12, 2025 21:46
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
area: DMA Direct Memory Access platform: Infineon Infineon Technologies AG
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants