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.

CC2530 DMAREQ is not cleared after transfer

Hi,

I'm tring to use the DMA as a memset() or memcpy().

Channel 0 for memcpy()

Channel 1 for SPI

Channel 2 for Flash

Channel 3-4 AES

All the channels are triggered except for channel 0

After Some time i have noticed that the DMAREQ for channel 0 is still '1' even after the transfer accord.

I checked that the DMA finished to transfer corectly DMAIRQ become '1' , i cleared him but the DMAREQ still remain '1'.

In some test i put "while(DMAREQ)" at the end of the code and it stack forever in the loop.

Does someone have any advice  on the matter?


#define DMA_CLR_INTERRUPT(ch)     st ( DMAIRQ = ~( 1 << (ch) ); )
#define DMA_ABORT_CHANNEL(ch)   st ( DMAARM = (0x80 | (0x01 << (ch))); )
#define DMA_START_CHANNEL(ch)    st ( DMAREQ = (0x01 << (ch)); )

#define DMA_WAIT_FOR_DMA_TO_COMPLETE(ch) \
                   st( while(!(DMAIRQ & ( 1 << (ch) ))); \
                   DMAIRQ = ~( 1 << (ch) ); )

#define DMA_ARM_CHANNEL(ch) \
 asm("NOP");asm("NOP");asm("NOP");asm("NOP");asm("NOP");asm("NOP");asm("NOP");asm("NOP");asm("NOP");\
DMAARM = (0x01 << (ch)); \
asm("NOP");asm("NOP");asm("NOP");asm("NOP");asm("NOP");asm("NOP");asm("NOP");asm("NOP");asm("NOP");


boolean Dma_MemCopy (byte *pSrcBuf, byte *pDesBuf, char size)
{
     byte i = 0;

     SET_WORD(DmaChannelsConfig[DMA_MEMCPY_CHANNEL].SrcAddrH
                            , DmaChannelsConfig[DMA_MEMCPY_CHANNEL].SrcAddrL, pSrcBuf);
     SET_WORD(DmaChannelsConfig[DMA_MEMCPY_CHANNEL].DestAddrH
                            , DmaChannelsConfig[DMA_MEMCPY_CHANNEL].DestAddrL, pDesBuf);
     SET_WORD(DmaChannelsConfig[DMA_MEMCPY_CHANNEL].LenH
                            , DmaChannelsConfig[DMA_MEMCPY_CHANNEL].LenL, size);

     DmaChannelsConfig[DMA_MEMCPY_CHANNEL].VLen = DMA_VLEN_USE_LEN;
     DmaChannelsConfig[DMA_MEMCPY_CHANNEL].SrcInc = DMA_SRCINC_1;
     DmaChannelsConfig[DMA_MEMCPY_CHANNEL].DestInc = DMA_DESTINC_1;
     DmaChannelsConfig[DMA_MEMCPY_CHANNEL].Trig = DMA_TRIG_NONE;
     DmaChannelsConfig[DMA_MEMCPY_CHANNEL].TMode = DMA_TMODE_BLOCK;

     DmaChannelsConfig[DMA_MEMCPY_CHANNEL].WordSize = DMA_WORDSIZE_BYTE; 
     DmaChannelsConfig[DMA_MEMCPY_CHANNEL].IrqMask = DMA_IRQMASK_DISABLE; 
     DmaChannelsConfig[DMA_MEMCPY_CHANNEL].M8 = DMA_M8_USE_8_BITS; 
     DmaChannelsConfig[DMA_MEMCPY_CHANNEL].Priority = DMA_PRI_HIGH;

     
     /* Clear DMA FLASH Interrupts */
     DMA_CLR_INTERRUPT(DMA_MEMCPY_CHANNEL);

     DMA_ARM_CHANNEL(DMA_MEMCPY_CHANNEL);

     DMA_START_CHANNEL(DMA_MEMCPY_CHANNEL);
     while( (!(DMAIRQ & ( 1 << (DMA_MEMCPY_CHANNEL) ))) )
     {
          i++;
          if(i > 15000)
          {
               DMA_ABORT_CHANNEL(DMA_MEMCPY_CHANNEL);
               DMAIRQ = ~( 1 << (DMA_MEMCPY_CHANNEL) );
               Emac_SetEmacModemErrBit(ECOP_MODEM_ERR_DMA_MEMCPY);
               return FALSE;
          }
     }
     DMAIRQ = ~( 1 << (DMA_MEMCPY_CHANNEL) );

     return TRUE;
}

  • Hi,

    I remember testing CC253x DMA with ADC before, and put the code here:

    http://processors.wiki.ti.com/index.php/CC25xx_CC11xx_SoC_Example_Codes

    Could you try to compare it with your code?

  • Hi,

    I use SPI, FLASH like in TI examples, for the ADC i use two channles IN/OUT almost in the same way you do. It all work flawlessly.

    Now i decided to use the last channel as memcpy() and memset() like the code i wrote in my last massage.

    The problem is that some time the DMA ends his transfer, the DMAIRQ is '1', i clear the DMAIRQ, but the DMAREQ still stay '1'.

    If i'm not mistaken it supposed to change to '0' right after the DMA start to transfer the data.

    By the way the DMA transfer ends with all the data transfered right! ( still the DMAREQ is '1').

    Even if my ADC code is a little different then yours, how does it infect a different channel from working correctly?


    Thanks for your quick replay,

    Ran