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.
Hello,
I am debugging a simple project of i2c with other board. I just have 2 functions, one to write and the other to read. In main, I call this functions, first writing and then reading the same register.
Well, the issue is that when I am debugging "Step Into" button all works fine, but if I debug with "Step over" it doesn´t work properly and take differents results or just don't change from zero.
I have tried many times and always the same problem. What is happening?
Thanks!
I am using a Tiva TM4C123GXL.
The part code involved is:
.......
i2c_write(0x82,0x0A,1);
datorecibido=i2c_read(0x82);
.........
.........
void i2c_write(uint8_t register_address,uint32_t register_data,uint8_t nbytes){
if(nbytes==1){
I2CMasterSlaveAddrSet(I2C1_BASE, 0x0D,false);
I2CMasterDataPut(I2C1_BASE, register_address);
I2CMasterControl(I2C1_BASE,I2C_MASTER_CMD_BURST_SEND_START);
while(I2CMasterBusy(I2C1_BASE)){}
uint8_t register_data1= register_data;
I2CMasterDataPut(I2C1_BASE, register_data1);
I2CMasterControl(I2C1_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
while(I2CMasterBusy(I2C1_BASE)){}
}
while(I2CMasterErr(I2C1_BASE) != I2C_MASTER_ERR_NONE){}
return;
}
uint32_t i2c_read(uint8_t register_address){
I2CMasterSlaveAddrSet(I2C1_BASE, 0xD,true);
I2CMasterControl(I2C1_BASE,I2C_MASTER_CMD_SINGLE_RECEIVE);
data = I2CMasterDataGet(I2C1_BASE);
return data;
}
.......
When I debug this clicking on "Step into" or F5 -> datorecibido=0x0A
But clicking on "Step over" or F6 ->datorecibido=0x00
If I click on "Resume" and then "Pause", the program is in a while(1) interrupt :
//This is the code that gets called when the processor receives a fault
// interrupt. This simply enters an infinite loop, preserving the system state
// for examination by a debugger.
//
//*****************************************************************************
static void
FaultISR(void)
{
//
// Enter an infinite loop.
//
while(1)
{
}
}
It's very extrange! Do you know why?
Since this happened, Now I have the program stopped in the first while(I2CMasterBusy(I2C1_BASE)){}