This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

I2C with F28M35H52C1

Other Parts Discussed in Thread: CONTROLSUITE

I'm using the F28M35xx ISO controlCARD with the F28M35H52C1 microcontroller and I can't start
an I2C comunication with ARM core to the EEPROM. The pins that interface with the EEPROM are PIN6 and PIN7 of PORT B, and after a few tries I realized that the AFSEL register of PIN7 in PORT B doesn't set, so I couldn't see the I2C_CLOCK signal in an oscilloscope. 

My code is 

SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C0);

SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);

GPIOPinConfigure(GPIO_PB7_I2C0SCL);
GPIOPinConfigure(GPIO_PB6_I2C0SDA);

HWREG(GPIO_PORTB_BASE + GPIO_O_AFSEL) |= (GPIO_PIN_6 | GPIO_PIN_7);

(just after this line the register it's set as 0x00000040 instead of 0x000000C0 while debugging step by step)

GPIOPinTypeI2C(GPIO_PORTB_BASE, GPIO_PIN_6 | GPIO_PIN_7); 


I2CMasterInitExpClk(I2C0_MASTER_BASE, SysCtlClockGet(SYSTEM_CLOCK_SPEED), false);

And then I'm stucked in the while

while (I2CMasterBusy(I2C0_MASTER_BASE)) {
}

Is there any mistake in my code?

(There's the sentence HWREG(SYSCTL_MWRALLOW) = 0; before all this code)

  • Hi Pau,

    Are you referring any example code? The same can be found here: C:\ti\controlSUITE\device_support\f28m35x\v206\F28M35x_examples_Master\i2c_loopback\m3

    Regards,
    Gautam
  • Hi Gautam,

    I used the i2c_loopback example as a reference to develop my code, it seems to work well. However in the example I can't see the signals on the pins and, to comunicate the master with an slave like the EEPROM, I understand I need to set the AFSEL register of the corresponding pins to get an output signal. If I use I2C0 in pins 2 and 3 of PORTB the AFSEL register gets set but I can't see no signal as there's no pull-up, but when I use the pins 6 and 7 of PORTB, ONLY pin 6 works. I can't understand what's wrong with pin 7.

    Any ideas?

    Thank you,
    Pau