Hi there,
I'm using the MSP430FR2311 with the driverlib to communicate to a MPU9250 Sensor via I2C.
I configured the I2C using the examples from the driverlib:
#define CS_SMCLK_DESIRED_FREQUENCY_IN_KHZ 1000 //Set Ratio and Desired MCLK Frequency and initialize DCO CS_initFLLSettle(CS_SMCLK_DESIRED_FREQUENCY_IN_KHZ, CS_SMCLK_FLLREF_RATIO); //Set SMCLK = DCO with frequency divider of 1 CS_initClockSignal(CS_SMCLK, CS_DCOCLKDIV_SELECT, CS_CLOCK_DIVIDER_1); //Set MCLK = DCO with frequency divider of 1 CS_initClockSignal(CS_MCLK, CS_DCOCLKDIV_SELECT, CS_CLOCK_DIVIDER_1); // Configure I2C pins 1.2 and 1.3 GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P1, GPIO_PIN2 + GPIO_PIN3, GPIO_PRIMARY_MODULE_FUNCTION); // Disable the GPIO power-on default high-impedance mode to activate previously configured port settings PMM_unlockLPM5(); //Initialize Master EUSCI_B_I2C_disable(EUSCI_B0_BASE); EUSCI_B_I2C_initMasterParam param = {0}; param.selectClockSource = EUSCI_B_I2C_CLOCKSOURCE_SMCLK; param.i2cClk = CS_getSMCLK(); param.dataRate = EUSCI_B_I2C_SET_DATA_RATE_400KBPS; //param.dataRate = EUSCI_B_I2C_SET_DATA_RATE_100KBPS; param.byteCounterThreshold = 1; param.autoSTOPGeneration = EUSCI_B_I2C_NO_AUTO_STOP; EUSCI_B_I2C_initMaster(EUSCI_B0_BASE, ¶m); //Specify slave address EUSCI_B_I2C_setSlaveAddress(EUSCI_B0_BASE, MPU_I2C_ADDR); //Enable I2C Module to start operations EUSCI_B_I2C_enable(EUSCI_B0_BASE);
However, my logic analyzer shows the I2C Clock to only be ~196kHz when sending data to the sensor. The communication seems to work fine. I expected the clock to be around 400kHz, because of the 'EUSCI_B_I2C_SET_DATA_RATE_400KBPS'. Did I understand something wrong or am I doing something wrong?
Thanks and best regards,
moe