I have been using the I2C on my M3s with no problems. I tried to implement the same type of code on my new M4 evaluation code and am having some issues. One line goes low the the other stays high; both are pulled high to 3.3V via 2.2k resistors. Here is my code:
#include <string.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "inc/hw_uart.h"
#include "inc/hw_ssi.h"
#include "inc/hw_i2c.h"
#include "driverlib/gpio.h"
#include "driverlib/interrupt.h"
#include "driverlib/ssi.h"
#include "driverlib/rom.h"
#include "driverlib/sysctl.h"
#include "driverlib/systick.h"
#include "driverlib/uart.h"
#include "driverlib/udma.h"
#include "driverlib/i2c.h"
#include "driverlib/timer.h"
#include "driverlib/adc.h"
#include "driverlib/fpu.h"
#define Tps 10
volatile uint32_t Tick;
#ifdef DEBUG
void __error__(char *pcFilename, unsigned long ulLine){
}
#endif
void I2C0IntHandler(void){
I2CMasterIntClear(I2C0_MASTER_BASE);
}
void SysTickHandler(void){
Tick++;
}
int main(void){
FPUEnable();
FPULazyStackingEnable();
SysCtlClockSet(SYSCTL_USE_OSC | SYSCTL_SYSDIV_1 | SYSCTL_OSC_INT);
SysTickPeriodSet(ROM_SysCtlClockGet() / Tps);
SysTickEnable();
SysTickIntEnable();
SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C0);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
GPIOPinConfigure(GPIO_PB2_I2C0SCL);
GPIOPinConfigure(GPIO_PB3_I2C0SDA);
GPIOPinTypeI2C(GPIO_PORTB_BASE, GPIO_PIN_2 | GPIO_PIN_3);
I2CMasterInitExpClk(I2C0_MASTER_BASE, SysCtlClockGet(), true);
I2CMasterIntEnable(I2C0_MASTER_BASE);
IntEnable(INT_I2C0);
IntMasterEnable();
while(1){
Tick = 0;
while(Tick < Tps){
}
I2CMasterSlaveAddrSet(I2C0_MASTER_BASE, 0x40, false);
I2CMasterDataPut(I2C0_MASTER_BASE, 0x55);
I2CMasterControl(I2C0_MASTER_BASE, I2C_MASTER_CMD_SINGLE_SEND);
}
}