Other Parts Discussed in Thread: HALCOGEN
I am having problem with code.
It doesn't go to i2c interrupt.
I placed Arduino to constantly send information to my TI controller and I want to receive them in interrupt routine.
This is my code for CCS:
sys_main.c:
i2cInit ();
i2cSetOwnAdd (i2cREG1, 0x0A);
i2cSetCount (i2cREG1, 10);
i2cSetDirection (i2cREG1, I2C_RECEIVER);
i2cSetMode (i2cREG1, I2C_MASTER);
i2cEnableNotification (i2cREG1, I2C_RX_INT);
_enable_IRQ ();
while (1);
This is my notification.c code:
i2cReceive (i2cREG1, 10, buff);
while (i2cIsBusBusy (i2cREG1) == true);
while (i2cIsStopDetected (i2cREG1) == 0);
clearSCD (i2cREG1);
This does not work. It never goes to interrupt.
If I place this in main (red color what I add):
i2cInit ();
i2cSetOwnAdd (i2cREG1, 0x0A);
i2cSetCount (i2cREG1, 10);
i2cSetDirection (i2cREG1, I2C_RECEIVER);
i2cSetMode (i2cREG1, I2C_MASTER);
i2cEnableNotification (i2cREG1, I2C_RX_INT);
_enable_IRQ ();
i2cReceive (i2cREG1, 10, buff_main);
while (i2cIsBusBusy (i2cREG1) == true);
while (i2cIsStopDetected (i2cREG1) == 0);
i2cClearSCD (i2cREG1);
while (1);
It receives few information (not 10 as proposed) in main and then enters interrupt.
What is my mistake?
Thanks!