雷竞技电竞平台对话半导体客户支持- i2c eeprom写入 https://support.dialog-semiconductor.com/resource-keywords/i2c-eeprom-write 现象在i2c_write_byte https://support.dialog-semiconductor.com/qustion-i2cwritebyte < div class = "字段field-name-taxonomy-forums field-type-taxonomy-term-reference field-label-above”> < div class = "字段标签" >论坛:,< / div > < div class = "字段条目" > < div class =”field-item甚至“rel = " sioc: has_container " > < a href = " /论坛/ dialog-smartbond-bluetooth-low-energy - % E2 % 80% 93 -软件”“=“sioc:容器sioc:论坛”属性= " rdfs: label skos: prefLabel”数据类型= " " >对话框Smartbond蓝牙低能量-软件< / > < / div > < / div > < / div > < div class =”字段field-name-body field-type-text-with-summary field-label-hidden”> < div class = "字段条目" > < div class =”field-item甚至“财产=“内容:编码”> < p > i2c_eeprom_write_byte函数,它首先等待eeprom就绪。在i2c_wait_until_eeprom_ready ();它重复,如果不是ACK。但是,它只在i2c数据总线上发送0x08而不是设备地址。车上不应该有AKC。然后它会在这里无限循环。

当我进入SEND_I2C_COMMAND(0x08)时,运行按钮是灰色的,似乎cpu停止了。然后我点击停止按钮,指针仍然在SEND_I2C_COMMAND。

有人知道如何解决这个问题吗?

void i2c_eeprom_write_byte(uint32_t address, uint8_t wr_data)
{
i2c_wait_until_eeprom_ready();
i2c_send_address(address);

WAIT_WHILE_I2C_FIFO_IS_FULL(); // Wait if I2C Tx FIFO is full
SEND_I2C_COMMAND(wr_data & 0xFF); // Send write data
WAIT_UNTIL_I2C_FIFO_IS_EMPTY(); // Wait until Tx FIFO is empty

WAIT_UNTIL_NO_MASTER_ACTIVITY(); // wait until no master activity
}

void i2c_wait_until_eeprom_ready(void)
{
uint16_t abort_SR_Status; // TX Abort Source Register
// Polling until EEPROM ACK to detect busy period
do {
SEND_I2C_COMMAND(0x08); // Make a dummy access
WAIT_UNTIL_I2C_FIFO_IS_EMPTY(); // Wait until Tx FIFO is empty
WAIT_UNTIL_NO_MASTER_ACTIVITY(); // Wait until no master activity
abort_SR_Status = GetWord16(I2C_TX_ABRT_SOURCE_REG); // Read the Tx abort source register
GetWord16(I2C_CLR_TX_ABRT_REG); // Clear the Tx abort flag
} while( (abort_SR_Status & ABRT_7B_ADDR_NOACK) != 0 ); // Repeat if not ACK
}

Keywords: 
Device: 
2015年5月27日星期三13:54:43 +0000 zhangxw211 1601年https://support.dialog-semiconductor.com https://support.dialog-semiconductor.com/qustion-i2cwritebyte#comments