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.

RM57L843 MibSpi communication with TSP65381-Q1 PMIC

Other Parts Discussed in Thread: RM57L843, TPS65381-Q1, HALCOGEN

Hi,

I am using RM57L843 and TPS65381-Q1 Texas PMIC and connected both devices via MibSpi-3.

I am using the code that is generated by halcogen when I am trying to read the device ID and revision I am getting some junk values.

Can anyone provide me the example code or syntax to communicate two devices. 

Thanks & Regards,

Naveen.

  • Hi Naveen,
    Where did you read to obtain the device ID value? The device ID register is memory mapped to address 0xFFFFFFF0.
  • Hi Charles,

    I am using Halcogen to generate the drivers for Mibspi-3 as per step described in processors.wiki.ti.com/.../Configuring_HALCoGen_for_using_TPS_Driver.

    Then I copied sample code from examples an tried to read that from TPS65381 PMIC as transmitting the Revid address as in given screen shot and code as follows.

    uint16 TG0_TX_DATA[2] = {0x0C, 0x00};
    uint16 TG0_RX_DATA[8]= {0};

    uint16 TG1_TX_DATA[2] = {0x06, 0x00};
    uint16 TG1_RX_DATA[8]= {0};

    void main(void)

    {
    _enable_interrupt_();

    mibspiInit();


    mibspiEnableGroupNotification(mibspiREG3,0,0);

    mibspiSetData(mibspiREG3,0,TG0_TX_DATA);

    mibspiTransfer(mibspiREG3,0);

    ---printf statement

    mibspiGetData(mibspiREG3,0,TG0_RX_DATA);

    mibspiInit();

    mibspiEnableGroupNotification(mibspiREG3,0,0);

    mibspiSetData(mibspiREG3,0,TG1_TX_DATA);

    mibspiTransfer(mibspiREG3,0);

    ---printf statement

    mibspiGetData(mibspiREG3,0,TG1_RX_DATA);

    }

    I tried both scenario's but I am reading same value in both conditions.

    Attaching snip shot from the document SPI Communication - Hercules Microcontroller with TPS65381

    Thanks,

    Naveen.

  • Hi Naveen,
    If you use the the scope to probe SIMO do you see 0xC sent from the MCU to the TPS?
  • Hi Charles,

    I monitored the signal using scope and I am able to see 0x0C at SIMO and getting response as 0xA1 from slave.

    Can you please tell me the initialization sequence to the TPS65381 to the RM57L843.

    Regards,

    Naveen.

  • Hi Naveen,

     Please take a look at the below two app notes that talk about interfacing and initialization of TPS65381 with the Hercules device.

    6646.SPI Communication of Hercules Microcontrollers with TPS65381 DRAFT.pdf

  • Hi Charles,

    I am referring those documents only, when I send 0x0C, I am getting 0xA0FF as response.

    Is I need to initialize TPS65381 drivers before establishing the communication or it will automatically initialize after power on rest(power cycle)?

    Thanks & Regards,
    Naveen.
  • Hi Naveen,

      I'm not an expert in TPS65381. I may need to move your post to the automotive forum team later if we can't get it working. 

      Looking at the below timing diagram. You should be sending 0x0C00 as one 16-bit char on the SIMO to the TPS. Is this what you send to to TPS? You define the below:

    uint16 TG0_TX_DATA[2] = {0x0C, 0x00};
    uint16 TG0_RX_DATA[8]= {0};

      Are you sending a 16-bit char 0x000C to the TPS followed another 16-bit char 0x0000?

      

  • Hi,

    You can refer to the ethernet driver implementaiton provided in the 

     

    The implementation provided should even work on the MCU RM57L843(with modificaitons made to halcoge project to configure right pinmux).We do not have a demo application for this bundled in the release as we do not have a Development board with TPs65381.

    This is another wiki link which tells about configuring halcogen for interfacing TPS65381.

    Regards

    Manoj

  • Hi All,

    Thanks for your suggestion.

    I tried with following data patterns(Character length as 16 and 8) but nothing worked.

    uint16 tx_data[2] = {0x0C,0x00};

    uint16 tx_data6[1] = {0x0C00};
    uint16 tx_data7[1] = {0xC000};

    uint16 tx_data7[1] = {0x000C};

    Getting response some times as A001,AOFF,A5FF,A1FF.....

    As Parity is disabled, I tried with 0x06 instead of 0x0C I am getting same result.

    Code flow:

    mibspiReset(mibspiREG3);
    mibspiInit();

    mibspiSetData(mibspiREG3, 0, &tx_data6[0]);

    mibspiTransfer(mibspiREG3, 0);
    printf("Reading Revision ID : \n\r");

    mibspiGetData(mibspiREG3, 0, &rx_data6[0]);

    I am attaching Halcogen settings that I configured.MibSpi3 is using to communicate with slave.

    4682.ccs_inti.rar

  • Hi Manoj,

    As per your suggestions I have extracted TPS drivers and included it in my code.

    But the code got stuck itself at TPS_DriverInit(while loop), I am attaching the halcogen settings and pin configurations and custom code that I am using, I am using 2 sample functions, but in both scenarios code got stuck at the same point.Please help on this.

    Pleas go through the attachment for more details.

    8228.12May.rar

  • Hi,

    Sorry for coming back so late on this.Some how It missed my mailbox.

    Below is the state diagram of TPS state transitions.By the time you have called TPS init the TPS device has moved to safe state due to timeout.

    Please make sure that you call TPS init before 600 ms after startup of the device.I checked your code I see lot of other stuff happening before the TPS driver init is called.Please optimize the start up.Let me know the results.