Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob

XENSIV™ TLI4971- SICI programming code for accessing and configuring volatile settings – KBA238438

XENSIV™ TLI4971- SICI programming code for accessing and configuring volatile settings – KBA238438

Infineon_Team
Employee
Employee
50 replies posted 25 likes received 25 replies posted

Volatile settings can be programmed into the memory through a Serial Inspection and Configuration Interface (SICI) in the application. Code Listing 1 provides a way to access the test-mode and to write/read internal registers via SICI interface. The example code is part of the TLI4971MS2Go Eval Kit firmware.

In the Current2Go GUI, use the 'Volatile Settings' option to modify the sensor parameters. You can create a new configuration file using the "Use Config File" button, setting the configuration parameters into the RAM of the sensor.

In the following example code, the sequence (used for TLI4971MS2Go Eval Kit) for programming the volatile settings are mentioned. The function, WriteVolatileRegistersAndStart, writes the RAM registers responsible for the operation mode (address 0x11,0x12 and 0x13). The sensor first has to be in test-mode with the ISM core disabled. At the end, the sensor returns into normal operation by starting again the ISM core.

The programming sequence is as follows:

  1. The first command, which has to be sent after power-up, is the enter-interface command.
  2. After activating the interface, the integrated intelligent state machine (ISM) has to be powered down.
  3. To avoid unintended high current consumption during the programming voltage at the OCD pin, disable the error indication by writing the disable failure indication command to the device.
  4. Write the Registers (address 0x11,0x12, and 0x13).
  5. Read the Registers (address 0x11,0x12, and 0x13) and check.
  6. Set the device in normal operating mode by starting the ISM (power on ISM by writing 0x0000 to address 0x25).
  7. Change the SICI pin to Output mode and drive the SICI line low.
  8. Wait for 10 ms and change the SICI pin to Input mode.

Code Listing 1               Code example for programming TLI4971 via SICI interface

 

/*****************************************************************************

 *
 * Copyright (C) 2023 Infineon Technologies AG (INFINEON). All rights reserved.
*
 * THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
 * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
 * INFINEON SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
 *

 ******************************************************************************/

#include <src/Interfaces/SICI/SICICMD.h>

void enterTestMode(Sensor_t *sensor)

{

      ChangeOCDToOutput(sensor);

      driveOCDToLow(sensor);

      ChangeSiciPinToOutput(sensor);

      DriveSiciLineLow(sensor);

      SensorSupplyReset();

      WaitUs(150);

      DriveSiciLineHigh(sensor);

      // Send password

      sendCommand(IF_PASSWORD, sensor);

      // Release line

      changeSiciPinToTristate(sensor);

      ChangeSiciPinToInput(sensor);

      changeOCDTOTristate(sensor);

}

uint16_t computeCommand(bool write, uint8_t adress, uint8_t frameLenght)

{

      uint16_t computedCommand = 0;

      // if write command

      if(write)

            computedCommand = (1 << writeBit_pos);

      // read command

      else

      {

      }

      computedCommand |= (adress << adressOffset_pos);

      return computedCommand;

}

void powerDownISM(Sensor_t *sensor)

{

      sendCommand(computeCommand(cmdWRITE,37,0),sensor);

      sendCommand(ISM_POWER_DOWN,sensor);

      sendCommand(computeCommand(cmdWRITE,1,0),sensor);

      sendCommand(0,sensor);

}

uint16_t readRegister(Sensor_t *sensor, uint8_t reg_adr)

{

       //send read command of requested register

      sendCommand(computeCommand(cmdREAD, reg_adr, 0), sensor);

      return sendCommand(NOP,sensor);

}

void writeRegister(Sensor_t *sensor, uint8_t reg_adr, uint16_t reg_val)

{

      sendCommand(computeCommand(cmdWRITE, reg_adr, 0), sensor);

      sendCommand(reg_val, sensor);

}

void readEEPROM(Sensor_t *sensor, uint16_t *eepromContent)

{

       //send read command now so first data received in the for loop is the content of eep[0]

      sendCommand(NOP, sensor);

      sendCommand(64 << 4, sensor);

      *eepromContent++=sendCommand(65 << 4, sensor);

      *eepromContent++=sendCommand(66 << 4, sensor);

      *eepromContent++=sendCommand(67 << 4, sensor);

      *eepromContent++=sendCommand(68 << 4, sensor);

      *eepromContent++=sendCommand(69 << 4, sensor);

      *eepromContent++=sendCommand(70 << 4, sensor);

      *eepromContent++=sendCommand(71 << 4, sensor);

      *eepromContent++=sendCommand(72 << 4, sensor);

      *eepromContent++=sendCommand(73 << 4, sensor);

      *eepromContent++=sendCommand(74 << 4, sensor);

      *eepromContent++=sendCommand(75 << 4, sensor);

      *eepromContent++=sendCommand(76 << 4, sensor);

      *eepromContent++=sendCommand(77 << 4, sensor);

      *eepromContent++=sendCommand(78 << 4, sensor);

      *eepromContent++=sendCommand(79 << 4, sensor);

      *eepromContent++=sendCommand(80 << 4, sensor);

      *eepromContent++=sendCommand(81 << 4, sensor);

      *eepromContent++=sendCommand(NOP, sensor);

}

 

uint16_t readTemperature(Sensor_t *sensor)

{

      return readRegister(sensor, 24u);

}

bool WriteVolatileRegistersAndStart(Sensor_t *sensor, uint16_t line0, uint16_t line1, uint16_t line2)

{

      bool write_ok = true;

      enterTestMode(sensor);

      powerDownISM(sensor);

      //disable fail indication

      writeRegister(sensor, 1, 0);

      writeRegister(sensor, 17, line0);

      writeRegister(sensor, 18, line1);

      writeRegister(sensor, 19, line2);

      uint16_t readback0, readback1, readback2;

      readback0 = readRegister(sensor, 17);

      readback1 = readRegister(sensor, 18);

      readback2 = readRegister(sensor, 19);

      if(line0!=readback0) write_ok = false;

      if(line1!=readback1) write_ok = false;

      if(line2!=readback2) write_ok = false;

      writeRegister(sensor, 37, 0);

      ChangeSiciPinToOutput(sensor);

      DriveSiciLineLow(sensor);

      WaitUs(10000);

      ChangeSiciPinToInput(sensor);

      return write_ok;

}

 

0 Likes
148 Views