请问基于TI的28035的iic程序,如下,28035有四级传输fifo,把I2C_NUMBYTES改为4(之前为2),程序不能运行。请问如何一次发送四个字节数据?
#define I2C_SLAVE_ADDR 0x50
#define I2C_NUMBYTES 4
#define I2C_EEPROM_HIGH_ADDR 0x00
#define I2C_EEPROM_LOW_ADDR 0x30
// Global variables
// Two bytes will be used for the outgoing address,
// thus only setup 14 bytes maximum
struct I2CMSG I2cMsgOut1={I2C_MSGSTAT_SEND_WITHSTOP,
I2C_SLAVE_ADDR,
I2C_NUMBYTES,
I2C_EEPROM_HIGH_ADDR,
I2C_EEPROM_LOW_ADDR,
0x12, // Msg Byte 1
0x34,
0x31,
0x04}; // Msg Byte 2
struct I2CMSG I2cMsgIn1={ I2C_MSGSTAT_SEND_NOSTOP,
I2C_SLAVE_ADDR,
I2C_NUMBYTES,
I2C_EEPROM_HIGH_ADDR,
I2C_EEPROM_LOW_ADDR};
Johnson Chen1:
因为IIC只有4极FIFO,而发送的是时候地址已经占用了个字节,因此你改成4是会有问题的。
I2caRegs.I2CDXR = msg->MemoryHighAddr; I2caRegs.I2CDXR = msg->MemoryLowAddr;
请问基于TI的28035的iic程序,如下,28035有四级传输fifo,把I2C_NUMBYTES改为4(之前为2),程序不能运行。请问如何一次发送四个字节数据?
#define I2C_SLAVE_ADDR 0x50
#define I2C_NUMBYTES 4
#define I2C_EEPROM_HIGH_ADDR 0x00
#define I2C_EEPROM_LOW_ADDR 0x30
// Global variables
// Two bytes will be used for the outgoing address,
// thus only setup 14 bytes maximum
struct I2CMSG I2cMsgOut1={I2C_MSGSTAT_SEND_WITHSTOP,
I2C_SLAVE_ADDR,
I2C_NUMBYTES,
I2C_EEPROM_HIGH_ADDR,
I2C_EEPROM_LOW_ADDR,
0x12, // Msg Byte 1
0x34,
0x31,
0x04}; // Msg Byte 2
struct I2CMSG I2cMsgIn1={ I2C_MSGSTAT_SEND_NOSTOP,
I2C_SLAVE_ADDR,
I2C_NUMBYTES,
I2C_EEPROM_HIGH_ADDR,
I2C_EEPROM_LOW_ADDR};
旭日:
回复 Johnson Chen1:
请问 其中#define I2C_MAX_BUFFER_SIZE 4 ,按理说MsgBuffer 可以转4个字节,应该可以发送啊?难道#define I2C_MAX_BUFFER_SIZE 2?
请问基于TI的28035的iic程序,如下,28035有四级传输fifo,把I2C_NUMBYTES改为4(之前为2),程序不能运行。请问如何一次发送四个字节数据?
#define I2C_SLAVE_ADDR 0x50
#define I2C_NUMBYTES 4
#define I2C_EEPROM_HIGH_ADDR 0x00
#define I2C_EEPROM_LOW_ADDR 0x30
// Global variables
// Two bytes will be used for the outgoing address,
// thus only setup 14 bytes maximum
struct I2CMSG I2cMsgOut1={I2C_MSGSTAT_SEND_WITHSTOP,
I2C_SLAVE_ADDR,
I2C_NUMBYTES,
I2C_EEPROM_HIGH_ADDR,
I2C_EEPROM_LOW_ADDR,
0x12, // Msg Byte 1
0x34,
0x31,
0x04}; // Msg Byte 2
struct I2CMSG I2cMsgIn1={ I2C_MSGSTAT_SEND_NOSTOP,
I2C_SLAVE_ADDR,
I2C_NUMBYTES,
I2C_EEPROM_HIGH_ADDR,
I2C_EEPROM_LOW_ADDR};
Johnson Chen1:
回复 旭日:
这个I2C_MAX_BUFFER_SIZE有多大是没关系,因为FIFO只有四级,因此一次最多只能往I2caRegs.I2CDXR写4个字节,超过是个字节你要判断FIFO是不是满了,才能再往里面写,你把例程逻辑改一下,加入以下判断FIFO空了,应该可以再往里面写。
请问基于TI的28035的iic程序,如下,28035有四级传输fifo,把I2C_NUMBYTES改为4(之前为2),程序不能运行。请问如何一次发送四个字节数据?
#define I2C_SLAVE_ADDR 0x50
#define I2C_NUMBYTES 4
#define I2C_EEPROM_HIGH_ADDR 0x00
#define I2C_EEPROM_LOW_ADDR 0x30
// Global variables
// Two bytes will be used for the outgoing address,
// thus only setup 14 bytes maximum
struct I2CMSG I2cMsgOut1={I2C_MSGSTAT_SEND_WITHSTOP,
I2C_SLAVE_ADDR,
I2C_NUMBYTES,
I2C_EEPROM_HIGH_ADDR,
I2C_EEPROM_LOW_ADDR,
0x12, // Msg Byte 1
0x34,
0x31,
0x04}; // Msg Byte 2
struct I2CMSG I2cMsgIn1={ I2C_MSGSTAT_SEND_NOSTOP,
I2C_SLAVE_ADDR,
I2C_NUMBYTES,
I2C_EEPROM_HIGH_ADDR,
I2C_EEPROM_LOW_ADDR};
旭日:
回复 Johnson Chen1:
哦哦,懂,谢谢。 问个其他问题,一次发送两个字节,第二个字节eeprom地址会自动加1吧,在数据储存起来?