Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Honored Contributor I
1,123 Views

I2C width problem...!

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.
0 Kudos
3 Replies
Highlighted
Honored Contributor I
16 Views

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.

0 Kudos
Highlighted
Honored Contributor I
16 Views

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
0 Kudos
Highlighted
Honored Contributor I
16 Views

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.

0 Kudos