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.

MSP430FR2433: How does the I2C SCL signal work?

Part Number: MSP430FR2433

Looking at the "eusci_b_i2c_ex3_masterTxMultiple" example, I have a few questions about how the I2C clock signal works.

Here is the code that initializes the I2C module and the SMCLK, which is used to generate the I2C clock signal.

From my understanding, the I2C clock signal is derived from the SMCLK signal in this example (because we designate the SMCLK as the source during the initialization of the I2C module), but we independently initialize both the SMCLK signal and the I2C clock signal, is that correct?

In other words, we go in an set the SMCLK signal frequency to 1MHz, but then when we initialize the I2C module, we set the I2C clock frequency to some other (must be lower) value with the param.dataRate, is that correct?

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//Set DCO FLL reference = REFO
CS_initClockSignal(
CS_FLLREF,
CS_REFOCLK_SELECT,
CS_CLOCK_DIVIDER_1
);
//Set Ratio and Desired MCLK Frequency and initialize DCO
CS_initFLLSettle(
CS_SMCLK_DESIRED_FREQUENCY_IN_KHZ,
CS_SMCLK_FLLREF_RATIO
);
//Set ACLK = VLO with frequency divider of 1
CS_initClockSignal(
CS_ACLK,
CS_VLOCLK_SELECT,
CS_CLOCK_DIVIDER_1
);
//Set SMCLK = DCO with frequency divider of 1
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Yes. SMCLK is routinely used for many peripherals, so you want to be conscious of what speed it's running at. 

    The I2C clock (really the EUSCI clock -- it's the same for UART and SPI) is divided down from the source clock (in your case SMCLK) using the integer divisor in the BRW register. The driverlib call makes it appear you can set any (I2C) clock speed you choose, but you can only get integer quotients of SMCLK. 

    driverlib computes BRW by dividing i2cClock/dataRate; last I looked it did a truncating division, so if it doesn't divide evenly the clock runs faster than you asked for. (1MHz/100kHz is fine, but 1MHz/400kHz results in 500kHz.) 

**Attention** This is a public forum