• Resolved

TPS92661-Q1: In reading the status registers, I am getting infinite loop in lmm_rd_1_byte function

Part Number: TPS92661-Q1

Hello TI,

I am working on front headlights and trying to read the fault status message from fault registers. On troubleshooting, I realized that its not actually sending me any data from receive buffers. It is going in an infinite loop while waiting for the gathered byte. I am copying the modified code. This function was initially written by TI.

void lmm_rd_1_byte(Uint8 lmm, Uint8 regaddr)
{
Uint16 i;

// We must first assemble the request and CRC it
TxBuf[0] = (0xC0 | lmm);
TxBuf[1] = regaddr;
// Get the CRC back
i = crc_16_ibm(TxBuf, 2);
// And process it
TxBuf[2] = (i & 0x00FF);
TxBuf[3] = ((i >> 8) & 0x00FF);

// Also make sure we are prepared to receive the data from the LMM
ReturnBytes = 1+1+2; // 1 Init + 1 Data + 2 CRC
GatheredBytes = 0;

// Now we can ship it
for(i = 0; i < 4; i++)
{
lmm_uart_xmit(TxBuf[i]);
}

// Now wait for the read
while(GatheredBytes < ReturnBytes)              
{

// This loop stays in infinite mode, Can timeout work ? how ?

while((SciaRegs.SCIRXST.bit.RXRDY == 0)                        // waiting for new data ?

// returns the gathered bytes

RxBuf[GatheredBytes++] = SciaRegs.SCIRXBUF.bit.RXDT;
}
}