Tool/software: Code Composer Studio
Hello,
I am working on a project that consists on configuring a touch panel through i2C. I have to use the pins PD0 (SCL) and PD1 (SDA) of the connector J3 of the tiva.
The communication seems not to work properly, so I would like to clarify the configuration I have made to be sure the issue is no comming from this.
I am working with RTOS. My init configuration of the i2C is the following :
/* initiate touch i2c device */ I2C_Params_init(&i2cparams); i2cparams.bitRate = I2C_100kHz; handle = I2C_open(EK_TM4C123GXL_I2C3,&i2cparams); if (handle == NULL) { System_printf("I2C was not opened"); }
Where the define EK_TM4C123GXL_I2C3 is refering to the following type from EK-TM4C123GXL.h :
/*! * @def EK_TM4C123GXL_I2CName * @brief Enum of I2C names on the EK_TM4C123GXL dev board */ typedef enum EK_TM4C123GXL_I2CName { EK_TM4C123GXL_I2C0 = 0, EK_TM4C123GXL_I2C3, EK_TM4C123GXL_I2CCOUNT } EK_TM4C123GXL_I2CName;
1) I am not sure I properly understand here if the I2C3 mentionned is really the one I would like to configure, could you confirm this ?
I am calling the function Board_initI2C() in the main. I don't understand neither the code of this function (Board_initI2C, file EK-TM4C123GXL.c) :
/* * ======== EK_TM4C123GXL_initI2C ======== */ void EK_TM4C123GXL_initI2C(void) { /* I2C1 Init */ /* Enable the peripheral */ SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C1); /* Configure the appropriate pins to be I2C instead of GPIO. */ GPIOPinConfigure(GPIO_PA6_I2C1SCL); GPIOPinConfigure(GPIO_PA7_I2C1SDA); GPIOPinTypeI2CSCL(GPIO_PORTA_BASE, GPIO_PIN_6); GPIOPinTypeI2C(GPIO_PORTA_BASE, GPIO_PIN_7); /* I2C3 Init */ /* * NOTE: TI-RTOS examples configure pins PD0 & PD1 for SSI3 or I2C3. Thus, * a conflict occurs when the I2C & SPI drivers are used simultaneously in * an application. Modify the pin mux settings in this file and resolve the * conflict before running your the application. */ /* Enable the peripheral */ SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C3); /* Configure the appropriate pins to be I2C instead of GPIO. */ GPIOPinConfigure(GPIO_PD0_I2C3SCL); GPIOPinConfigure(GPIO_PD1_I2C3SDA); GPIOPinTypeI2CSCL(GPIO_PORTD_BASE, GPIO_PIN_0); GPIOPinTypeI2C(GPIO_PORTD_BASE, GPIO_PIN_1); /* * These GPIOs are connected to PD0 and PD1 and need to be brought into a * GPIO input state so they don't interfere with I2C communications. */ GPIOPinTypeGPIOInput(GPIO_PORTB_BASE, GPIO_PIN_6); GPIOPinTypeGPIOInput(GPIO_PORTB_BASE, GPIO_PIN_7); I2C_init(); }
This code seems to configure i2C3 with the pins PD0 and PD1.
2) Do I have to disable the configuration written in the same file for the SSI3 ?
I have noticed otherwise that on the Tiva board, there is two PD0 and PD1 pins.
3) How do you know that you configure one or the others ?
Thank you in advance for your help !
Best regards,
Elisabeth Tixier