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.

[参考译文] CCS/TMS320F28377S:I2C 未出现#39;t 获取响应

Guru**** 2481375 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/782461/ccs-tms320f28377s-i2c-didn-t-get-response

器件型号:TMS320F28377S

工具/软件:Code Composer Studio

使用 I2C 读取一个字节的源代码如下所示。

UINT8 I2C_READ_Single (UINT8 S_Address、UINT8 R_ADDRESS){

uint8 tempdata;

I2cbRegs.I2CSAR.All = S_Address;
I2cbRegs.I2CCNT = 1;
I2cbRegs.I2CDXR.ALL = R_ADDRESS;
I2cbRegs.I2CMDR.ALL = 0x2620;
while (!I2cRegs.I2CSTR.bit.ARDY);
I2cbRegs.I2CCNT = 1;
I2cbRegs.I2CMDR.ALL = 0x2C20;
while (!I2cbRegs.I2CSTR.bit.SCD);
tempdata = I2cbRegs.I2CDRR.all;
return (tempdata);

从机地址为0x68、寄存器地址为0x75。 因此、程序使用 I2C_READ_Single (0x68、0x75)读取一个字节。 但程序会停止 到 while (!I2cRegs.I2CSTR.bit.ARDY); 示波器显示0xd0 (0x68向左移动一位)、并发送0x75。 但不会从从器件返回数据。 I2C 总线的频率为45.45Khz。 如果您能帮助解决此问题、我将不胜感激。 谢谢。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    John、

    您是否正在处理 I2CA (或) I2CB?

    为什么有 while (!I2caRegs.I2CSTR.bit.ARDY);? 它应该是 while (!I2cbRegs.I2CSTR.bit.ARDY);?

    此致、
    曼诺伊