Part Number: MSP432P401R
When I try to execute the I2C_masterReceiveSingle function in the driverlib library the code hangs at:
while (!BITBAND_PERI(EUSCI_B_CMSIS(moduleInstance)->IFG,EUSCI_B_IFG_RXIFG0_OFS));
The comment says "Polling RXIFG0 if RXIE is not enabled" but I don't understand what is supposed to trigger this receive interrupt flag. My full code is as follows:
#include "driverlib.h" #define I2C_PINS GPIO_PORT_P3, GPIO_PIN6 + GPIO_PIN7 #define USCI_MODULE EUSCI_B2_BASE #define SLAVE_ADDRESS 0b1100000 /* I2C Master Configuration Parameter */ const eUSCI_I2C_MasterConfig i2cConfig = { EUSCI_B_I2C_CLOCKSOURCE_SMCLK, // SMCLK Clock Source 3000000, // SMCLK = 3MHz EUSCI_B_I2C_SET_DATA_RATE_100KBPS, // Desired I2C Clock of 100khz 0, // No byte counter threshold EUSCI_B_I2C_NO_AUTO_STOP // No Autostop }; int main(void) { WDT_A_holdTimer(); GPIO_setAsPeripheralModuleFunctionInputPin(I2C_PINS, GPIO_PRIMARY_MODULE_FUNCTION); /* Initializing I2C Master to SMCLK at 100khz with no autostop */ I2C_initMaster(USCI_MODULE, &i2cConfig); /* Specify slave address */ I2C_setSlaveAddress(USCI_MODULE, SLAVE_ADDRESS); /* Set Master in transmit mode */ I2C_setMode(USCI_MODULE, EUSCI_B_I2C_TRANSMIT_MODE); /* Enable I2C Module to start operations */ I2C_enableModule(USCI_MODULE); while (I2C_isBusBusy(USCI_MODULE) == EUSCI_B_I2C_BUS_BUSY); I2C_masterSendSingleByte(USCI_MODULE, 0x08); /* Set Master in transmit mode */ I2C_setMode(USCI_MODULE, EUSCI_B_I2C_RECEIVE_MODE); /* Specify slave address */ I2C_setSlaveAddress(USCI_MODULE, SLAVE_ADDRESS); I2C_masterReceiveSingle(USCI_MODULE); }
My oscilloscope shows: slave address, wr, ack, data, ack, stop and then nothing and debugging confirms that everything up to the last line is executing properly so I don't understand why the slave address isn't being sent by the read operation. I would greatly appreciate any help or suggestions.
Thanks,
Christian