Part Number: MSP430F5659
Tool/software: TI-RTOS
Hi,
I am working TI RTOS based application for MSP430F5659 controller, I have 2 I2C bus in my design
i.e.
I2CUSCIB1 - for EEPROM/Temp IC
I2CUSCIB2 - for serial to parallel switch IC
i am using below code to initialize the I2C handle ,
I2CUSCIB_Object i2cUSCIBObjects[MSP_MSP430F5659_I2CCOUNT];
const I2CUSCIB_HWAttrs i2cUSCIBHWAttrs[MSP_MSP430F5659_I2CCOUNT] = {
{
.baseAddr = USCI_B1_BASE,
.clockSource = USCI_B_I2C_CLOCKSOURCE_SMCLK
},
{
.baseAddr = USCI_B2_BASE,
.clockSource = USCI_B_I2C_CLOCKSOURCE_SMCLK
}
};
const I2C_Config I2C_config[] = {
{
.fxnTablePtr = &I2CUSCIB_fxnTable,
.object = &i2cUSCIBObjects[0],
.hwAttrs = &i2cUSCIBHWAttrs[0]
},
{
.fxnTablePtr = &I2CUSCIB_fxnTable,
.object = &i2cUSCIBObjects[1],
.hwAttrs = &i2cUSCIBHWAttrs[1]
}
};
/*
* ======== MSP_MSP430F5659_initI2C ========
*/
void MSP_MSP430F5659_initI2C(void)
{
/*
* NOTE: TI-RTOS examples configure USCIB0 as either SPI or I2C. Thus,
* a conflict occurs when the I2C & SPI drivers are used simultaneously in
* an application. Modify the pin mux settings in this file and resolve the
* conflict before running your the application.
*/
GPIO_setAsPeripheralModuleFunctionInputPin( GPIO_PORT_P8,
GPIO_PIN5 | GPIO_PIN6);
GPIO_setAsPeripheralModuleFunctionInputPin( GPIO_PORT_P9,
GPIO_PIN5 | GPIO_PIN6);
I2C_init();
}
Is this correct way to handle the 2 I2C buses?
i want to know whether this will create any issue, while handling application.
Please guide me if any other way of handling the I2C routines.
Earlier i had single bus I2CUSCIB1 with multiplexed and is it working fine, Now i am adding one more bus I2CUSCIB2 .
Thanks in advance
Nitesh
I2CUSCIB_Object i2cUSCIBObjects[MSP_MSP430F5659_I2CCOUNT];
//#ifdef EEPROM
const I2CUSCIB_HWAttrs i2cUSCIBHWAttrs[MSP_MSP430F5659_I2CCOUNT] = {
{
.baseAddr = USCI_B1_BASE,
.clockSource = USCI_B_I2C_CLOCKSOURCE_SMCLK
},
// {
// .baseAddr = USCI_B2_BASE,
// .clockSource = USCI_B_I2C_CLOCKSOURCE_SMCLK
// }
};
const I2C_Config I2C_config[] = {
{
.fxnTablePtr = &I2CUSCIB_fxnTable,
.object = &i2cUSCIBObjects[0],
.hwAttrs = &i2cUSCIBHWAttrs[0]
},
// {
// .fxnTablePtr = &I2CUSCIB_fxnTable,
// .object = &i2cUSCIBObjects[1],
// .hwAttrs = &i2cUSCIBHWAttrs[1]
// }
};
/*
* ======== MSP_MSP430F5659_initI2C ========
*/
void MSP_MSP430F5659_initI2C(void)
{
/*
* NOTE: TI-RTOS examples configure USCIB0 as either SPI or I2C. Thus,
* a conflict occurs when the I2C & SPI drivers are used simultaneously in
* an application. Modify the pin mux settings in this file and resolve the
* conflict before running your the application.
*/
GPIO_setAsPeripheralModuleFunctionInputPin( GPIO_PORT_P8,
GPIO_PIN5 | GPIO_PIN6);
//
// GPIO_setAsPeripheralModuleFunctionInputPin( GPIO_PORT_P9,
// GPIO_PIN5 | GPIO_PIN6);
I2C_init();
}