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.

Bug in the TI TPS Lib?



Hi,

I'm using the TI TPS DriverLIb for the TPS65381, v2.1.

 

In the TPS_DriverInit function in Tps_Driver.c, when the TPS_SAFETY_CHECK_CTRL register is set it calls the following line:

BFU8_SET(u8safety_check_ctrl, ((uint8)(!init_struct->blerror_pin_monitoring)),
                BF_NO_ERROR_START, BF_NO_ERROR_START);

But I think it should be:

BFU8_SET(u8safety_check_ctrl, ((uint8)(!init_struct->blerror_pin_monitoring)),
                BF_NO_ERROR_START, BF_NO_ERROR_LENGTH);

 

Since the expansion of BFU8_SET is

/*SAFETYMCUSW 340 S MR:19.7 <APPROVED> "Reason -  This is an advisory by MISRA.We accept this as a coding convention*/
#define BFU8_SET(y, x, start, len)    \
    ( (y) = (uint8)(((y) & ((uint8)(((uint8)~(BFU8_MASK((start),(len))))))) | ((uint8)BFU8_PREP((x),(start),(len)))))

Since bit 3 of this register is reserved and writing to it has no impact on the device state, I don't think it causes an issue, but I don't think it is correct.

 

Thanks,

David