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.

slave SPI (SSI0) using DMA generates an DMA error

HI,

I use DK-TM4C123 + TI-RTOS + TI-RTOS spi driver. SSI0 in slave mode using DMA runs  with the following parameters

exchSpiParams.transferMode = SPI_MODE_CALLBACK;

exchSpiParams.transferCallbackFxn = SSI0_DATA_TRANSFER;

exchSpiParams.mode = SPI_SLAVE;

exchSpiParams.bitRate = AM_EXCH_BITRATE;

exchSpiParams.dataSize = AM_EXCH_DATA_SIZE;

exchSpiParams.frameFormat = SPI_POL0_PHA0;

SSI1 not work with DMA for exclusion situations according ERRATA
DMA # 01 In Three Cases, two Peripherals Cannot Both be Programmed to use μDMA
Revision (s) Affected: 6 and 7.
Description: For the following pairs of peripherals, both peripherals cannot both be configured to use
μDMA:
• SSI0 and SSI1
• UART2 and USB0EP1
• UART0 and UART2
Workaround (s): Configure peripherals such that the combinations of peripherals listed above are not both
using μDMA.

I may be incorrectly use SPI_MODE_CALLBACK?

My transferCallbackFxn:

Void SSI0_DATA_TRANSFER(SPI_Handle handle, SPI_Transaction *transaction){

UInt transferOK;

transferOK =SPI_transfer(handle, transaction);

if(transferOK) {

/* Print contents of master receive buffer */

System_printf("Din SPI: %d\n", din_dout_data_rx.din_data);

}

else {

System_printf("Unsuccessful Din SPI transfer");

}

}

SSI0_DATA_TRANSFER called from SWI

DMA generates an error

I waiting for a reply,

Thanks

  • Hi Vladimir,

    what version of TI-RTOS are you using?

    How is the DMA generating an error? Are you getting an interrupt on the uDMA Error interrupt vector or are you just seeing bad data in your buffers? You can check the Logs if you are using the instrumented SPI driver library.

    In your .cfg file you can add this:

    var SPI = xdc.useModule('ti.drivers.SPI');
    SPI.libType = SPI.LibType_Instrumented;

    When you are using the SPI driver in slave mode, you need to make sure that you start a SPI_transfer() before the SPI master sends any data.

  • Hi Tom,

    I'm using version of TI-RTOS    1_20_00_28.

    I am getting interrupt on the uDMA Error interrupt vector using function:

    static Void DK_TM4C123G_errorDMAHwi(UArgarg)
    {
    System_printf("DMA error code: %d\n", uDMAErrorStatusGet());
    
    
    uDMAErrorStatusClear();
    System_abort("DMA error!!");
    }

    I do not have the experience to view the Logs using the instrumented SPI driver library.
    I know plugging instrumented SPI driver library, but do not know where to look Logs.
    I send the master signal "ready to a transaction" only after the task is blocked when calling SPI_transfer().
    Here's how to do it: (This SWI function )
    Void AM_DATA_EXCHANGE(UArg arg0, UArg arg1){
    
    
    UInt a=0;
    
    
    if(Task_getMode(ssiotrfunc) == ti_sysbios_knl_Task_Mode_BLOCKED){
    
    
    GPIO_write(READY_OUT, PIN_HIGH); ///
    
    
    while(a!=10) { a++; }
    
    
    GPIO_write(READY_OUT, PIN_LOW); ///
    }
    }

    Sorry, my English isn't so good

    Awaiting for a reply,
    Thanks
  • Vladimir,

    Can you check your values in the SPI_Transaction data structure; in particular TxBuf and RxBuf? Are those valid SRAM pointers?

    SPI_transfer(handle, &transaction);

  • Hi Tom!

    I checked SPI_Transaction data structure. My mistake was here:

    exchTransaction.txBuf = (Ptr)exchange_tx.di_state.dig_in_out[0];

    exchTransaction.rxBuf = (Ptr)exchange_rx.do_state.dig_in_out[0];

    Correctly will be so:

    exchTransaction.txBuf = (Ptr)exchange_tx.di_state.dig_in_out;

    exchTransaction.rxBuf = (Ptr)exchange_rx.do_state.dig_in_out;

    Thank you for your help!