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.

C6678 : problems to trig DMA on events

Other Parts Discussed in Thread: TMS320C6678

Hello,

I am working about DMA and I have some problems with it.

My starting point:

-         I work with a C6678 evaluation board (Later, I will have to do the same with a C6672)

-         I use the examples given with the EDMA3 LLD as software starting point.

           (C:\Program Files\Texas Instruments\edma3_lld_02_11_03_02\examples\edma3_driver\src)

 

Theses examples give good results. However, in theses examples all the DMA transfers are manually triggered. For my application, I have to replace theses triggers by triggers on events, precisely on the GPIO 0 for my application. 

For that purpose, I have understood that the first thing to do was to replace “EDMA3_DRV_DMA_CHANNEL_ANY “ by  “EDMA3_DRV_DMA_CHANNEL_EVENT_XX” in the call of EDMA3_DRV_requestChannel().

From the TMS320C6678 Data Manual (chapter 7.8.4), I have read that the only channels which maybe triggered by the GPIO 0 are the channels 6 of the EDMA 1 and 2, and no change is possible. Then I should begin in my software by using “EDMA3_DRV_DMA_CHANNEL_EVENT_6” in the call of EDMA3_DRV_requestChannel(),  eiher with the EDMA1 or with the EDMA2, but not with the EDMA0.

 

Problem is that the return value of  EDMA3_DRV_requestChannel() is EDMA_DRV_E_DMA_CHANNEL_UNAVAIL (-132) in both cases.

In fact, instead of “EDMA3_DRV_DMA_CHANNEL_EVENT_6”, the only channels with which EDMA3_DRV_requestChannel(), gives good results are the followings :

-         0 and 1 with the EDMA0,

-         0x30 and 0x31 with the EDMA1,

-         0x30 and 0x31 with the EDMA2.

 

After having looking for the reasons of this situation, I have found that:

- The channel 0 and 1 of the EDMA0 might correspond to some values used to initialize the sampleInstInitConfig array in the file “sample_c6678_cfg.c” (EDMA instance 0, region 0)

- The channel 0x30 and 0x31 of the EDMA1 and 2 might correspond to some values used to initialize the sampleInstInitConfig array in the file “sample_c6678_cfg.c” (EDMA instance 1 and 2, region 0 in both cases).

(Path to find with file: C:\ProgramFiles\TexasInstruments\edma3_lld_02_11_03_02\packages\ti\sdo\edma3\drv\sample\src\platforms\sample_c6678_cfg.c)

 

If it was true then, according to this file, I should have to use the channel 6 of the EDMA0 with the shadow registers of the shadow region 4 in order to trig a DMA transfer one the GPIO 0. But it does not correspond to what we can read in the TMS320C6678 Data Manual (chapter 7.8.4). That's why I don't understand how to trig et DMA transfer with the GPIO 0.

Who to trig a DMA transfer with the GPIO 0 ?

Thanks

 

