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.

TMS570LC4357: SPI with 24 bit data buffer transmit

Part Number: TMS570LC4357
Other Parts Discussed in Thread: HALCOGEN

Hi, 

Hi, I am integrating the DAC80508 with TMS570LC4357 controller. I am using Evaluation modules for both the chips. Connections are made according the description in the data sheet. The SPI 5 configured with 1 MHz clock (wanted to test with low clock speed initially). I have transmitted 24 bits (0x81 00 00) with 8 bit configuration in HalcoGen. I am facing issue with gaps between every 8 clock pulses. The slave is expecting continuous 24 bit clock pulses and the data to sync. How can I achieve this? Please help me.

  • Hello,

    If you write the data to SPIDAT register in a loop, the gap should be very small or there is no gap between the 2 words. 

    SPI is synchronous, so a small gap shouldn't cause problems.

  • Hi 

    The above data capture with in a loop writing SPIDAT register.

    Do we have any other methods to handle 24 bit patterns?

    Chandra

  • Hello Chandra,

    I used the same way before: word length=8 bit, and CSHOLD=1

    Why is the gap bigger every 3 words?

  • Can you share me one example project?

    I will check with scope on the board. Not sure why...

    Chandra

  • Hello Chandra,

    I don't have that example mentioned in my previous post on my PC. The following example is a function I used to read a device which supports 32-bit word-length. 

    uint32_t Data_Write_32(uint16_t address, uint32_t data)
    {

    spiDAT1_t dataconfig1_t;
    uint8_t txData[8], DataLength, blockSize;
    uint32_t spiErrorFlag;

    DataLength = 1; //number of 32-bit words
    blockSize = DataLength * 4 + 4; /* # of bytes*/

    dataconfig1_t.CS_HOLD = TRUE;
    dataconfig1_t.WDEL = TRUE;
    dataconfig1_t.DFSEL = SPI_FMT_0;   //8-bit word length 
    dataconfig1_t.CSNR = (0xFF ^ (0x1 << SPI_CS)); /*0xFB, CS2*/

    txData[0] = DATA_WRITE_OPCODE;
    txData[1] = (address & 0xFF00) >> 0x8;
    txData[2] = (address & 0x00FF) >> 0x0;
    txData[3] = DataLength;
    txData[4] = (data >> 24) & 0xFF;
    txData[5] = (data >> 16) & 0xFF;
    txData[6] = (data >> 8 ) & 0xFF;
    txData[7] = (data >> 0 ) & 0xFF;

    spiErrorFlag = spiTransmitData(SPI_PORT, &dataconfig1_t, blockSize, &txData[0]);
    return spiErrorFlag;

    }

  • Hi Wang,

    Is the block size computation is correct in the above function?

    I think if we are transmitting 8 bit data blocks then the size to be only 4 correct.. or my understanding is wrong?

    Chandra

  • Hi Chandra,

    The function is to transmit 4 bytes data plus 1 byte opcode, 2 bytes address and 1 bytes data length (32-bit). This depends on the SPI communication protocol of the slave device.