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.

MSP432E401Y: I2C issues, driverlib functions not available

Part Number: MSP432E401Y

Tool/software:

Hello,

I have been working on a project that involves porting a great deal of code from MSP430 to MSP432, and we're using the ethernet capabilities of the MSP432E401.  I have been able to get most of the needed functionality, but the resources I've found such as the MSP432 user guide reference functions that don't seem to exist.  I have gone through and re-installed CCS and the SimpleLink SDK to no avail.  I'm wondering if these functions are only available for MSP432Pxx devices, but I haven't found an answer on that yet.

I have tried to setup and use I2C as follows:

#define I2C_BASE_ADDR I2C9_BASE



void I2CInit(){

	MAP_GPIOPinConfigure(GPIO_PA0_I2C9SCL);
	MAP_GPIOPinConfigure(GPIO_PA1_I2C9SDA);
	MAP_GPIOPinTypeI2C(GPIO_PORTA_BASE, (GPIO_PIN_0 | GPIO_PIN_1));

	MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C9);
	while(!(MAP_SysCtlPeripheralReady(SYSCTL_PERIPH_I2C9)));


	I2CMasterInitExpClk(I2C_BASE_ADDR, g_ui32SysClock,0);
	I2CMasterEnable(I2C_BASE_ADDR);




}
void I2CwB(char data){

	int cycles = 0;
	int err = 0;
	int fifo = 0;


	while(!I2CFIFODataPutNonBlocking(I2C_BASE_ADDR,data)) {
		cycles++;
		delay_ms(10);
		err = I2CMasterErr(I2C_BASE_ADDR);
		fifo = I2CFIFOStatus(I2C_BASE_ADDR);
		if(cycles % 8 == 0)I2CTxFIFOFlush(I2C_BASE_ADDR);


	}
}

This is able to execute without issue, however I find that the SCL line goes low, and the SDA line is never pulled low, and no calls of the ICwB ever effect the pins.

I included the I2CMasterErr and I2CFIFOStatus so I could gather more information, but there's no errors or anything terribly interesting that shows up on those.


Thank you in advance for any and all help.  I greatly appreciate it.

  • Hi,

      I notice one mistake on your code. You wrote:

    MAP_GPIOPinTypeI2C(GPIO_PORTA_BASE, (GPIO_PIN_0 | GPIO_PIN_1));

    But it should be:

    MAP_GPIOPinTypeI2CSCL(GPIO_PORTA_BASE, GPIO_PIN_0);
    MAP_GPIOPinTypeI2C(GPIO_PORTA_BASE, GPIO_PIN_1);

    I'm not sure what your I2CwB is intending to do. You seem to be missing quite a few line of code to set up the slave address and preparing data using MAP_I2CMasterDataPut() and kickoff the state machine using MAP_I2CMasterControl. You can find several I2C examples in MSP432E SDK under C:\ti\simplelink_msp432e4_sdk_4_20_00_12\examples\nortos\MSP_EXP432E401Y\driverlib. I will suggest you start with i2c_mastermode_simple_transfer. 

    This I2C app note for MSP432E will be very useful as well. Please note that MSP432E and MSP430 I2C are not the same IP. 

    https://www.ti.com/lit/pdf/slaa776

    All I2C APIs for MSP432E are documented on this link. https://software-dl.ti.com/simplelink/esd/simplelink_msp432e4_sdk/3.10.00.11/docs/driverlib/msp432e4/html/i2c_8c.html

  • Thank you, that definitely is helpful.  I have found a great deal of examples reference code that mentions functions that don't seem to exist.  Is that just a difference between the MSP432Pxx vs MSP432E series?  I appreciate your response.

  •   I have found a great deal of examples reference code that mentions functions that don't seem to exist.

    Hi,

      I don't understand this statement. Are you referring to functions (e.g.  MAP_I2CMasterControl, MAP_I2CMasterDataPut and etc) that don't exist for MSP432P? Please note that MSP432P and MSP432E use different I2C IP. Those functions such as MAP_I2CMasterControl and MAP_I2CMasterDataPut and all APIs described in https://software-dl.ti.com/simplelink/esd/simplelink_msp432e4_sdk/3.10.00.11/docs/driverlib/msp432e4/html/i2c_8c.html are pertinent to MSP432E only. They do not apply to MSP432P or other MSP430 MCUs. 

  • I apologize for the confusion.  If I look at the MSP432 user guide, for instance, it contains the following code block for using I2C: 
    The issue however, is that the driverlib I have installed for MSP432E401Y does not seem to have the MAP_I2C_initMaster or MAP_I2C_setSlaveAddress, or several other functions I've found in example code online.  Is that specific to the MSP432Pxx?  I had expected code in the MSP432 User's Guide would work on this device.

    If these should exist on this system, does that suggest there is a setup issue with my environment? 

  • The issue however, is that the driverlib I have installed for MSP432E401Y does not seem to have the MAP_I2C_initMaster or MAP_I2C_setSlaveAddress, or several other functions I've found in example code online.  Is that specific to the MSP432Pxx?  I had expected code in the MSP432 User's Guide would work on this device.

    That is correct. I think these are driverlib functions for MSP432P. At the driverlib level, the functions will be different between MSP432P and MSP432E. If you plan to use baremetal system (non RTOS) then you will need to use the specific driverlib for the device of your choice. But if you plan to use TI-RTOS then there is I2C driver that will work across all devices that support SimpleLink platform. 

    If you take a look between C:\ti\simplelink_msp432p4_sdk_3_40_01_02\examples\rtos\MSP_EXP432P401R\drivers\i2ctmp and C:\ti\simplelink_msp432e4_sdk_4_20_00_12\examples\rtos\MSP_EXP432E401Y\drivers\i2ctmp, you will find the i2ctmp.c file use the same driver functions. 

  • Thank you, that resolves a lot of confusion I've had.  I was also able to get the I2C largely working utilizing the examples, just one minor issue currently.  Thank you for all of your help.