Jean-Christophe Peltier

 

  • Apologize me for the mistake:

    Who  How to trig a DMA transfer with the GPIO 0 ?

    Thanks

     

    Jean-Christophe Peltier

  • Hi,
    You are correct about your observation.

    The 'sample_c6678_cfg.c', is considered as a default input to the the EDMA RMAN driver, if system specific input is not supplied.  
    So it is still generic. I am trying to find for you a file that is more specific.

    You have one of the two options :
    a. supply this info thru, EDMA3_DRV_InitConfig-> drvInstInitConfig, at initialization time. I am also trying to find an example for you.
    b. edit the 'sample_c6678_cfg.c' file as per you needs. In the file, look for ' /* ownDmaChannels */ ', for EDMA instance #1 and #2, and then add
    channel 6 in the list of 'own DMA channels'. 

    Keep us updated.
  • Hello,

    I have looked at your options. You suggest adding the needed information, either dynamically or statically.

    It might be possible for me to do something by myself, but it could be quite hazardous for an end-user to proceed to such a modification. If I add the channel 6 in the list of "own DMA channels" for EDMA instance #1, the EDMA instance  #1 would have 3 channels as its owns instead of 2. Then, what could happened because of "defines" such as "#define EDMA3_MAX_DMA_CHAN_DWRDS (EDMA_MAX_DMa_CH / 32u)"  (edma3_common.h) ?

    And what about information written in the arrays such as dmaChannelHwEvtMap[EDMA3_MAX_DMA_CHAN_DWRDS], ownDmaChannels[EDMA3_MAX_DMA_CHAN_DWRDS] or resvdDmaChannels[EDMA3_MAX_DMA_CHAN_DWRDS] ?

    The sample_c6678_cfg.c file and some other files should take into account some specific information about the C6678, given by the tms320c6678.pdf document, chapter 7.8.4. Theses information are specific to the C6678, but are common to every C6678 whatever the applications these processors might have to support.

    For example, the sample_c6678_cfg.c file may give defaults input to the EDMA driver within which the GPIO events are associated to the EDMA instance #1 and/or #2, but it should not give defaults input to the EDMA driver within which the GPIO events are associated to the EDMA instance #0.

    For theses reasons, a specific but valid sample_c6678_cfg.c file for every C6678 will be indispensable for a good application development.

    I will wait for it.

    Thank's

    Jean-Christophe Peltier

  • Hello,

    After having wrote what you may read above, I have tried the dynamic modification of sampleInstInitConfig by writing : sampleInstInitConfig[1 or 2][0].ownDmaChannel[0]  =  sampleInstInitConfig[1 or 2][0].ownDmaChannel[0]  |  (1 << 6);

     Results :

    1) It's effectively hazardous for an end-user to proceed to such a modification : I have understood the reason of the define " EDMA3_MAX_DMA_CHAN_DWRDS (EDMA_MAX_DMA_CH / 32u)" that I had not understood preceedingly : the size is divided by 32 only because of the need of one bit per channel, and that' all.

    2) Now, the EDMA3_DRV_requestChannel () API returns me another error. It's value is -160.

    I realize that perhaps the event numbers might have a different signification for the EDMA instances #0, #1,  and #2. So there would not be forbiden event numbers for an instance or another one, and then any sample_c6678_cfg.c file might valid.

    But it's uneasy to understand and to modify (error -160).

    Jean-Christophe Peltier

     

     

     

  • sampleInstInitConfig and edma3init() both exist in the EDMA driver and in the resource manager, with the same names.

    I don't know which ones I am using, I am lost...

  • I am consulting with the device expert and the software driver team. We will update you.
  • Hello,

    Thanks to your first idea, I have found how to trig a DMA on GPIO 0 event :

    1) You have had suggested to modify  sampleInstInitConfig :

    sampleInstInitConfig [1 or 2] [shadow register number]ownDmaChannels [0] |= (1<<6)

    2) The same has to be done on ownPaRAMSets and ownTccs :

                     sampleInstInitConfig [1 or 2] [shadow register number] . ownPaRAMSets [0] |= (1<<6),

                     sampleInstInitConfig [1 or 2] [shadow register number] . ownTccs [0] |= (1<<6),

    3) Then call edma3init and EDMA3_DRV_requestChannel () with  chID = EDMA3_DRV_HW_CHANNEL_EVENT_6,

                     EDMA3_DRV_setSrcParams (), EDMA3_DRV_setDestParams () and so on,

    4) Modify the "event enable set register" :   Useless

    *((Uint32*)0x02721030)  =  (*((Uint32*)0x02721030))  |  (1 << 6)

    EDMA3_DRV_enableTransfer () with EDMA3_DRV_TRIG_MODE_EVENT,

    6) And then enjoy playing with the GPIO 0 :

                      * gpioSetDirection (0, GPIO_OUT), gpioSetRisingEdgeInterrupt(0), gpioSetFallingEdgeInterrupt(0), gpioEnableGlobalInterrupt(),

                      * Toggle the GPIO 0 state with gpioReadInput (0) gpioClearOutput (0) and  gpioSetOutput (0).

     

    But I don't now if side effects may occur or not because of the use of three two different abstract levels to do one thing :

    - register access,

    - modification of library's global data

    - API calls.

     

    A new API might do what I have done on global data.

     

    Jean-Christophe Peltier