Hi,
I want to use my Tiva board to talk to a power supply via smbus.
There appears to be an smbus.c/h files.
After setting up I2C init, i try initializing smbus.
tSMBus *smbus0;
memset(&smbus0, 0, sizeof(tSMBus));
ROM_SMBusMasterInit(smbus0, I2C0_BASE, g_ui32SysClock);
I get a fault ISR immediately. What else do I need to do to start reading 2 bytes from my power supply.
I essentially need to write a command byte and read back a 2 byte result.
void initI2C0(void)
{
//This function is for eewiki and is to be updated to handle any port
//enable I2C module
SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C0);
//reset I2C module
SysCtlPeripheralReset(SYSCTL_PERIPH_I2C0);
//enable GPIO peripheral that contains I2C
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
// Configure the pin muxing for I2C0 functions on port B2 and B3.
GPIOPinConfigure(GPIO_PB2_I2C0SCL);
GPIOPinConfigure(GPIO_PB3_I2C0SDA);
// Select the I2C function for these pins.
GPIOPinTypeI2CSCL(GPIO_PORTB_BASE, GPIO_PIN_2);
GPIOPinTypeI2C(GPIO_PORTB_BASE, GPIO_PIN_3);
// Enable and initialize the I2C0 master module. Use the system clock for
// the I2C0 module. The last parameter sets the I2C data transfer rate.
// If false the data rate is set to 100kbps and if true the data rate will
// be set to 400kbps.
I2CMasterInitExpClk(I2C0_BASE, g_ui32SysClock, false);
I2CMasterEnable (I2C0_BASE);
}