AnsweredAssumed Answered

I2C1 on K64F - not working

Question asked by david atkins on Mar 4, 2018
Latest reply on Mar 5, 2018 by Robin_Shen

Tryignt o sue the I2C1 port of a K64F, have been able to toggle the pins using GPIO mode to prove that they are connected,

When I try and use the standrad library code it gets stuck at waiting for the followign code

while (!(base->S & kI2C_IntPendingFlag))
{
}

both SCL and SDA remain high which suggest that its not driving the I2C lines onto the pins, trying to use PTC10/11 pins.

the config tool generatyed the followign code for the pins
/* PORTC10 (pin 82) is configured as I2C1_SCL */
PORT_SetPinMux(PORTC, 10U, kPORT_MuxAlt5);

PORTC->PCR[10] = ((PORTC->PCR[10] &
/* Mask bits to zero which are setting */
(~(PORT_PCR_PS_MASK | PORT_PCR_PE_MASK | PORT_PCR_ODE_MASK | PORT_PCR_ISF_MASK)))

/* Pull Select: Internal pullup resistor is enabled on the corresponding pin, if the
* corresponding PE field is set. */
| (uint32_t)(kPORT_PullUp)

/* Open Drain Enable: Open drain output is enabled on the corresponding pin, if the pin is
* configured as a digital output. */
| PORT_PCR_ODE(kPORT_OpenDrainEnable));

/* PORTC11 (pin 83) is configured as I2C1_SDA */
PORT_SetPinMux(PORTC, 11U, kPORT_MuxAlt5);

PORTC->PCR[11] = ((PORTC->PCR[11] &
/* Mask bits to zero which are setting */
(~(PORT_PCR_PS_MASK | PORT_PCR_PE_MASK | PORT_PCR_ODE_MASK | PORT_PCR_ISF_MASK)))

/* Pull Select: Internal pullup resistor is enabled on the corresponding pin, if the
* corresponding PE field is set. */
| (uint32_t)(kPORT_PullUp)

/* Open Drain Enable: Open drain output is enabled on the corresponding pin, if the pin is
* configured as a digital output. */
| PORT_PCR_ODE(kPORT_OpenDrainEnable));

Any ideas?

David

Outcomes