Hi Folks,
Back in May of 2014 both Trey and Chris mentioned that adding I2C to Motorware was going to happen (https://e2e.ti.com/support/microcontrollers/c2000/f/902/t/341043#pi316717=1
I'm setting up the I2C module with this code in my HAL.C:
void HAL_setupI2C(HAL_Handle handle)
{
HAL_Obj *obj = (HAL_Obj *)handle;
I2C_setupClock(obj->i2cHandle, I2C_PRESCALER, I2C_BITTIMELOW, I2C_BITTIMEHIGH);
// I2CCLK = SYSCLK/(I2CPSC+1)
// Prescaler - need 7-12 Mhz on module clk bitTimeLow = 10, bitTimeHigh = 5
I2C_setMasterSlaveAddr(obj->i2cHandle, I2C_SLAVE_ADDR);
I2C_enableFifo(obj->i2cHandle); // Enable TX & RX FIFO mode
I2C_resetRxFifo(obj->i2cHandle); // Enable RX FIFO operation
I2C_setMaster(obj->i2cHandle); // enables I2C module
I2C_enable(obj->i2cHandle); // take I2C out of reset
return;
} // end of HAL_setupI2C() function
Is this setup OK to use the I2C without interrupts?
Since I'm only reading and writing to the chip before I start messing with the motor I probably don't need to use interrupts but I'm all ears if you think that I should use them.
I found an old TI Wiki article (http://processors.wiki.ti.com/index.php/I2C_Tips).
It has an non-isr example and I'd like to use this approach if you think that it is OK to do.
Thanks,
Richard