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.

TM4C123GH6PGE: I2C High speed

Part Number: TM4C123GH6PGE
Other Parts Discussed in Thread: TMP75

Hi, i'm trying to achive I2C high speed communications with this device, but without success

for example I'm trying to connect to TMP75 (http://www.ti.com/product/TMP75

I'm using TivaWare_C_Series-2.1.3.156, and tried to following command seqeunce (burst reading):

setup I2C frequency to 400KHz using ROM_I2CMasterInitExpClk

ROM_I2CMasterControl(I2C1_BASE, I2C_MASTER_CMD_HS_MASTER_CODE_SEND);

ROM_I2CMasterBusy waiting

ROM_I2CMasterSlaveAddrSet(I2C1_BASE, 0x4A, 0);

ROM_I2CMasterDataPut(I2C1_BASE, 0x00);

ROM_I2CMasterControl(I2C1_BASE, I2C_MASTER_CMD_BURST_SEND_START);

ROM_I2CMasterBusy waiting

ROM_I2CMasterSlaveAddrSet(I2C1_BASE, 0x4A, 1);

.............................

I have the following questions:

1. How do setup it correctlly

2. I saw in I2C.c in driverlib:

if(HWREG(ui32Base + I2C_O_PP) & I2C_PP_HS)
{
ui32TPR = ((ui32I2CClk + (2 * 3 * 3400000) - 1) /
(2 * 3 * 3400000)) - 1;
HWREG(ui32Base + I2C_O_MTPR) = I2C_MTPR_HS | ui32TPR;
}

This is set only on calling I2CMasterInitExpClk, what if I want to set other SCL freqeuncy, more like 1MHz so TMP75 could support it?

in overall This is very confusing, do I start with 400KHz and later setup again the frequency, or it will be automatically?

I can't find any examples in TivaWare_C_Series-2.1.3.156 regarding using I2C HS mode

any help will be appreciated

Thanks

Igor

  • As described in section 16.2.2.20 of the TivaWare™ Peripheral Driver Library User's Guide, you should call I2CMasterInitExpClk() and then change the I2CMTPR register immediate after the I2CMasterInitExpClk() function returns.

  • Thanks for you answer,

    Did my writing in sequence is correct?

    setup I2C frequency to 400KHz using ROM_I2CMasterInitExpClk

    ROM_I2CMasterControl(I2C1_BASE, I2C_MASTER_CMD_HS_MASTER_CODE_SEND);

    ROM_I2CMasterBusy waiting

    ROM_I2CMasterSlaveAddrSet(I2C1_BASE, 0x4A, 0);

    ROM_I2CMasterDataPut(I2C1_BASE, 0x00);

    ROM_I2CMasterControl(I2C1_BASE, I2C_MASTER_CMD_BURST_SEND_START);

    ROM_I2CMasterBusy waiting

    ROM_I2CMasterSlaveAddrSet(I2C1_BASE, 0x4A, 1);

    thanks

  • I am not an expert on the temperature sensors, but you must initiate the communications at 400K baud and follow the sequence described in section 7.3.2.7 of the TMP75 data sheet.

  • Then to change the I2C clock, you can use the equation from step 2 of your original post, but use your desired baud rate instead of 3,400,000. If you are running the TM4C123G at 80MHz and want a 2MHz I2C baud rate, you can simplify the equation as the value of ui32TPR will be equal to 2. That will give an actual baud rate of 1.9M baud. (The closest we can get to 2M baud with an 80MHz clock.)
  • Presented here is recent "feedback from several of our clients - using both this vendor's ARM MCUs (& others) - w/in I2C's HS mode."

    As vendor's Bob has described - that "switching of input filters" (to accommodate data transfers @ 5 to 20 times (normal I2C) data rate) appears to have (some) downside.    Far more data corruption has been noted when in "HS" mode - and that corruption disappears when 400KHz rate is employed.      Again - this is "No knock" upon this vendor - ARM MCUs from at least 3 other vendors - have behaved similarly.

    The corruption causes a "re-try" (sometimes several) - which adds time & complexity to the transfer process - thus any "operating gain" due to "HS" appears much muted.     This corruption is especially noted w/in automotive environment (which usually employs CAN - but for some circumstances) and w/in Power rich or high-speed switching industrial.

    Much in engineering involves "trade offs" - the quest for (always) higher speed proves not always easy.     (or w/out complications - extra demands.)

    If users are "bound/determined" to employ "HS" - our firm has found that, "Short, direct, even shielded connection paths" perform best...     (and it is advisable to insure that operating software can detect "re-tries" -and switch to 400KHz mode - when "HS" descends to "error-central.")

  • Is my setup sequence correct?

    how to use ROM_I2CMasterControl(I2C1_BASE, I2C_MASTER_CMD_HS_MASTER_CODE_SEND); ?

  • You may wish to read/review the post landing few minutes before yours. If your operating environment is noisy - and/or the MCU is at all "distant" from the sensor - "HS" may not provide the benefits you seek...
  • OK, but If I just want to how to use it in its optimal condition, how to use
    ROM_I2CMasterControl(I2C1_BASE, I2C_MASTER_CMD_HS_MASTER_CODE_SEND) ?
  • We must leave that, "level of detail to skilled vendor staff." I remain (doubtful) that your quest for "optimal condition" can be met by a "noise welcoming" (i.e. reduced filter) "HS" implementation. Suggest you test under "real world" conditions ASAP - lab tests only - sure to disappoint (later.)
  • Take a look at Amit's response in this post:
    e2e.ti.com/.../1085044
  • Has not vendor "Mike Mitchell's" code "missed"

    GPIOPinTypeI2CSCL()

    Even for (lowly/discarded) LX4F - that "SCL" was required!

    Perhaps explains the "hard time" reported...     Indeed - this is NOT Amit's code - yet it is the, "First to appear" when the specified link is opened...      And (still) wrong.    (and uncorrected!)

  • Thank you,

    I will look on it.