- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Suppose if slave device data width is 32 bit (means if we want to read it through i2c,slave device will output 32 bit data).But my I2C IP- receive register width is only 8 bit.so reading i2c results only to display 8 bit at a time.then how to get all 32 bits between one START and one STOP condition. So,kindly tell me,if i get first 8 bits of data,how to get another 8 bits of data then another.. upto 32 bits? In Nios II, I have put "counter" which counts up to four (4 bytes=32 bits),after that it will again reset to 0 and again new START condition which i have put in while(1) loop to read continuously 32 bits(4 bytes). Just want to know,will this work or will i get 32 bits data all properly which was actually transmitted from the slave device? or if any other solution,kindly suggest me. I have attached the code. Thanks.Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You should refer to the slave device specification for details. Generally, the first byte after a start condition has to be a device address, written by the master.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thanks for ur prompt reply but i know that actually i have done that also as u can see from the code attached.My question is after "start+device address+R/W+ACK(from slave)" and then slave will give 32 bit but my IP data width is 8 bit means it can accept only 8 bit at a time.So i should read 4 times,right?
Thanks- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes usually the slaves that give 16 or 32 bit values can be accessed using 2 or 4 8-bit reads without having to specify a new address for each byte. Just continue reading 8-bits values.
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