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.

TMS570LS3137: DMA SPI Communication Problem

Part Number: TMS570LS3137
Other Parts Discussed in Thread: TMS320F28377D

Hi, 

I have a problem with SPI communication in TMS570LS3137. 

I am trying to communicate with TMS320F28377D through SPI. Both MCU is using DMA for SPI communication. 

Transferring 16-word is OK. However i need to transmit and receive 32-word. When I do that, TMS320F28377D receives all 32-word but the order is not correct. 

For example, TMS570 sends 1,2,3...,32; TMS320F28377D receives 16,17,18...32,1,2,3,..15. 

Any idea to solve this problem? Thank you.

  • Hello,

    You can use SPI loopback (internal loopback, don't require wire on your board) on TMS570 side to check if the received data is correct. If the received data is the same as the txed data, please check the code in F28377 side.

  • Hello, 

    I tried loopbacks on both MCUs. In loopback configuration both MCUs work properly. However communication between MCUs is still not correct. 

    For F28377D spi and dma initialization is as follow: 

    SPI:

    SpibRegs.SPIFFCT.all=0x0; // place SPI in reset

    SpibRegs.SPIFFRX.all=0x2040; // RX FIFO enabled, clear FIFO int
    SpibRegs.SPIFFRX.bit.RXFFIL = FIFO_LVL; // Set RX FIFO level
    SpibRegs.SPIFFTX.all=0xE040; // FIFOs enabled, TX FIFO released,
    SpibRegs.SPIFFTX.bit.TXFFIL = FIFO_LVL; // Set TX FIFO level



    SpibRegs.SPICCR.all =0x000F; // Reset on, rising edge, 16-bit char bit
    SpibRegs.SPICTL.all =0x0002; // Enable slave mode, phase = 0,// enable talk, and SPI int disabled.


    SpibRegs.SPIBRR.all =0x0009; // Baud rate = LSPCLK/10 = 10 MHz
    SpibRegs.SPICCR.all =0x008F; // Relinquish SPI from Reset

    SpibRegs.SPIPRI.bit.FREE = 1; // Set so breakpoints don't disturb xmission

    DMA:


    //Initialize DMA
    DMAInitialize();

    DMASource = (volatile Uint16 *)sdata;
    DMADest = (volatile Uint16 *)rdata;

    // configure DMACH5 for TX
    DMACH5AddrConfig(&SpibRegs.SPITXBUF,DMASource);
    DMACH5BurstConfig(BURST,1,0); // Burst size, src step, dest step
    DMACH5TransferConfig(TRANSFER,1,0); // transfer size, src step, dest step
    DMACH5ModeConfig(DMA_SPIBTX,PERINT_ENABLE,ONESHOT_DISABLE,CONT_ENABLE
    ,SYNC_DISABLE,SYNC_SRC,OVRFLOW_DISABLE,SIXTEEN_BIT,CHINT_END,CHINT_ENABLE);

    // configure DMA CH2 for RX
    DMACH6AddrConfig(DMADest,&SpibRegs.SPIRXBUF);
    DMACH6BurstConfig(BURST,0,1);
    DMACH6TransferConfig(TRANSFER,0,1);
    DMACH6ModeConfig(DMA_SPIBRX,PERINT_ENABLE,ONESHOT_DISABLE,CONT_ENABLE,
    SYNC_DISABLE,SYNC_SRC,OVRFLOW_DISABLE,SIXTEEN_BIT,CHINT_END,CHINT_ENABLE);

    Thanks in advance.

    Osman

  • Hello Osman,

    I am not familiar to F28377 device. During TMS570 transfers data to F28377, did you monitor the data pattern on SPI bus (SIMO)?

  • Hello, 

    No, I couldn't monitor SIMO and it is hard to monitor due to board that we used. Any other suggestion? 

    Thanks in advance, 

    Osman

  • In your loopback test, the received data is the same as the TXed data. I think the code in transmitter side (TMS570) is fine.