Learn MoreFAQsTutorials

2 posts / 0 new
Last post
Roie DAHAN
Offline
Last seen:4 months 4 weeks ago
Joined:2018-11-19 16:32
Read FIFO I2C

Hi,

I'm trying to read a 32 Byte FIFO (using I2C)

The FIFO register address is constant (0x09) and require to re-read the same address while transmiting STOP at the end.

Please see what i'm missing here ?

Thanks

void user_i2c_multi_byte_read_FIFO(uint32_t reg_address, uint8_t *rd_data, uint32_t num_bytes)
{

int j=0;

GLOBAL_INT_DISABLE();

user_i2c_send_address(reg_address);

for (j = 0; j < num_bytes; j++)
{
WAIT_WHILE_I2C_FIFO_IS_FULL(); // Wait if Tx FIFO is full
SEND_I2C_COMMAND(0x0100); // Set read access for times
}

// End of critical section
GLOBAL_INT_RESTORE();

// Get the received data
for (j = 0; j < num_bytes; j++)
{
WAIT_FOR_RECEIVED_BYTE(); // Wait for received data
rd_data[j] = (0xFF & GetWord16(I2C_DATA_CMD_REG)); // Get the received byte
}

WAIT_UNTIL_I2C_FIFO_IS_EMPTY(); // Wait until Tx FIFO is empty
WAIT_UNTIL_NO_SLAVE_ACTIVITY();
}

Device:
PM_Dialog
Offline
Last seen:6 days 15 hours ago
Staff
Joined:2018-02-08 11:03
Hi Roie DAHAN,

Hi Roie DAHAN,

The i2c_eeprom library has already implemented APIs from this usage. Can you please try the i2c_eeprom_read_data() and the i2c_eeprom_write_data()?

Thanks, PM_Dialog