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: SPI CLK pulse problem

Part Number: TMS570LS3137

Hello,

I am working with SPI interface to comunícate with an external RAM memory. However, some pulses are missed in the clock signal. I attach a picture of it:

  

I configured WDEL = 0 and and CSHOLD = 1 to avoid this problem but the issue persists.

void writeFRAM(uint8 Ad2, uint8 Ad1, uint8 Ad0, uint8 dat)
{
    spiDAT1_t dataconfig1_t;

    dataconfig1_t.CS_HOLD = 1;      // The chip select signal is deactivated at the end of a transfer after the T2CDELAY time has passed.
    dataconfig1_t.WDEL    = 0;       // After a transaction, WDELAY of the corresponding data format will be loaded into the delay counter.
    dataconfig1_t.DFSEL   = SPI_FMT_0;  // Data word format 0 is selected.
    dataconfig1_t.CSNR    = 0xFE;       // Chip select (CS) number.

    const uint16 WREN = 0x06;                                   //WREN: Write enable command.
    const uint16 WRITE = 0x02;                                  //WRITE: Write command.
    uint16 TX_Data_Master[5] = {WRITE, Ad2, Ad1, Ad0, dat};          //Set write command and direction in the output buffer.

    spiTransmitData(spiREG3, &dataconfig1_t, 1, (uint16*)&WREN);           //WREN command to enable writing operations.
    spiTransmitData(spiREG3, &dataconfig1_t, 5, TX_Data_Master); //WREN command to enable writing operations.
}

uint8 readFRAM(uint8 Ad2, uint8 Ad1, uint8 Ad0)
{
    spiDAT1_t dataconfig1_t;

    dataconfig1_t.CS_HOLD = 1;          // The chip select signal is deactivated at the end of a transfer after the T2CDELAY time has passed.
    dataconfig1_t.WDEL    = 0;          // After a transaction, WDELAY of the corresponding data format will be loaded into the delay counter.
    dataconfig1_t.DFSEL   = SPI_FMT_0;  // Data word format 0 is selected.
    dataconfig1_t.CSNR    = 0xFE;       // Chip select (CS) number.

    const uint16 READ = 0x03;                                  //READ: Command to read an specific external memory location.
    uint16 TX_Data_Master[4] = {READ, Ad2, Ad1, Ad0};          //Set read command and direction in the output buffer.
    uint8 data = 0;

    spiTransmitData(spiREG3, &dataconfig1_t, 4, TX_Data_Master); //WREN command to enable writing operations.
    spiReceiveData(spiREG3, &dataconfig1_t, 1, (uint16 *) data);

    return data;
}

Thank you and regards,

Leandro

  • Hi Leandro,

    I don't see any missing SPI clock pulse. The clock gap between two transfers is expected.

    while(blocksize != 0U)
    {


    if((spi->FLG & 0x000000FFU) !=0U)
    {
       break;
    }

    if(blocksize == 1U)
    {
       Chip_Select_Hold = 0U;
    }
    /*SAFETYMCUSW 45 D MR:21.1 <APPROVED> "Valid non NULL input parameters are only allowed in this driver" */
    Tx_Data = *srcbuff;

    spi->DAT1 = ((uint32)DataFormat << 24U) |
                         ((uint32)ChipSelect << 16U) |
                         (WDelay) |
                         (Chip_Select_Hold) |
                         (uint32)Tx_Data;

    /*SAFETYMCUSW 567 S MR:17.1,17.4 <APPROVED> "Pointer increment needed" */
    srcbuff++;

    /*SAFETYMCUSW 28 D MR:NA <APPROVED> "Hardware status bit read check" */
    while((spi->FLG & 0x00000100U) != 0x00000100U)
    {
    } /* Wait */

    SpiBuf = spi->BUF;

    blocksize--;

    }

  • Hi QJ,

    Thanks for your reply. I thought that my communication mess is related with that gap.

    I will check why the slave is not responding.

    Regards,

    Leandro

  • HI Leandro,

    Please double check the communication protocol required by the memory device. If any question please let us know. Thanks

  • Hello QJ,

    Thank you very much. I think that solved the problem. However, when I send a command to the slave, CS is set high during the response. Is there a way to keep CS = 0V from the master transmission to the end of the slave response?

    I attach a capture of this situation.

    The yellow function should be the message from the slave, but the CS is set to high (function in red). I think that I could use the CS pin as gio.

    Regards,

    Leandro

  • I solved it! I used SCS pin as GPIO and I could receive data from the external memory.

    Thanks and regards!

    Leandro