cancel
Showing results for 
Search instead for 
Did you mean: 

Why does the I2C_CheckEvent function hang when debugging?

lovewar
Associate

I am testing the initialization module.
The issue is that while debugging, when I set a break point in the if statement or use the printf statement above the while in the sample below, it hangs.

It seems to be an event related issue, is there any way to handle this?
In particular, if I use a lot of printf statements, I get hung.

device : STM32F103xE 

debugger(driver) : j-link

 

IICcnt = 0;
while(!I2C_CheckEvent(I2C1, I2C_EVENT_MASTER_BYTE_RECEIVED))
{
   if( IICcnt > IICMAXDELAY ) // breakpoint to here.
   {
       /* Send STOP condition */
       I2C_GenerateSTOP(I2C1, ENABLE);

       /* Clear EV6 by setting again the PE bit */
       I2C_Cmd(I2C1, DISABLE);
       ret = ERROR_I2C_READDATA_RDDATA;
   }
}
0 REPLIES 0