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.

CC2541 DMA with SPI

Hi All, currently I am trying to get DMA properly configure for SPI RX through the U1DBUF as pointed out in the documentation.

My device is a slave, and I previously had SPI working but can't seem to get the SPI data via DMA. The interrupt is properly received and when I check the array where the bytes should be stored the array has been filled with {0x80, 0x80, 0x80, ....} each time.

Are there any timing requirements, or anything else for enabling DMA with SPI I am just missing?

******************************Here is my DMA Config Code**************************************

    dmaConfig0.SRCADDRH  = ((uint16)U1DBUF >> 8) & 0x00FF;
    dmaConfig0.SRCADDRL  = (uint16)U1DBUF & 0x00FF;
    dmaConfig0.DESTADDRH = ((uint16)rxBufferSlave >> 8) & 0x00FF;   
    dmaConfig0.DESTADDRL = (uint16)rxBufferSlave & 0x00FF;
    dmaConfig0.VLEN      = DMA_VLEN_VALOFFIRST;   //Transfer Length based on first byte
    dmaConfig0.LENH      = (BUFFER_SIZE >> 8) & 0x00FF;
    dmaConfig0.LENL      = BUFFER_SIZE & 0x00FF;
    dmaConfig0.WORDSIZE  = DMA_WORDSIZE_BYTE;     //Transfers 1 BYTE
    dmaConfig0.TMODE     = DMA_TMODE_SINGLE_REPEATED;  //Transfers 1 BYTE/Trigger & Resets ARM after transfer count is reached
    dmaConfig0.TRIG      = DMA_TRIG_URX1;          //Trigger on SPI RX
    dmaConfig0.SRCINC    = DMA_SRCINC_0;
    dmaConfig0.DESTINC   = DMA_DESTINC_1;
    dmaConfig0.IRQMASK   = DMA_IRQMASK_ENABLE;   //Enable DMA ISR
    dmaConfig0.M8        = DMA_M8_USE_8_BITS;
    dmaConfig0.PRIORITY  = DMA_PRI_HIGH;         //DMA HIGH PRIORITY


    DMA0CFGH = ((uint16)&dmaConfig0 >> 8) & 0x00FF;
    DMA0CFGL = (uint16)&dmaConfig0 & 0x00FF;
   
    DMAIRQ &= 0x00;
    DMAARM |= (DMAARM_DMAARM0);
    NOP();NOP();NOP();NOP();NOP();NOP();NOP();NOP();NOP(); // 9 NOPs

  • Additionally, it might be helpful to note that the DMA is properly working when I use a declared array, that is filled in with default values as the source address.

    I triggered it manually in this case and then checked the rxBufferSlave array (Destination Address), and the expected values were there.

    It is at the point where I switch the source address to U1DBUF as shown in the code above that I can not seem to get the correct data, only a filled array of {0x80, 0x80, 0x80, ...} shows. Any suggestions or pointers would be appreciated.

    Thanks.

    **************************************************

    Found the issue: Must directly call SFR address for U1DBUF

        dmaConfig0.SRCADDRH  = ((uint16)0x70F9 >> 8) & 0x00FF;
        dmaConfig0.SRCADDRL  = (uint16)0x70F9 & 0x00FF;