I came across a very obscure bug in the twl access routines in the A8_1.00.00 BSP release.
I was trying to determine why my RTC time from the TPS65950 was not working. I determined I was reading bad data from the TWL RTC registers (TWL I2C address group 0x4B). It was NOT throwing an access violations or anything like that ... it was just returning bad data. The RTC routines in rtc.c use:
s_rtc.hTWL = TWLOpen();
TWLReadByteReg(s_rtc.hTWL, TWL_YEARS_REG, &bcdTime[5]);
etc. etc.
I tried rewriting the access routines using just the low level I2C1 routines and the data was returning correctly.
It seems the bug is in the twl_access.c file in the COMMON_TI_V1\TRITON\TWL\OAL directory. Upon further digging I determined the slaveAddress in the Device_t local static structure variable is not being initialized at all. It just so happens, in my case, it was being randomly set to "3". When I subsequently called TWLReadByteReg with an RTC register as the address the HIWORD is also "3" (see tps659xx_internals.h for example:
#define TWL_SECURED_REG_B 0x00030001 its HIWORD would also be "3")
This causes the TWLReadRegs to not have the correct slave address leading to some nasty results.
Could someone at TI verify my findings?
This is how I corrected the problem.