During our design validation test, it is found that i2c is working in 200Khz but nin our software configuration we 100kbps,
EUSCI_B_I2C_SET_DATA_RATE_100KBPS i use this api for setting frequency, when i use 400Khz then we get 500khz.
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.
During our design validation test, it is found that i2c is working in 200Khz but nin our software configuration we 100kbps,
EUSCI_B_I2C_SET_DATA_RATE_100KBPS i use this api for setting frequency, when i use 400Khz then we get 500khz.
How are you setting up your clocks (particularly SMCLK) and the I2C config block (for I2C_initMaster)?
BRW is a simple integer divider, so there are some data rates that you can't get exactly from some SMCLK speeds.
Driverlib computes BRW using an integer (truncating) division, so the resulting bit rate errs on the high side. From i2c.c (SDK rev 3.40.01.02) line 87:
> preScalarValue = (uint16_t) (config->i2cClk / config->dataRate);
The constant EUSCI_B_I2C_SET_DATA_RATE_400KBPS is just the number 400000. Based on your SMCLK speed and the I2C speed you want, you can put in the exact number you expect, e.g. with SMCLK=1MHz you can get 333.333 kHz, so you can just write "333333" there (resulting BRW=3)..
Hello Ajeesh,
Are you able to get your I2C clock working correctly or do you still need assistance?