- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In my design, I use opencore i2c ip for my i2c interface. This core provides the drivers which includes I2C_init, I2C_start, I2C_read, I2C_write.
The writing operation is straightforward but sometimes i2c reading operation is confused. In this case, the I2C_read function is : /**************************************************************** int I2C_read assumes that any addressing and start has already been done. reads one byte of data from the slave. on the last read we don't acknowldge and set the stop bit. inputs base = the base address of the component last = on the last read there must not be a ack return value byte read back. 15-OCT-07 initial release *****************************************************************/ alt_u32 I2C_read(alt_u32 base,alt_u32 last) so this read function doesn't have an argument for the i2c slave address. So my understanding is I need a writing operation before read to write to the i2c slave for the initial inner address. Since before the read or write, it requests a start, what I think the general procedure is : i2c_start(); // configure for write i2c_write(base, slave_inner_address, last); i2c_start(); // configure for read i2c_read(); Currently I don't have a hardware for testing, if anyone has experience about opencore i2c ip driver, I would appreciate if you can have a look to see whether my understanding about reading operation is correct. Thanks in advance.Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Your understanding of the general procedure is correct.
Docs/i2c_test.c gives some examples.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- Your understanding of the general procedure is correct. Docs/i2c_test.c gives some examples. --- Quote End --- Hi ted, I ignored the i2c_test.c in Docs folder, now I checked it. Thanks so much!

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page