AnsweredAssumed Answered

I2C function failed when called from ISR

Question asked by John Leung on Jun 4, 2015
Latest reply on Jun 11, 2015 by John Leung

Have a problem calling an I2C function from an ISR.

 

The following code executed with simple_LED_toggle() running OK.

However, when I2C_write_function() is executed, it ran into an infinite loop to check I2C bus busy.

This same I2C_write_function() works 100% OK when it is placed in main() loop.

 

So, problem is there only when I2C_write_function() is placed in PORTD_IRQHandller()

 

Any hint on this problem?

 

 

void I2C_write_function();

 

PORTD_IRQHandler()

{

  PORT_HAL_ClearPinIntFlag(portBaseAddr, pin);

  simple_LED_toggle();

  I2C_write_function();

}

Outcomes