This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS570LC4357: Need explanation of GPIO[A|B] DMAREQ timing.

Part Number: TMS570LC4357

Hi,
I am currently working as a consultant at a Texas Instrument direct account,
but I have not received the credentials, so I am using my normal login account.

They are using the TMS570LC4375, and I will work on the DMA driver.

I need to trigger a DMA channel from an FPGA using a /DMAREQ H/W trigger on GIOA[6].

This is DMAREQ[38]  PINMMR176[16] will be set to 0.   DMAREQPS[1:0] |= (1 << 38) // Active Low

When /DMAREQ is asserted, a single frame should be transferred.

The FPGA is still under specification, so for initial tests, we will have a very simple
FPGA design to test the MCU S/W.

The plan is to have the MCU generate a /DMAREQ signal on an unused
connection between the CPU and the FPGA. (assume this is /MCU_DMAREQ)
The simple FPGA design will just configure that pin as an input and route the
signal to the correct FPGA pin connected to the CPU /DMAREQ pin (GIOA6).

The timing of the DMA request pin is unclear to me.

There is a DMA Request Polarity register where you can select if the signal is active low or active high.

When a H/W request is generated, the DMA Status register is set.

Questions: 

                    What happens if the CPU receives a pulse on the /DMAREQ which ends before the DMA has started transferring?

                    Will the DMA request be honoured as long as the pulse is a certain length?

                    If so, what is the minimum length of the pulse?

                   What happens if the CPU /DMAREQ is asserted until a DMA transfer is started and is then deasserted?
                   The FPGA will be memory mapped, and any read from a memory window will deassert the /DMAREQ

                   What happens if the /DMAREQ is deasserted only after the DMA transfer has completed?
                   (One way of handling the initial test is to assert the /MCU_DMAREQ in a test program,
                    and to deassert the /MCU_DMAREQ in the FTCA interrupt (Frame Transfer Complete)
                   Then the /DMAREQ is still asserted at the end of the DMA transfer.

  • Hello Ulf,

    The DMA_REQ signal is latched on the next HCLK rising edge in the DMA controller. The DMA_REQ signal should stay active for only one VCLK/HCLK cycle. The peripheral needs to de-assert the DMA_REQ after one HCLK cycle.

    The DMA controller has a two-level buffer to capture HW requests per channel. When a HW request is generated and the channel is enabled, the corresponding bit in the DMA Status Register is set. The pending register acts as a first-level buffer.

    Peripheral is allowed to assert another request anytime after all the data has been read out by DMA even though DMA has not completed transferring data to its destination. A complete transfer means that all elements associated with a channel are completely transferred from its source to its destination. Peripheral can not assert a third request before the transfer associated with the first request is fully complete.

    The DMA cannot capture more than two requests at the same time. Additional requests are ignored until at least one pending request is completely processed.

    Again, the DMA_REQ signal should stay active for only one VCLK/HCLK cycle. The peripheral needs to de-assert the DMA_REQ after one HCLK cycle.
  • Your answer is a little  ambiguous, since the latter part can be interpreted as the DMA controller will only react to a second DMAREQ after the last element of a frame has been read. In this state, there will be contents in the DMA FIFO waiting to be written out, so the DMA transfer is not complete.

    We have an FPGA on the EMIF which needs DMA support.

    The natural way to implement DMA would be to have the peripheral assert the DMAREQ when service is needed.

    When the peripheral detects an access to an adress within an address range, the DMAREQ should be deasserted.

    Since our frame is at least 16 elements, deasserting DMAREQ after the first DMA read will ensure that it is not asserted at the end of the  last DMA  read transfer.

    Can you confirm whether our idea will work or not?

    A second problem popped up.

    We want to transfer multiple frames with one frame per DMAREQ.

    After transferring a full block, we plan to either reprogram the DMA Initial destination adress or enable another DMA channel in the BTC interrupt.

    What happens if the  DMA channel had transferred a full block, and a new DMAREQ occurs before the BTC interrupt routine runs.

  • Hello Ulf,

    Your idea works. The request is latched on HCLK rising edge, and should stay high for at least 1 HCLK cycle.

    The whole block has been transferred, but has not completed, so the DMA status bit for this channel is still set. The new request will be in pending, bit in PEND register for this channel will be set.
  • That is again ambiguous.

    I want to assert DMAREQ, and keep DMAREQ active until the FPGA is accessed.

    When the FPGA  is accessed, it should deassert the DMAREQ signal.

    The DMA controller should only transfer one frame.

    If the pending register is set due to this, then I believe this will cause the transfer of two frames.

    If the DMAREQ is asserted for two clocks, does that mean that two transfers will occur?

    I also need a reply on what happens if a DMA channel has completed transferring all frames of a block, and takes BTC interrupt,

    but the next DMAREQ comes before the DMA channel has been reinitialized.

  • Hi Ulf,

    I want to assert DMAREQ, and keep DMAREQ active until the FPGA is accessed.
    QJW> This is OK. The DMAREQ can keep active as long as you can.

    When the FPGA is accessed, it should deassert the DMAREQ signal.

    The DMA controller should only transfer one frame.
    QJW>yes, it should transfer only 1 frame for 1 DMAREQ

    If the pending register is set due to this, then I believe this will cause the transfer of two frames.
    QJW> When a HW request is generated and the channel is enabled, the corresponding bit "CHANNEL PENDING Register (PEND)" is set. The PEND bit is cleared at the end of a frame. This will not cause the transfer of two frames.

    If the DMAREQ is asserted for two clocks, does that mean that two transfers will occur?
    QJW>No, since it is triggered (rising edge if the polarity is HIGH) once.

    I also need a reply on what happens if a DMA channel has completed transferring all frames of a block, and takes BTC interrupt,
    but the next DMAREQ comes before the DMA channel has been reinitialized.
    QJW>After the last transfer has completed. The new DMAREQ will set the PEND bit. But the pend bit will be cleared when control packet is modified.

    Please let me know if my answer is not clear. Thanks
  • OK: This is how I interpret the functionality.
    When the CPU H/W DMAREQ is activated, the pending bit is set, and a DMA transfer is started if a DMA is enabled
    The DMAREQ signal can be Active without causing a second frame to be transmitted until the Pending bit is cleared at the end of the frame.

    If the DMAREQ signal has been deactivated before the pending bit is clear, the DMA starts waiting for the next DMAREQ
    If the DMAREQ signal has not been deactivated before the pending bit is clear, a new transfer is started.

    * Can You confirm that this is how it works?
    =====================
    * This is how I suspect the DMA works: Can you confirm each item.

    * Queued DMA transfers?
    Once a DMAREQ has been activated and a transfer started:
    If the DMAREQ is deactivated before the pending bit is cleared for the current transfer,
    but is activated again before the pending bit has been cleared, a new request will be

    * Pending Register clearing?
    The pending register is cleared after the DMA has read the last Word of a frame from the source.
    This and a few previous words may be in the DMA FIFO, waiting to be written out at this point of time.

    =====================
    My application will DMA from the source into two buffers each containing one block.
    To avoid overhead, my plan is to use two DMA channels, each handling one buffer.
    They will share the same DMAREQ signal, but only one will be active at a time.
    The plan is to use the Block Transfer Complete Interrupt to switch between DMA channels.

    Assume channel #1 is used for Block 1, channel #2 is used for Block 2.

    DMA Channel 1.Block Transfer Complete Interrupt
    Enable DMA #2

    DMA Channel 2.Block Transfer Complete Interrupt:
    Enable DMA #1

    ===================================================
    At initialization I will write the Control packet to both DMA channels.
    Both will be initialized to use the same DMAREQ signal
    Then I will enable DMA Channel #1, but not DMA channel #2.

    * Will the DMA #2 pending bit be set, when DMAREQ is activated, even though it is not enabled?

    I know that if a DMA channel is enabled, and a DMAREQ is activated the pending bit will be set
    and remain set, even if I disable the DMA channel.

    If the DMA # pending bit is not set on DMAREQ when the channel is inactive:

    * What happens if the DMAREQ is Active, and the DMA channel is enabled?
    Will that set the pending bit and a transfer is performed?
  • Some notice what is not possible found on TI documentation:
    When external DMAREQ signal is active before corresponding HWCHENA* bit, DMA controller silently ignore this request.
    See e2e.ti.com/.../467894
  • Hello Jiri,

    * Queued DMA transfers?
    Once a DMAREQ has been activated and a transfer started:
    If the DMAREQ is deactivated before the pending bit is cleared for the current transfer,
    but is activated again before the pending bit has been cleared, a new request will be

    QJW> DMA has a two level buffers to capture HW requests and one level of buffer to capture SW requests. If the pending request is not completely serviced by DMA and a HW request is generated by a peripheral onto the same channel, DMA will capture and recognize this HW request into its request buffer (2nd level buffer). DMA can not recognize two SW requests onto the same channel if the first SW request is still pending. So the SW request will be ignored.

    * Pending Register clearing?
    The pending register is cleared after the DMA has read the last Word of a frame from the source.
    This and a few previous words may be in the DMA FIFO, waiting to be written out at this point of time.

    QJW> The pending bit is cleared at the end of a transfer. A complete transfer means that all elements associated with a channel are completely transferred from its source to its destination.
  • Hello,

    If a channel inside HWCHENAS is not enabled and a hardware request mapped to that channel is asserted, the hardware request will still be
    captured inside CHANNEL PENDING Register (PEND).
  • Problem is ,that it have race condition between HW/SW which isn't possible solve.

    Let have external DMA request activated close HWCHENAS bit set. In this contition SW read PEND bit and it is active. What it mean? We don't know! There is who possible reasons:

    1. PEND bit is active, because external signal was active before HWCHENAS bit. In this case DMA controller didn't start transfer and we must start it by SWCHENAS bit.
    2. PEND bit is active, because DMA controller have transfer with higher priority and my transfer must wait. In this case we can't set SWCHENAS bit because it could start duplicate transfer.

    Result: It don't have solution on DMA controller only. We must control external source of signal or DMA request connection on PINMUX