Hi,
I am having a hard time getting signal out of tm4c1290NCPDT I2C. I tried on I2C1 (PG0, PG1) and I2C5 (PB0, PB1).
Using I2C1 on pin PG0 and PG1, 10K pull up to VDD, I am unable to get any signal out of SDA and SCL. The lines under scope stay low all the time.
The same code with different pins and peripheral worked on tm4c1231h6pz. I checked the data sheet, as well as the library user guide, and the errata sheet, and could not find any relevant information.
When trying to configure the pins as GPIO and wiggle them, the waveform is correct.
There is not any device currently connected to the two pins except the pull up resistors.
Is there a document that highlight the subtle differences between tm4c123 and tm4c129 i2c?
Thanks
#defines:
#define I2C_PERIPH SYSCTL_PERIPH_I2C1 #define GPIO_BASE GPIO_PORTG_BASE #define GPIO_PERIPH SYSCTL_PERIPH_GPIOG #define PIN_SCL GPIO_PG0_I2C1SCL #define PIN_SDA GPIO_PG1_I2C1SDA #define I2C_BASE I2C1_BASE #define GPIO_SCL_PIN GPIO_PIN_0 #define GPIO_SDA_PIN GPIO_PIN_1 #define PEN_GPIO_BASE GPIO_PORTN_BASE #define PEN_GPIO_PERIPH SYSCTL_PERIPH_GPION #define EN_GPIO_BASE GPIO_PORTH_BASE #define EN_GPIO_PERIPH SYSCTL_PERIPH_GPIOH #define PEN1_PIN GPIO_PIN_0 #define PEN2_PIN GPIO_PIN_1 #define PEN3_PIN GPIO_PIN_2 #define PEN4_PIN GPIO_PIN_3 #define EN_PIN GPIO_PIN_2
init functions:
//enable I2C SysCtlPeripheralEnable(I2C_PERIPH); //init configuration I2CMasterInitExpClk(I2C_BASE, sysClkRate, 0); // // Configure the pin muxing for I2C1 functions on port G0 and G1. GPIOPinConfigure(SEPIC_PIN_SCL); GPIOPinConfigure(SEPIC_PIN_SDA); // // //configure pin for SCL GPIOPinTypeI2CSCL(SEPIC_GPIO_BASE, SEPIC_GPIO_SCL_PIN); // // //configure pin for SDA GPIOPinTypeI2C(SEPIC_GPIO_BASE, SEPIC_GPIO_SDA_PIN); //enable as master I2CMasterEnable(I2C_BASE);
send function:
void I2CWriteReg(uint32_t ui32Base, uint8_t ui8SlaveAddr, uint8_t ui8RegCMD, uint8_t data){ //set slave address to communicate to: i2c bus base, slave address, receive = false I2CMasterSlaveAddrSet(ui32Base,ui8SlaveAddr,false); //send command byte to write to WIPER register I2CMasterDataPut(ui32Base,ui8RegCMD); printf("Cmd to be written to WIPER register 0x%x slave address 0x%x wiper register 0x%x\n", data,ui8SlaveAddr, ui8RegCMD); //set master to send I2CMasterControl(ui32Base,I2C_MASTER_CMD_BURST_SEND_START); //wait for bus to get cleared // while(I2CMasterBusy(ui32Base)){}; //send byte to set wiper to command input I2CMasterDataPut(ui32Base,data); //end I2CMasterControl(ui32Base,I2C_MASTER_CMD_BURST_SEND_FINISH); // Delay until transmission completes // while(I2CMasterBusy(ui32Base)){}; <<have to comment out because it causes the code to hang waiting for master to get cleared }