Quantcast
Channel: Forum - Recent Threads
Viewing all articles
Browse latest Browse all 5781

I2C SSP_ERR_IN_USE when I set optimization level to 02. Why?

$
0
0

Hi all,

I need some help.   I am using i2c to read the configuration register from TI ADS1015 part.

I get SSP_ERR_IN_USE and I don't even see the read sequence in my logic analyzer waveform viewer if the code is compiled with -02 optimization level.      If I don't optimize the code (-00), the code runs good and the waveform of the read sequence looks perfect.

Thank you if you know why.

Michael

 

Here is the code:

// read configuration register
buf[0] = ADS1015_CONFIGREG_ADDR;
err = g_ads1015.p_api->write(g_ads1015.p_ctrl, buf, 1, false);     // Always successful with SSP_SUCCESS

if (SSP_SUCCESS != err) {
g_ioport.p_api->pinWrite(RED_LED_PIN, LED_ON); // turn on red led for error
while (1);
}

err = g_ads1015.p_api->read(g_ads1015.p_ctrl, buf, 2, false);     // SSP_SUCCESS with -00 optimization only.  SSP_ERROR_IN_USE with -02 optimization 

if (SSP_SUCCESS != err) {
g_ioport.p_api->pinWrite(RED_LED_PIN, LED_ON); // turn on red led for error
while (1);
}

 


Viewing all articles
Browse latest Browse all 5781

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>