TI中文支持网
TI专业的中文技术问题搜集分享网站

TMS320F28034: 官方的IIC程序问题如下:

Part Number:TMS320F28034Other Parts Discussed in Thread:C2000WARE

C2000Ware_4_01_00_00\device_support\f2803x\examples\c28\i2c_eeprom文件夹下的文件Example_2803xI2C_eeprom.c

Uint16 
I2CA_ReadData(struct I2CMSG *msg)
{//// Wait until STP bit is cleared from any previous master communication.// Clearing of this bit by the module is delayed until after the SCD bit is// set. If this bit is not checked prior to initiating a new message, the// I2C could get confused.//if (I2caRegs.I2CMDR.bit.STP == 1){return I2C_STP_NOT_READY_ERROR;}I2caRegs.I2CSAR = msg->SlaveAddress;if(msg->MsgStatus == I2C_MSGSTAT_SEND_NOSTOP){//// Check if bus busy//if (I2caRegs.I2CSTR.bit.BB == 1){return I2C_BUS_BUSY_ERROR;}I2caRegs.I2CCNT = 2;I2caRegs.I2CDXR = msg->MemoryHighAddr;I2caRegs.I2CDXR = msg->MemoryLowAddr;I2caRegs.I2CMDR.all = 0x2620;// Send data to setup EEPROM address}else if(msg->MsgStatus == I2C_MSGSTAT_RESTART){I2caRegs.I2CCNT = msg->NumOfBytes;  // Setup how many bytes to expectI2caRegs.I2CMDR.all = 0x2C20;// Send restart as master receiver}return I2C_SUCCESS;
}

I2C_MSGSTAT_SEND_NOSTOP 和 I2C_MSGSTAT_RESTART 两者有什么区别?

我使用的IIC芯片是AT24C02 那么

 I2caRegs.I2CCNT = 2;
I2caRegs.I2CDXR = msg->MemoryHighAddr;
I2caRegs.I2CDXR = msg->MemoryLowAddr;

是否要改成

I2caRegs.I2CCNT = 1;
//I2caRegs.I2CDXR = msg->MemoryHighAddr;
I2caRegs.I2CDXR = msg->MemoryLowAddr;

谢谢!

Yale Li:

Inver 说:

我使用的IIC芯片是AT24C02 那么

 I2caRegs.I2CCNT = 2; I2caRegs.I2CDXR = msg->MemoryHighAddr; I2caRegs.I2CDXR = msg->MemoryLowAddr;

是否要改成

I2caRegs.I2CCNT = 1;//I2caRegs.I2CDXR = msg->MemoryHighAddr; I2caRegs.I2CDXR = msg->MemoryLowAddr;

这个要结合使用的器件来看了,我对这个器件不是很了解。

,

Inver:

在使用IIC过程中,其他中断比如定时器中断或者PWM中断是否影响IIC的读写?

IIC读写的时候是否关闭这些中断?’

,

Inver:

I2caRegs.I2CDXR = msg->MemoryHighAddr;I2caRegs.I2CDXR = msg->MemoryLowAddr;

MemoryHighAddr和MemoryLowAddr分别是什么情况下使用?

,

Yale Li:

虽然IIC中断的优先级比EPWM的中断低,但是C2000的中断默认是不嵌套的,所以IIC中断在执行时不会受到其它中断的影响;

Inver 说:MemoryHighAddr和MemoryLowAddr分别是什么情况下使用?

这些是EEPROM的地址,具体要结合使用的器件。

赞(0)
未经允许不得转载:TI中文支持网 » TMS320F28034: 官方的IIC程序问题如下:
分享到: 更多 (0)

© 2024 TI中文支持网   网站地图 鲁ICP备2022002796号-1