Other Parts Discussed in Thread: F28M35H52C
Hi all,
I run into a problem with setting up the gpio pinMux in Concerto device, F28M35H52C.
I have 2 I2C buses connected to PF0/PF1 and PB6/PB7. Supposedly, I can connect the I2C0 module to either pair of the pins. Thus, by setting PB6/PB7 to I2C0 and PF0/PF1 to GPIO input with pull-ups, the I2C module should only talk to the devices connected to PB6/PB7 lines. On the other hand, by setting PF0/PF1 to I2C0 and PB6/PB7 to GPIO input with pull-ups, the I2C module should only talk to the devices connected to PF0/PF1 lines. But, I couldn't find a way to switch between these two conditions. I2C0 always works in the pin pairs whichever setup first. It's so frustration now, any comments will be highly appreciated. Thanks.
I have the I2C module initialized as following:
// the I2C0 module is initialized and connected to PB6/PB7 pin to begin with
// then set up the PF0/PF1 pins to be controlled by the master core
void I2C0_Init ()
{
// The I2C0 peripheral must be enabled before use.
SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C0);
SysCtlPeripheralReset(SYSCTL_PERIPH_I2C0);
// I2C0 is used with PortB[7:6].
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
GPIOPinConfigureCoreSelect(GPIO_PORTB_BASE, 0xC0, GPIO_PIN_M_CORE_SELECT); // enable GPIO_PIN6 | GPIO_PIN_7 to be controlled by master
GPIOPinUnlock (GPIO_PORTB_BASE, GPIO_PIN_7);
GPIOPinConfigure(GPIO_PB7_I2C0SCL);
GPIOPinConfigure(GPIO_PB6_I2C0SDA);
GPIOPinTypeI2C(GPIO_PORTB_BASE, GPIO_PIN_6 | GPIO_PIN_7);
// Enable and initialize the I2C0 master module at 400 KBps
I2CMasterInitExpClk(I2C0_MASTER_BASE, SysCtlClockGet(SYSTEM_CLOCK_SPEED), true);
// Enable the I2C interrupt.
IntEnable(INT_I2C0);
// Enable the I2C master interrupt.
I2CMasterIntEnable(I2C0_MASTER_BASE);
IntRegister(INT_I2C0, I2C0IntHandler);
// alternative I2C0 port using portF pin 0 and pin 1
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
GPIOPinConfigureCoreSelect(GPIO_PORTF_BASE, GPIO_PIN_0 | GPIO_PIN_1, GPIO_PIN_M_CORE_SELECT); // enable GPIO_PIN6 | GPIO_PIN_7 to be controlled by master
}
// switch the pinMux to connect PF0/PF1 to I2C0 and set PB6/PB7 to GPIO input
void I2C0_AltertivePin ()
{
GPIOPinTypeGPIOInput(GPIO_PORTB_BASE,GPIO_PIN_6|GPIO_PIN_7);
GPIOPinConfigure(GPIO_PF0_I2C0SDA);
GPIOPinConfigure(GPIO_PF1_I2C0SCL);
GPIOPinTypeI2C(GPIO_PORTF_BASE, GPIO_PIN_0 | GPIO_PIN_1);
}
// switch the pinMux to connect PB6/PB7 to I2C0 and set PF0/PF1 to GPIO input
void I2C0_OriginalPin()
{
GPIOPinTypeGPIOInput(GPIO_PORTF_BASE,GPIO_PIN_0|GPIO_PIN_1);
GPIOPinConfigure(GPIO_PB7_I2C0SCL);
GPIOPinConfigure(GPIO_PB6_I2C0SDA);
GPIOPinTypeI2C(GPIO_PORTB_BASE, GPIO_PIN_6 | GPIO_PIN_7);
}