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.

Configuring SPI for TPS driver integration

Other Parts Discussed in Thread: TMS570LS1115

Hello,

I am using the TMS570LS1115 chip in my application and I want to interface with the TPS chip. For this I would like to use the SPI2 module and the TPS driver.

As I understood I only need to provide the send_recieve_data interface to the TPS library to make this work. 

boolean (* send_recieve_data) (const uint16 * const u16TransmitData,const uint32 u32TransmitSize,volatile uint16* u16RecieveData,uint32 * u32RecieveSize);

In the above function there are four parameters. I would like to know how to implement the required behavior of the function.

Does u32TransmitSize mean the size of the data in bytes or in 16-bit wide words?Since the data buffer is given as u16TransmitData it is confusing. The same issue is there for the receive buffer as well.

I guess once the TPS API is called it will send a command to the TPS chip and get the reply to that command directly.

In the spiTransmit function,

uint32 spiTransmitData(spiBASE_t *spi, spiDAT1_t *dataconfig_t, uint32 blocksize, uint16 * srcbuff)

What should be the spiDAT1_t configuration values? I guess the block size is 'u32TransmitSize' in this case.

Also the send_recieve_data expects a pointer to u32RecieveSize. This means that it expects the transferred data amount as output through receive size. But spi.h header file has no function to accommodate this requirement. 

If there is any example that would be helpful.

Thank you.

  • Hi Pradeepa,

    u32TransmitSize is the size of the data to be sent. u32 means the size is of a 32-bit unsigned int type. u16TransmitData is the data to be sent. u16 means it is of a 16-bit unsigned int. If you look at the TRM description for the TXDATA field in the SPIDATA1 register the TXDATA is a 16-bit field. Same for the u16RecieveData which is a 16-bit unsigned int type to correspond with the size of the RXDATA field in the SPIBUF register.

    The dataconfig_t is the configuration of the SPI for CS_HOLD, WDEL, DFSEL and CSNR. Please refer to TRM for details. The CS_HOLD defines whether or not you want to hold the chip select at the end of one single SPI transfer. The WDEL specified the duration of delay at the end of the current transaction before starting the next one. The CSNR defines which chip select you want to activate. All of the information are detailed in the TRM.
  • Hello,

    I configured the SPI. Now some data are coming but the TPS_DriverInit is stuck in the following code. The TPS chip returns 0x04 (SAFE) as the state.


    while (TPS_DEVICE_DIAGNOSTIC != u8tps_device_state)
    {
    blRetVal = TPS_GetCurrentTPSDeviceState(&u8tps_device_state);
    }

    I cannot understand the operation of the driver properly. 

    How to put the chip to the DIAGNOSTIC state? 

  • Hi,
    I have forwarded you post to the expert.
  • The configuration of the TPS device can be done only in the Diagnostic state.The init will not proceed if the TPS is not in the diagnostic state.The below state diagram shows  the state transitions of the TPS device.Please go through the datasheet of the TPS65381 to get thorough understanding of the state transitions.I think you are trying to do a debug reset. If you do a power on reset of the entire system  then I think it should not get stuck here and the init function should get executed appropriately.The attached Interface_support.c  shows how to implement the SPI support fucntion.(this is part of the safety diagnostic library release)

    7455.Interface_Support.c

  • Thank you for the information. I included the Interface_Support.c and did a little bit of modifications to select ADC pins and SPI base addresses. Now I can communicate with the TPS driver.

    TPS chip did not start in diagnostic mode because I was debugging it. Once power cycle the board TPS driver properly went to the diagnostic mode.

    Thank you.
  • Thank you. Happy to help you.