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.

TMS320F28375D: When does I2CCNT get written to internal data counter?

Part Number: TMS320F28375D


Hello,

I've observed that when I:

- set I2CMDR = IRS | MST | TRX | STT

- set I2CCNT 2

- write 2 bytes

- then wait for ARDY and clear it

- then set I2CCNT to X, X>0

- set I2CMDR anew for TX, this time with STT=0 (since we already sent one) but SCD=1 (so I get a stop condition at the end)

The last step immediately generates a stop condition, which would hint that the internal data counter is still zero.

I played around some more and it seems I2CCNT gets written into internal data counter when generating start condition. (That's just a speculation, but feel free to confirm or correct me)

Unfortunately start condition resets my device's bus cycle so I can't really use repeated start condition.

I don't really have a problem with making it work, I'm more trying to make it pretty by separating address phase from data phase in code.

So my question is:

Is there a way to write internal data counter without generating start condition?

It's ok if the answer is no.

Thank you

  • Hi Jiri,

    Due to weather situations, the person best able to respond is unable to review & post.  Please expect a response by Thursday. 

    Sorry for the inconvenience.


    Thank you,
    Brett

  • Jiri,

    - set I2CMDR anew for TX, this time with STT=0 (since we already sent one) but SCD=1 (so I get a stop condition at the end)

    The last step immediately generates a stop condition, which would hint that the internal data counter is still zero.

    I played around some more and it seems I2CCNT gets written into internal data counter when generating start condition. (That's just a speculation, but feel free to confirm or correct me)

    Unfortunately start condition resets my device's bus cycle so I can't really use repeated start condition.

    To generate a repeated start condition, you shouldn't generate STOP condition after address bytes are transmitted. Your speculation is indeed correct. When you generate second START condition, it was waiting for sending / receiving I2CCNT number of bytes.

    Here is the procedure to generate repeated START condition:

    - Make sure STP bit isn't SET.

    - set I2CMDR = IRS | MST | TRX | STT

    - set I2CCNT 2

    - write 2 bytes

    - then wait for ARDY and clear it

    - Set I2CCNT bit again to number of bytes transmitted / received

    - Generate repeated START condition by setting STT bit

    - You can now have STP condition set in I2CMDR to generate STOP condition

    Regards,

    Manoj

  • Sorry for my delay. Yep that's exactly what I needed.

    Thanks a lot Manoj!