Questions and discussions about the software that runs on the TD RF module itself.
gterrier
 
Posts: 1
Joined: Wed Sep 28, 2016 1:09 pm

I2C don't working in Release mode TD1208R

by gterrier Tue Jan 10, 2017 2:57 pm

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.
batchris
 
Posts: 7
Joined: Sat Dec 03, 2016 3:44 pm

Re: I2C don't working in Release mode TD1208R

by batchris Sat Apr 08, 2017 9:30 pm

hi'

UP, i'm in the same case ;(

Chris.
User avatar
mstempin
 
Posts: 168
Joined: Thu May 07, 2015 9:24 am

Re: I2C don't working in Release mode TD1208R

by mstempin Wed Apr 12, 2017 3:17 pm

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.
Return to Firmware

Who is online

Users browsing this forum: Baidu [Spider] and 1 guest