Page 1 of 1

I2C don't working in Release mode TD1208R

Posted: Tue Jan 10, 2017 2:57 pm
by gterrier
Hello,
I am trying to run the I2C bus on a TD1208R.
In the debug mode it’s working (I see the signal on the SDA and SCL pins with an oscilloscope) but in release mode I see nothing and the program is blocked in the while function.
My configuration in the both case is the same. Take note that in both case I’m using the corresponding files (debug files for debug mode and release files for release mode)
I’m using the portable eclipse found in the SDK.
Here is my code:

CMU_ClockEnable(cmuClock_I2C0, true);
GPIO_PinModeSet(SCL_PORT, SCL_BIT, gpioModeWiredAnd, 1);
GPIO_PinModeSet(SDA_PORT, SDA_BIT, gpioModeWiredAnd, 1);
I2C0>ROUTE=I2C_ROUTE_SDAPEN|I2C_ROUTE_SCLPEN|_I2C_ROUTE_LOCATION_LOC;

i2cInit.enable =true;
i2cInit.master =true;
i2cInit.refFreq =0;
i2cInit.freq =I2C_FREQ_FAST_MAX;
i2cInit.clhr = i2cClockHLRStandard;
I2C_Init(I2C0, &i2cInit);

i2cTransfert.addr = ADRESSE_I2C_ADD;
i2cTransfert.flags = I2C_FLAG_WRITE;
i2cTransfert.buf[0].data = values;
i2cTransfert.buf[0].len = 0;

_status = I2C_TransferInit(I2C0, &i2cTransfert);
while (_status == i2cTransferInProgress)
{
_status = I2C_Transfer(I2C0);
}

Thanks,
Regards,
Gterrier.

Re: I2C don't working in Release mode TD1208R

Posted: Sat Apr 08, 2017 9:30 pm
by batchris
hi'

UP, i'm in the same case ;(

Chris.

Re: I2C don't working in Release mode TD1208R

Posted: Wed Apr 12, 2017 3:17 pm
by mstempin
The I2C_Transfer structure contains the finite state automaton current state, I had problem in the past if this structure is not global (or static if declared within a function) so it is persistent.

However, the fact that it is working in Debug mode and not in Release mode seems to indicate that some compiler optimizations is taking place... Try declaring the I2C_Transfer structure as volatile then, so it don't get optimized out.